Trait SafeBytes

Source
pub trait SafeBytes {
    // Required method
    fn safe_bytes(&mut self) -> &[u8];
}
Expand description

Trait for types that can initialize their padding in their bytes representation.

§Safety

This trait’s implementation should be able to produce initialized bytes slice that contain original structure raw representation. It is safe to implement it in wrong way. But it is advised to derive SafeBytes if possible. Or implement PaddingBane instead if deriving is not possible, as SafeBytes has blanket implementation for PaddingBane implementors.

Required Methods§

Source

fn safe_bytes(&mut self) -> &[u8]

Returns bytes representation of the value, initializing all padding bytes

Implementations on Foreign Types§

Source§

impl<T> SafeBytes for [T]
where T: PaddingBane,

Source§

fn safe_bytes(&mut self) -> &[u8]

Implementors§

Source§

impl<T> SafeBytes for T
where T: PaddingBane,