1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 16:44:06 +02:00

use the smallest possible size int for descriminant reading/writing

This commit is contained in:
Robin Appelman 2021-07-24 17:34:29 +02:00
commit eb4bafc310
4 changed files with 40 additions and 18 deletions

View file

@ -3,11 +3,13 @@
#![allow(unused_imports)]
use bitbuffer::{BitReadStream, Endianness};
use bitbuffer_derive::{BitWrite, BitWriteSized};
use bitbuffer_derive::{BitRead, BitWrite, BitWriteSized};
#[derive(BitWrite)]
struct TestSizeExpression {
size: u8,
#[size = "size + 2"]
str: String,
#[discriminant_bits = 4]
enum TestEnumRest {
Foo,
Bar,
#[discriminant = "_"]
Asd,
}