use endian_trait arrays feature

This commit is contained in:
Dietmar Maurer 2019-04-23 14:23:36 +02:00
parent 6358b68236
commit 8c3c63fad0
3 changed files with 4 additions and 22 deletions

View File

@ -36,7 +36,7 @@ uuid = { version = "0.7", features = ["v4"] }
chrono = "0.4" # Date and time library for Rust
openssl = "0.10"
siphasher = "0.3"
endian_trait = "0.6"
endian_trait = { version = "0.6", features = ["arrays"] }
walkdir = "2"
md5 = "0.6"
base64 = "0.10"

View File

@ -12,7 +12,7 @@ crate-type = ['lib', 'cdylib']
[dependencies]
chrono = "0.4"
endian_trait = "0.6"
endian_trait = { version = "0.6", features = ["arrays"] }
errno = "0.2"
failure = "0.1"
libc = "0.2"

View File

@ -165,16 +165,13 @@ pub mod server {
pub const PROTOCOL_VERSION: u32 = 1;
#[derive(Eq, PartialEq)]
#[repr(C, packed)]
pub struct HelloMagic([u8; 8]);
pub const HELLO_MAGIC: HelloMagic = HelloMagic(*b"PMXBCKUP");
pub const HELLO_MAGIC: [u8; 8] = *b"PMXBCKUP";
pub const HELLO_VERSION: u32 = 1; // the current version
#[derive(Endian)]
#[repr(C, packed)]
pub struct Hello {
pub magic: HelloMagic,
pub magic: [u8; 8],
pub version: u32,
}
@ -191,21 +188,6 @@ pub mod server {
// Data follows here...
}
impl Endian for HelloMagic {
fn to_be(self) -> Self {
self
}
fn to_le(self) -> Self {
self
}
fn from_be(self) -> Self {
self
}
fn from_le(self) -> Self {
self
}
}
#[derive(Endian)]
#[repr(C, packed)]
pub struct BackupCreated {