pub struct DefaultValidator<'a> { /* private fields */ }
Expand description

The default validator.

Implementations§

source§

impl<'a> DefaultValidator<'a>

source

pub fn new(bytes: &'a [u8]) -> Self

Creates a new validator from a byte range.

Trait Implementations§

source§

impl<'a> ArchiveContext for DefaultValidator<'a>

§

type PrefixRange = <ArchiveValidator<'a> as ArchiveContext>::PrefixRange

A prefix range from an archive context. Read more
§

type SuffixRange = <ArchiveValidator<'a> as ArchiveContext>::SuffixRange

A suffix range from an archive context. Read more
source§

unsafe fn bounds_check_ptr( &mut self, base: *const u8, offset: isize ) -> Result<*const u8, Self::Error>

Checks that a relative pointer points to an address within the archive. Read more
source§

unsafe fn bounds_check_layout( &mut self, data_address: *const u8, layout: &Layout ) -> Result<(), Self::Error>

Checks that a given pointer can be dereferenced. Read more
source§

unsafe fn bounds_check_subtree_ptr_layout( &mut self, data_address: *const u8, layout: &Layout ) -> Result<(), Self::Error>

Checks that the given data address and layout is located completely within the subtree range. Read more
source§

unsafe fn push_prefix_subtree_range( &mut self, root: *const u8, end: *const u8 ) -> Result<PrefixRange, Self::Error>

Pushes a new subtree range onto the validator and starts validating it. Read more
source§

fn pop_prefix_range(&mut self, range: PrefixRange) -> Result<(), Self::Error>

Pops the given range, restoring the original state with the pushed range removed. Read more
source§

unsafe fn push_suffix_subtree_range( &mut self, start: *const u8, root: *const u8 ) -> Result<SuffixRange, Self::Error>

Pushes a new subtree range onto the validator and starts validating it. Read more
source§

fn pop_suffix_range(&mut self, range: SuffixRange) -> Result<(), Self::Error>

Finishes the given range, restoring the original state with the pushed range removed. Read more
source§

fn finish(&mut self) -> Result<(), Self::Error>

Verifies that all outstanding claims have been returned.
source§

fn wrap_layout_error(error: LayoutError) -> Self::Error

Wraps a layout error in an ArchiveContext error
source§

unsafe fn check_ptr<T: LayoutRaw + Pointee + ?Sized>( &mut self, base: *const u8, offset: isize, metadata: T::Metadata ) -> Result<*const T, Self::Error>

Checks that the given relative pointer can be dereferenced. Read more
source§

unsafe fn check_rel_ptr<T: ArchivePointee + LayoutRaw + ?Sized>( &mut self, rel_ptr: &RelPtr<T> ) -> Result<*const T, Self::Error>

Checks that the given RelPtr can be dereferenced. Read more
source§

unsafe fn bounds_check_subtree_ptr<T: LayoutRaw + ?Sized>( &mut self, ptr: *const T ) -> Result<(), Self::Error>

Checks that the given pointer is located completely within the subtree range. Read more
source§

unsafe fn check_subtree_ptr<T: LayoutRaw + Pointee + ?Sized>( &mut self, base: *const u8, offset: isize, metadata: T::Metadata ) -> Result<*const T, Self::Error>

Checks that the given relative pointer to a subtree can be dereferenced. Read more
source§

unsafe fn check_subtree_rel_ptr<T: ArchivePointee + LayoutRaw + ?Sized>( &mut self, rel_ptr: &RelPtr<T> ) -> Result<*const T, Self::Error>

Checks that the given RelPtr to a subtree can be dereferenced. Read more
source§

unsafe fn push_prefix_subtree<T: LayoutRaw + ?Sized>( &mut self, root: *const T ) -> Result<Self::PrefixRange, Self::Error>

Pushes a new subtree range onto the validator and starts validating it. Read more
source§

impl<'a> Debug for DefaultValidator<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Fallible for DefaultValidator<'a>

§

type Error = DefaultValidatorError

The error produced by any failing methods.
source§

impl<'a> SharedContext for DefaultValidator<'a>

source§

fn register_shared_ptr( &mut self, ptr: *const u8, type_id: TypeId ) -> Result<bool, Self::Error>

Registers the given ptr as a shared pointer with the given type. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for DefaultValidator<'a>

§

impl<'a> Send for DefaultValidator<'a>

§

impl<'a> Sync for DefaultValidator<'a>

§

impl<'a> Unpin for DefaultValidator<'a>

§

impl<'a> UnwindSafe for DefaultValidator<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.