pub trait ByteSize {
// Required method
fn byte_size(&self) -> usize;
}
Expand description
An item having a ByteSize implementation specifies it has a known size, independent of if it’s Sized or not. The size reported by ByteSize may sometimes not be the same as std::mem::size_of, as alignment should not be taken into account for ByteSize. The size returned should not be taken as an exact value, though it should always match the final size. Assume this to be a good estimate instead.