Trait ArchiveContext
pub unsafe trait ArchiveContext<E = <Self as Fallible>::Error> {
// Required methods
fn check_subtree_ptr(
&mut self,
ptr: *const u8,
layout: &Layout,
) -> Result<(), E> ⓘ;
unsafe fn push_subtree_range(
&mut self,
root: *const u8,
end: *const u8,
) -> Result<Range<usize>, E> ⓘ;
unsafe fn pop_subtree_range(&mut self, range: Range<usize>) -> Result<(), E> ⓘ;
}
Available on crate feature
dep_rkyv
only.Expand description
A context that can validate nonlocal archive memory.
§Safety
check_subtree_ptr
must only return true if ptr
is located entirely
within the subtree range and is safe to dereference.
Required Methods§
fn check_subtree_ptr(
&mut self,
ptr: *const u8,
layout: &Layout,
) -> Result<(), E> ⓘ
fn check_subtree_ptr( &mut self, ptr: *const u8, layout: &Layout, ) -> Result<(), E> ⓘ
Checks that the given data address and layout is located completely within the subtree range.
unsafe fn push_subtree_range(
&mut self,
root: *const u8,
end: *const u8,
) -> Result<Range<usize>, E> ⓘ
unsafe fn push_subtree_range( &mut self, root: *const u8, end: *const u8, ) -> Result<Range<usize>, E> ⓘ
Pushes a new subtree range onto the validator and starts validating it.
After calling push_subtree_range
, the validator will have a subtree
range starting at the original start and ending at root
. After popping
the returned range, the validator will have a subtree range starting at
end
and ending at the original end.
§Safety
root
and end
must be located inside the archive.