Trait bytecheck::CheckBytes [−][src]
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.
Implementations on Foreign Types
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = Infallible
type Error = BoolCheckError
type Error = BoolCheckError
type Error = CharCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
impl<T11: CheckBytes<C>, T10: CheckBytes<C>, T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T11, T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T11: CheckBytes<C>, T10: CheckBytes<C>, T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T11, T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T10: CheckBytes<C>, T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T10: CheckBytes<C>, T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T9: CheckBytes<C>, T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T8: CheckBytes<C>, T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T8, T7, T6, T5, T4, T3, T2, T1, T0)
impl<T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T7, T6, T5, T4, T3, T2, T1, T0)
impl<T7: CheckBytes<C>, T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T7, T6, T5, T4, T3, T2, T1, T0)
impl<T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T6, T5, T4, T3, T2, T1, T0)
impl<T6: CheckBytes<C>, T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T6, T5, T4, T3, T2, T1, T0)
impl<T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T5, T4, T3, T2, T1, T0)
impl<T5: CheckBytes<C>, T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T5, T4, T3, T2, T1, T0)
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
impl<T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T4, T3, T2, T1, T0)
impl<T4: CheckBytes<C>, T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T4, T3, T2, T1, T0)
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
impl<T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T3, T2, T1, T0)
impl<T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T3, T2, T1, T0)
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
impl<T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T2, T1, T0)
impl<T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T2, T1, T0)
type Error = Tuple3CheckError<T2::Error, T1::Error, T0::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = Tuple2CheckError<T1::Error, T0::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = Tuple1CheckError<T0::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = ArrayCheckError<T::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = SliceCheckError<T::Error>
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = StrCheckError
type Error = StructCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = StructCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = Infallible
type Error = StructCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = StructCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
type Error = NonZeroCheckError
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>