Trait rkyv_dyn::validation::DynContext
source · [−]pub trait DynContext {
unsafe fn bounds_check_ptr_dyn(
&mut self,
base: *const u8,
offset: isize
) -> Result<*const u8, Box<dyn Error>>;
unsafe fn bounds_check_layout_dyn(
&mut self,
data_address: *const u8,
layout: &Layout
) -> Result<(), Box<dyn Error>>;
unsafe fn bounds_check_subtree_ptr_layout_dyn(
&mut self,
data_address: *const u8,
layout: &Layout
) -> Result<(), Box<dyn Error>>;
unsafe fn push_prefix_subtree_range_dyn(
&mut self,
root: *const u8,
end: *const u8
) -> Result<Box<dyn Any>, Box<dyn Error>>;
fn pop_prefix_range_dyn(
&mut self,
range: Box<dyn Any>
) -> Result<(), Box<dyn Error>>;
unsafe fn push_suffix_subtree_range_dyn(
&mut self,
start: *const u8,
root: *const u8
) -> Result<Box<dyn Any>, Box<dyn Error>>;
fn pop_suffix_range_dyn(
&mut self,
range: Box<dyn Any>
) -> Result<(), Box<dyn Error>>;
fn finish_dyn(&mut self) -> Result<(), Box<dyn Error>>;
fn register_shared_ptr_dyn(
&mut self,
ptr: *const u8,
type_id: TypeId
) -> Result<bool, Box<dyn Error>>;
}
Expand description
A context that’s object safe and suitable for checking most types.
Required Methods
Checks that a relative pointer points to an address within the archive.
See bounds_check_ptr
for more information.
Safety
base
must be inside the archive this valiator was created for.
Checks that a given pointer can be dereferenced.
See bounds_check_layout
for more information.
Safety
data_address
must be inside the archive this validator was created for.layout
must be the layout for the given pointer.
Checks that the given data address and layout is located completely within the subtree range.
See bounds_check_subtree_ptr_layout
for more information.
Safety
data_address
must be inside the archive this validator was created for.
Pushes a new subtree range onto the validator and starts validating it.
See push_prefix_subtree_range
for more information.
Safety
root
and end
must be located inside the archive.
Pops the given range, restoring the original state with the pushed range removed.
See pop_prefix_range
for more information.
Pushes a new subtree range onto the validator and starts validating it.
See push_suffix_subtree_range
for more information.
Safety
start
and root
must be located inside the archive.
Finishes the given range, restoring the original state with the pushed range removed.
See pop_suffix_range
for more information.
Verifies that all outstanding claims have been returned.
See finish
for more information.
Registers the given ptr
as a shared pointer with the given type.
See register_shared_ptr
for more information.
Trait Implementations
sourceimpl ArchiveContext for dyn DynContext + '_
impl ArchiveContext for dyn DynContext + '_
type PrefixRange = Box<dyn Any + 'static, Global>
type PrefixRange = Box<dyn Any + 'static, Global>
A prefix range from an archive context. Read more
type SuffixRange = Box<dyn Any + 'static, Global>
type SuffixRange = Box<dyn Any + 'static, Global>
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<Self::PrefixRange, Self::Error>
unsafe fn push_prefix_subtree_range(
&mut self,
root: *const u8,
end: *const u8
) -> Result<Self::PrefixRange, Self::Error>
Pushes a new subtree range onto the validator and starts validating it. Read more
sourcefn pop_prefix_range(
&mut self,
range: Self::PrefixRange
) -> Result<(), Self::Error>
fn pop_prefix_range(
&mut self,
range: Self::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<Self::SuffixRange, Self::Error>
unsafe fn push_suffix_subtree_range(
&mut self,
start: *const u8,
root: *const u8
) -> Result<Self::SuffixRange, Self::Error>
Pushes a new subtree range onto the validator and starts validating it. Read more
sourcefn pop_suffix_range(
&mut self,
range: Self::SuffixRange
) -> Result<(), Self::Error>
fn pop_suffix_range(
&mut self,
range: Self::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>(
&mut self,
base: *const u8,
offset: isize,
metadata: <T as Pointee>::Metadata
) -> Result<*const T, Self::Error> where
T: LayoutRaw + Pointee + ?Sized,
unsafe fn check_ptr<T>(
&mut self,
base: *const u8,
offset: isize,
metadata: <T as Pointee>::Metadata
) -> Result<*const T, Self::Error> where
T: LayoutRaw + Pointee + ?Sized,
Checks that the given relative pointer can be dereferenced. Read more
sourceunsafe fn check_rel_ptr<T>(
&mut self,
rel_ptr: &RelPtr<T, <isize as Archive>::Archived>
) -> Result<*const T, Self::Error> where
T: ArchivePointee + LayoutRaw + ?Sized,
unsafe fn check_rel_ptr<T>(
&mut self,
rel_ptr: &RelPtr<T, <isize as Archive>::Archived>
) -> Result<*const T, Self::Error> where
T: ArchivePointee + LayoutRaw + ?Sized,
Checks that the given RelPtr
can be dereferenced. Read more
sourceunsafe fn bounds_check_subtree_ptr<T>(
&mut self,
ptr: *const T
) -> Result<(), Self::Error> where
T: LayoutRaw + ?Sized,
unsafe fn bounds_check_subtree_ptr<T>(
&mut self,
ptr: *const T
) -> Result<(), Self::Error> where
T: LayoutRaw + ?Sized,
Checks that the given pointer is located completely within the subtree range. Read more
sourceunsafe fn check_subtree_ptr<T>(
&mut self,
base: *const u8,
offset: isize,
metadata: <T as Pointee>::Metadata
) -> Result<*const T, Self::Error> where
T: LayoutRaw + Pointee + ?Sized,
unsafe fn check_subtree_ptr<T>(
&mut self,
base: *const u8,
offset: isize,
metadata: <T as Pointee>::Metadata
) -> Result<*const T, Self::Error> where
T: LayoutRaw + Pointee + ?Sized,
Checks that the given relative pointer to a subtree can be dereferenced. Read more
sourceunsafe fn check_subtree_rel_ptr<T>(
&mut self,
rel_ptr: &RelPtr<T, <isize as Archive>::Archived>
) -> Result<*const T, Self::Error> where
T: ArchivePointee + LayoutRaw + ?Sized,
unsafe fn check_subtree_rel_ptr<T>(
&mut self,
rel_ptr: &RelPtr<T, <isize as Archive>::Archived>
) -> Result<*const T, Self::Error> where
T: ArchivePointee + LayoutRaw + ?Sized,
Checks that the given RelPtr
to a subtree can be dereferenced. Read more
sourceunsafe fn push_prefix_subtree<T>(
&mut self,
root: *const T
) -> Result<Self::PrefixRange, Self::Error> where
T: LayoutRaw + ?Sized,
unsafe fn push_prefix_subtree<T>(
&mut self,
root: *const T
) -> Result<Self::PrefixRange, Self::Error> where
T: LayoutRaw + ?Sized,
Pushes a new subtree range onto the validator and starts validating it. Read more
sourceimpl Fallible for dyn DynContext + '_
impl Fallible for dyn DynContext + '_
Registers the given ptr
as a shared pointer with the given type. Read more