derive `Debug` and simplify marker structs in config (#761)

* derive Debug for marker types

- this will also implement Debug for the derived Configuration type

* migrate to marker structs without fields
This commit is contained in:
Jonas Pleyer 2025-03-12 14:51:36 +01:00 committed by GitHub
parent 7610408399
commit b2837bef3f
1 changed files with 12 additions and 12 deletions

View File

@ -200,47 +200,47 @@ where
} }
/// Encodes all integer types in big endian. /// Encodes all integer types in big endian.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct BigEndian {} pub struct BigEndian;
impl InternalEndianConfig for BigEndian { impl InternalEndianConfig for BigEndian {
const ENDIAN: Endianness = Endianness::Big; const ENDIAN: Endianness = Endianness::Big;
} }
/// Encodes all integer types in little endian. /// Encodes all integer types in little endian.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct LittleEndian {} pub struct LittleEndian;
impl InternalEndianConfig for LittleEndian { impl InternalEndianConfig for LittleEndian {
const ENDIAN: Endianness = Endianness::Little; const ENDIAN: Endianness = Endianness::Little;
} }
/// Use fixed-size integer encoding. /// Use fixed-size integer encoding.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct Fixint {} pub struct Fixint;
impl InternalIntEncodingConfig for Fixint { impl InternalIntEncodingConfig for Fixint {
const INT_ENCODING: IntEncoding = IntEncoding::Fixed; const INT_ENCODING: IntEncoding = IntEncoding::Fixed;
} }
/// Use variable integer encoding. /// Use variable integer encoding.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct Varint {} pub struct Varint;
impl InternalIntEncodingConfig for Varint { impl InternalIntEncodingConfig for Varint {
const INT_ENCODING: IntEncoding = IntEncoding::Variable; const INT_ENCODING: IntEncoding = IntEncoding::Variable;
} }
/// Sets an unlimited byte limit. /// Sets an unlimited byte limit.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct NoLimit {} pub struct NoLimit;
impl InternalLimitConfig for NoLimit { impl InternalLimitConfig for NoLimit {
const LIMIT: Option<usize> = None; const LIMIT: Option<usize> = None;
} }
/// Sets the byte limit to N. /// Sets the byte limit to N.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub struct Limit<const N: usize> {} pub struct Limit<const N: usize>;
impl<const N: usize> InternalLimitConfig for Limit<N> { impl<const N: usize> InternalLimitConfig for Limit<N> {
const LIMIT: Option<usize> = Some(N); const LIMIT: Option<usize> = Some(N);
} }