pub trait PackedSize {
// Required method
fn packed_size() -> usize;
}
Required Methods§
Sourcefn packed_size() -> usize
fn packed_size() -> usize
Returns the packed size of the struct.
What is th packed size? Normally, struct members are aligned in a way that optimizes access speed. For example, on a 64bit platform, all members are aligned to start on a 64bit boundary https://doc.rust-lang.org/reference/type-layout.html.
Packed means what would be the size if no alignment would be used. In fact, packed size equals the sum of sizes of all members.
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.