[][src]Trait safe_bytes::SafeBytes

pub trait SafeBytes {
    fn safe_bytes(&mut self) -> &[u8];
}

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

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

Returns bytes representation of the value, initializing all padding bytes

Loading content...

Implementors

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

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

Loading content...