FromBytes

Trait FromBytes 

Source
pub trait FromBytes {
    const MIN_SIZE_OF: usize;
    const ALIGN_OF: usize;

    // Required method
    unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>;
}
Expand description

Converts from a byte slice to a string.

Required Associated Constants§

Source

const MIN_SIZE_OF: usize

Minimum size argument.

Source

const ALIGN_OF: usize

Alignment argument.

Required Methods§

Source

unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>

Converts from a byte slice to a string.

§Safety

The given byte slice must have the minimum size and alignment as specified.

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.

Implementors§

Source§

impl FromBytes for CStr

Source§

const MIN_SIZE_OF: usize = 0usize

Source§

const ALIGN_OF: usize = 1usize