Trait HasLayout

Source
pub trait HasLayout {
    // Required method
    fn layout(&self) -> &Layout;

    // Provided methods
    fn size(&self) -> usize { ... }
    fn align(&self) -> usize { ... }
}
Expand description

A type which knows what its layout is.

This does not refer to layout in Rust.

Required Methods§

Source

fn layout(&self) -> &Layout

Returns the layout for objects of this type.

Provided Methods§

Source

fn size(&self) -> usize

Returns the size, in bytes, for objects of this type.

Intentionally returns usize rather than Size, so callers will have to explicitly convert with row_size_for_bytes.

Source

fn align(&self) -> usize

Returns the alignment, in bytes, for objects of this type.

Intentionally returns usize rather than Size, so callers will have to explicitly convert with row_size_for_bytes.

Implementors§