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

type Error: Error + 'static[src]

Expand description

The error that may result from checking the type.

Required methods

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

Expand description

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

impl<C: ?Sized> CheckBytes<C> for ()[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for i8[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for i16[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for i32[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for i64[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for i128[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for u8[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for u16[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for u32[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for u64[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for u128[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for f32[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for f64[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicI8[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicI16[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicI32[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicI64[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicU8[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicU16[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicU32[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicU64[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: ?Sized, C: ?Sized> CheckBytes<C> for PhantomData<T>[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for PhantomPinned[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for bool[src]

type Error = BoolCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for AtomicBool[src]

type Error = BoolCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for char[src]

type Error = CharCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple12CheckError<T11::Error, T10::Error, T9::Error, T8::Error, T7::Error, T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple11CheckError<T10::Error, T9::Error, T8::Error, T7::Error, T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple10CheckError<T9::Error, T8::Error, T7::Error, T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple9CheckError<T8::Error, T7::Error, T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple8CheckError<T7::Error, T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple7CheckError<T6::Error, T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple6CheckError<T5::Error, T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

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)[src]

type Error = Tuple5CheckError<T4::Error, T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T3: CheckBytes<C>, T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T3, T2, T1, T0)[src]

type Error = Tuple4CheckError<T3::Error, T2::Error, T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T2: CheckBytes<C>, T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T2, T1, T0)[src]

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>
[src]

impl<T1: CheckBytes<C>, T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T1, T0)[src]

type Error = Tuple2CheckError<T1::Error, T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T0: CheckBytes<C>, C: ?Sized> CheckBytes<C> for (T0,)[src]

type Error = Tuple1CheckError<T0::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized, const N: usize> CheckBytes<C> for [T; N][src]

type Error = ArrayCheckError<T::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for [T][src]

type Error = SliceCheckError<T::Error>

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for str[src]

type Error = StrCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for Range<T>[src]

type Error = StructCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for RangeFrom<T>[src]

type Error = StructCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for RangeFull[src]

type Error = Unreachable

unsafe fn check_bytes<'a>(
    value: *const Self,
    _: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for RangeTo<T>[src]

type Error = StructCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for RangeToInclusive<T>[src]

type Error = StructCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroI8[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroI16[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroI32[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroI64[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroI128[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroU8[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroU16[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroU32[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroU64[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

impl<C: ?Sized> CheckBytes<C> for NonZeroU128[src]

type Error = NonZeroCheckError

unsafe fn check_bytes<'a>(
    value: *const Self,
    context: &mut C
) -> Result<&'a Self, Self::Error>
[src]

Implementors