mirror of
https://github.com/fossasia/badgemagic-rs
synced 2025-06-24 07:43:58 +00:00
Update to zerocopy 0.8
This commit is contained in:
parent
e7989e763f
commit
116a506fe4
3 changed files with 11 additions and 12 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -1,6 +1,6 @@
|
||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
|
@ -1331,19 +1331,18 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.7.35"
|
version = "0.8.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.7.35"
|
version = "0.8.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -49,4 +49,4 @@ serde = { version = "1.0.204", features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1.0.121", optional = true }
|
serde_json = { version = "1.0.121", optional = true }
|
||||||
time = "0.3.36"
|
time = "0.3.36"
|
||||||
toml = { version = "0.8.19", optional = true }
|
toml = { version = "0.8.19", optional = true }
|
||||||
zerocopy = { version = "0.7.35", features = ["derive"] }
|
zerocopy = { version = "0.8.14", features = ["derive"] }
|
||||||
|
|
|
@ -12,7 +12,7 @@ use embedded_graphics::{
|
||||||
Drawable,
|
Drawable,
|
||||||
};
|
};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
use zerocopy::{AsBytes, BigEndian, FromBytes, FromZeroes, U16};
|
use zerocopy::{BigEndian, FromBytes, Immutable, IntoBytes, KnownLayout, U16};
|
||||||
|
|
||||||
/// Message style configuration
|
/// Message style configuration
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -197,7 +197,7 @@ const MSG_PADDING_ALIGN: usize = 64;
|
||||||
|
|
||||||
const MAGIC: [u8; 6] = *b"wang\0\0";
|
const MAGIC: [u8; 6] = *b"wang\0\0";
|
||||||
|
|
||||||
#[derive(FromZeroes, FromBytes, AsBytes)]
|
#[derive(FromBytes, IntoBytes, Immutable, KnownLayout)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct Header {
|
struct Header {
|
||||||
magic: [u8; 6],
|
magic: [u8; 6],
|
||||||
|
@ -210,7 +210,7 @@ struct Header {
|
||||||
_padding_2: [u8; 20],
|
_padding_2: [u8; 20],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromZeroes, FromBytes, AsBytes)]
|
#[derive(FromBytes, IntoBytes, Immutable, KnownLayout)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct Timestamp {
|
struct Timestamp {
|
||||||
year: u8,
|
year: u8,
|
||||||
|
@ -297,7 +297,7 @@ impl PayloadBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn header_mut(&mut self) -> &mut Header {
|
fn header_mut(&mut self) -> &mut Header {
|
||||||
Header::mut_from_prefix(&mut self.data).unwrap()
|
Header::mut_from_prefix(&mut self.data).unwrap().0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the current number of messages
|
/// Return the current number of messages
|
||||||
|
@ -359,7 +359,7 @@ impl PayloadBuffer {
|
||||||
|
|
||||||
let start = self.data.len();
|
let start = self.data.len();
|
||||||
self.data.resize(start + count * 11, 0);
|
self.data.resize(start + count * 11, 0);
|
||||||
MessageBuffer(FromBytes::mut_slice_from(&mut self.data[start..]).unwrap())
|
MessageBuffer(FromBytes::mut_from_bytes(&mut self.data[start..]).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current payload as bytes (without padding)
|
/// Get the current payload as bytes (without padding)
|
||||||
|
|
Loading…
Reference in a new issue