pub unsafe trait FlatValidate: FlatUnsized {
// Required method
unsafe fn validate_unchecked(bytes: &[u8]) -> Result<(), Error>;
// Provided methods
unsafe fn validate_ptr(this: *const Self) -> Result<(), Error> { ... }
fn validate(bytes: &[u8]) -> Result<(), Error> { ... }
fn from_bytes(bytes: &[u8]) -> Result<&Self, Error> { ... }
fn from_mut_bytes(bytes: &mut [u8]) -> Result<&mut Self, Error> { ... }
}Expand description
Flat type runtime checking.
Required Methods§
Provided Methods§
unsafe fn validate_ptr(this: *const Self) -> Result<(), Error>
Sourcefn validate(bytes: &[u8]) -> Result<(), Error>
fn validate(bytes: &[u8]) -> Result<(), Error>
Check that memory contents of this is valid for Self.
fn from_bytes(bytes: &[u8]) -> Result<&Self, Error>
fn from_mut_bytes(bytes: &mut [u8]) -> Result<&mut Self, Error>
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.