use endian_trait arrays feature
This commit is contained in:
parent
6358b68236
commit
8c3c63fad0
|
@ -36,7 +36,7 @@ uuid = { version = "0.7", features = ["v4"] }
|
||||||
chrono = "0.4" # Date and time library for Rust
|
chrono = "0.4" # Date and time library for Rust
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
siphasher = "0.3"
|
siphasher = "0.3"
|
||||||
endian_trait = "0.6"
|
endian_trait = { version = "0.6", features = ["arrays"] }
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
md5 = "0.6"
|
md5 = "0.6"
|
||||||
base64 = "0.10"
|
base64 = "0.10"
|
||||||
|
|
|
@ -12,7 +12,7 @@ crate-type = ['lib', 'cdylib']
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
endian_trait = "0.6"
|
endian_trait = { version = "0.6", features = ["arrays"] }
|
||||||
errno = "0.2"
|
errno = "0.2"
|
||||||
failure = "0.1"
|
failure = "0.1"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
|
@ -165,16 +165,13 @@ pub mod server {
|
||||||
|
|
||||||
pub const PROTOCOL_VERSION: u32 = 1;
|
pub const PROTOCOL_VERSION: u32 = 1;
|
||||||
|
|
||||||
#[derive(Eq, PartialEq)]
|
pub const HELLO_MAGIC: [u8; 8] = *b"PMXBCKUP";
|
||||||
#[repr(C, packed)]
|
|
||||||
pub struct HelloMagic([u8; 8]);
|
|
||||||
pub const HELLO_MAGIC: HelloMagic = HelloMagic(*b"PMXBCKUP");
|
|
||||||
|
|
||||||
pub const HELLO_VERSION: u32 = 1; // the current version
|
pub const HELLO_VERSION: u32 = 1; // the current version
|
||||||
#[derive(Endian)]
|
#[derive(Endian)]
|
||||||
#[repr(C, packed)]
|
#[repr(C, packed)]
|
||||||
pub struct Hello {
|
pub struct Hello {
|
||||||
pub magic: HelloMagic,
|
pub magic: [u8; 8],
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,21 +188,6 @@ pub mod server {
|
||||||
// Data follows here...
|
// 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)]
|
#[derive(Endian)]
|
||||||
#[repr(C, packed)]
|
#[repr(C, packed)]
|
||||||
pub struct BackupCreated {
|
pub struct BackupCreated {
|
||||||
|
|
Loading…
Reference in New Issue