PodMethods

Trait PodMethods 

Source
pub trait PodMethods {
    // Required methods
    fn zeroed() -> Self
       where Self: Sized;
    fn as_bytes(&self) -> &[u8];
    fn as_bytes_mut(&mut self) -> &mut [u8];
    fn as_data_view(&self) -> &DataView;
    fn as_data_view_mut(&mut self) -> &mut DataView;
}
Expand description

Helper trait to provide methods directly on the pod types.

Do not use this trait in any signatures, use Pod directly instead. There’s a blanket impl that provides these methods for all pod types.

Required Methods§

Source

fn zeroed() -> Self
where Self: Sized,

Returns a zero-initialized instance of the type.

Source

fn as_bytes(&self) -> &[u8]

Returns the object’s memory as a byte slice.

Source

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

Returns the object’s memory as a mutable byte slice.

Source

fn as_data_view(&self) -> &DataView

Returns a data view into the object’s memory.

Source

fn as_data_view_mut(&mut self) -> &mut DataView

Returns a mutable data view into the object’s memory.

Implementors§

Source§

impl<T: ?Sized + Pod> PodMethods for T