Trait bytecheck::CheckBytes
source · [−]pub trait CheckBytes<C: ?Sized> {
type Error: Error + 'static;
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>;
}
Expand description
A type that can check whether a pointer points to a valid value.
CheckBytes
can be derived with CheckBytes
or
implemented manually for custom behavior.
Associated Types
Required methods
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
Checks whether the given pointer points to a valid value within the given context.
Safety
The passed pointer must be aligned and point to enough bytes to represent the type.