pub unsafe trait FromBytes: Copy + 'static {
// Provided method
fn from_bytes(bytes: &[u8]) -> Result<&Self>
where Self: Sized { ... }
}Expand description
Provided Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<&Self>where
Self: Sized,
fn from_bytes(bytes: &[u8]) -> Result<&Self>where
Self: Sized,
Returns a reference to a single instance of Self represented by the specified bytes.
Does not check for correct endianness.
§Errors
This function will return an error if:
- The buffer is not big enough to read the requested structure (
Error::InsufficientBuffer) - The buffers memory alignment is not ABI complaint with the requested structure (
Error::Misaligned)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".