mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
support reading Unit structs
This commit is contained in:
parent
0898cb6b5d
commit
896dff8367
2 changed files with 78 additions and 58 deletions
|
|
@ -265,6 +265,18 @@ fn test_read_rest_enum() {
|
|||
assert_eq!(TestEnumRest::Asd, stream.read().unwrap());
|
||||
}
|
||||
|
||||
#[derive(BitRead, BitSize, PartialEq, Debug)]
|
||||
struct EmptyStruct;
|
||||
|
||||
fn test_empty_struct() {
|
||||
let bytes = vec![0, 0, 0, 0];
|
||||
let buffer = BitBuffer::new(bytes, BigEndian);
|
||||
let mut stream = BitStream::from(buffer);
|
||||
assert_eq!(EmptyStruct, stream.read().unwrap());
|
||||
assert_eq!(0, stream.pos());
|
||||
assert_eq!(0, bit_size_of::<EmptyStruct>());
|
||||
}
|
||||
|
||||
#[derive(BitSize)]
|
||||
struct SizeStruct {
|
||||
foo: u8,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue