CTSized

Trait CTSized 

Source
pub trait CTSized {
    type Size: Unsigned;

    // Required method
    fn size() -> usize;
}
Expand description

Trait used to measure the amount of items within compile time structures.

Cast the structure as CTSized. If this trait is implemented, you can query the size from CTSized::Size. Alternatively a value can be constructed from the type representing the size, just call CTSized::size.

§Example

let size = <Cons<Cons<Cons<CTConsTerm, u8>, u32>, u64> as CTSized>::size();
assert_eq!(size, 3);

Required Associated Types§

Source

type Size: Unsigned

The size representation of the implemented compile time structure.

Required Methods§

Source

fn size() -> usize

Returns the amount of items added to the implemented compile time structure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Tail, Head> CTSized for Cons<Tail, Head>
where Tail: CTCons, Self: CTCounter,

Source§

type Size = <Cons<Tail, Head> as CTCounter>::Counter