Struct rkyv_test::validation::validators::ArchiveValidator
source · [−]pub struct ArchiveValidator<'a> { /* private fields */ }
Expand description
A validator that can verify archives with nonlocal memory.
Implementations
sourceimpl<'a> ArchiveValidator<'a>
impl<'a> ArchiveValidator<'a>
sourcepub fn with_max_depth(bytes: &'a [u8], max_subtree_depth: usize) -> Self
pub fn with_max_depth(bytes: &'a [u8], max_subtree_depth: usize) -> Self
Crates a new bounds validator for the given bytes with a maximum validation depth.
sourcepub fn log_alignment(&self) -> usize
pub fn log_alignment(&self) -> usize
Returns the log base 2 of the alignment of the archive.
An archive that is 2-aligned will return 1, 4-aligned will return 2, 8-aligned will return 3 and so on.
Trait Implementations
sourceimpl<'a> ArchiveContext for ArchiveValidator<'a>
impl<'a> ArchiveContext for ArchiveValidator<'a>
type PrefixRange = PrefixRange
type PrefixRange = PrefixRange
A prefix range from an archive context. Read more
type SuffixRange = SuffixRange
type SuffixRange = SuffixRange
A suffix range from an archive context. Read more
sourceunsafe fn bounds_check_ptr(
&mut self,
base: *const u8,
offset: isize
) -> Result<*const u8, Self::Error>
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
sourceunsafe fn bounds_check_layout(
&mut self,
data_address: *const u8,
layout: &Layout
) -> Result<(), Self::Error>
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
sourceunsafe fn bounds_check_subtree_ptr_layout(
&mut self,
data_address: *const u8,
layout: &Layout
) -> Result<(), Self::Error>
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
sourceunsafe fn push_prefix_subtree_range(
&mut self,
root: *const u8,
end: *const u8
) -> Result<PrefixRange, Self::Error>
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
sourcefn pop_prefix_range(&mut self, range: PrefixRange) -> Result<(), Self::Error>
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
sourceunsafe fn push_suffix_subtree_range(
&mut self,
start: *const u8,
root: *const u8
) -> Result<SuffixRange, Self::Error>
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
sourcefn pop_suffix_range(&mut self, range: SuffixRange) -> Result<(), Self::Error>
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
sourcefn finish(&mut self) -> Result<(), Self::Error>
fn finish(&mut self) -> Result<(), Self::Error>
Verifies that all outstanding claims have been returned.
sourceunsafe fn check_ptr<T: LayoutRaw + Pointee + ?Sized>(
&mut self,
base: *const u8,
offset: isize,
metadata: T::Metadata
) -> Result<*const T, Self::Error>
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
sourceunsafe fn check_rel_ptr<T: ArchivePointee + LayoutRaw + ?Sized>(
&mut self,
rel_ptr: &RelPtr<T>
) -> Result<*const T, Self::Error>
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
sourceunsafe fn bounds_check_subtree_ptr<T: LayoutRaw + ?Sized>(
&mut self,
ptr: *const T
) -> Result<(), Self::Error>
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
sourceunsafe fn check_subtree_ptr<T: LayoutRaw + Pointee + ?Sized>(
&mut self,
base: *const u8,
offset: isize,
metadata: T::Metadata
) -> Result<*const T, Self::Error>
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
sourceunsafe fn check_subtree_rel_ptr<T: ArchivePointee + LayoutRaw + ?Sized>(
&mut self,
rel_ptr: &RelPtr<T>
) -> Result<*const T, Self::Error>
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
sourceunsafe fn push_prefix_subtree<T: LayoutRaw + ?Sized>(
&mut self,
root: *const T
) -> Result<Self::PrefixRange, Self::Error>
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
sourceimpl<'a> Debug for ArchiveValidator<'a>
impl<'a> Debug for ArchiveValidator<'a>
sourceimpl<'a> Fallible for ArchiveValidator<'a>
impl<'a> Fallible for ArchiveValidator<'a>
type Error = ArchiveError
type Error = ArchiveError
The error produced by any failing methods.
impl<'a> Send for ArchiveValidator<'a>
impl<'a> Sync for ArchiveValidator<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ArchiveValidator<'a>
impl<'a> Unpin for ArchiveValidator<'a>
impl<'a> UnwindSafe for ArchiveValidator<'a>
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more