Trait rkyv_dyn::validation::DynContext[][src]

pub trait DynContext {
    unsafe fn check_rel_ptr_dyn(
        &mut self,
        base: *const u8,
        offset: isize
    ) -> Result<*const u8, Box<dyn Error>>;
unsafe fn bounds_check_ptr_dyn(
        &mut self,
        ptr: *const u8,
        layout: &Layout
    ) -> Result<(), Box<dyn Error>>;
unsafe fn claim_bytes_dyn(
        &mut self,
        start: *const u8,
        len: usize
    ) -> Result<(), Box<dyn Error>>;
unsafe fn claim_shared_bytes_dyn(
        &mut self,
        start: *const u8,
        len: usize,
        type_id: TypeId
    ) -> Result<bool, Box<dyn Error>>; }
Expand description

A context that’s object safe and suitable for checking most types.

Required methods

unsafe fn check_rel_ptr_dyn(
    &mut self,
    base: *const u8,
    offset: isize
) -> Result<*const u8, Box<dyn Error>>
[src]

Checks the given parts of a relative pointer for bounds issues.

Safety

The caller must guarantee that the base pointer is inside the archive for this context.

unsafe fn bounds_check_ptr_dyn(
    &mut self,
    ptr: *const u8,
    layout: &Layout
) -> Result<(), Box<dyn Error>>
[src]

Checks the given memory block for bounds issues.

Safety

The caller must guarantee that the pointer is inside the archive for this context.

unsafe fn claim_bytes_dyn(
    &mut self,
    start: *const u8,
    len: usize
) -> Result<(), Box<dyn Error>>
[src]

Claims count bytes located offset bytes away from base.

Safety

The caller must guarantee that base is inside the archive this context was created for.

unsafe fn claim_shared_bytes_dyn(
    &mut self,
    start: *const u8,
    len: usize,
    type_id: TypeId
) -> Result<bool, Box<dyn Error>>
[src]

Claims count shared bytes located offset bytes away from base.

Returns whether the bytes need to be checked.

Safety

The caller must guarantee that base is inside the archive this context was created for.

Trait Implementations

impl ArchiveBoundsContext for dyn DynContext + '_[src]

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

Checks the given parts of a relative pointer for bounds issues Read more

unsafe fn bounds_check_ptr(
    &mut self,
    ptr: *const u8,
    layout: &Layout
) -> Result<(), Self::Error>
[src]

Checks the given memory block for bounds issues. Read more

impl ArchiveMemoryContext for dyn DynContext + '_[src]

unsafe fn claim_bytes(
    &mut self,
    start: *const u8,
    len: usize
) -> Result<(), Self::Error>
[src]

Claims count bytes located offset bytes away from base. Read more

unsafe fn claim_owned_ptr<T>(
    &mut self,
    ptr: *const T
) -> Result<(), Self::Error> where
    Self: ArchiveBoundsContext,
    T: ArchivePointee + ?Sized,
    <T as Pointee>::Metadata: LayoutMetadata<T>, 
[src]

Claims the memory at the given location as the given type. Read more

fn claim_owned_rel_ptr<T>(
    &mut self,
    rel_ptr: &RelPtr<T>
) -> Result<*const T, Self::Error> where
    Self: ArchiveBoundsContext,
    T: ArchivePointee + ?Sized,
    <T as Pointee>::Metadata: LayoutMetadata<T>, 
[src]

Claims the memory referenced by the given relative pointer.

impl Fallible for dyn DynContext + '_[src]

type Error = Box<dyn Error>

The error produced by any failing methods

impl SharedArchiveContext for dyn DynContext + '_[src]

unsafe fn claim_shared_bytes(
    &mut self,
    start: *const u8,
    len: usize,
    type_id: TypeId
) -> Result<bool, Box<dyn Error>>
[src]

Claims count shared bytes located offset bytes away from base. Read more

fn claim_shared_ptr<T>(
    &mut self,
    rel_ptr: &RelPtr<T>,
    type_id: TypeId
) -> Result<Option<*const T>, Self::Error> where
    Self: ArchiveBoundsContext,
    T: ArchivePointee + CheckBytes<Self> + ?Sized,
    <T as Pointee>::Metadata: LayoutMetadata<T>, 
[src]

Claims the memory referenced by the given relative pointer. Read more

Implementors

impl<C: ArchiveBoundsContext + ArchiveMemoryContext + SharedArchiveContext + ?Sized> DynContext for C where
    C::Error: Error
[src]

unsafe fn check_rel_ptr_dyn(
    &mut self,
    base: *const u8,
    offset: isize
) -> Result<*const u8, Box<dyn Error>>
[src]

unsafe fn bounds_check_ptr_dyn(
    &mut self,
    ptr: *const u8,
    layout: &Layout
) -> Result<(), Box<dyn Error>>
[src]

unsafe fn claim_bytes_dyn(
    &mut self,
    start: *const u8,
    len: usize
) -> Result<(), Box<dyn Error>>
[src]

unsafe fn claim_shared_bytes_dyn(
    &mut self,
    start: *const u8,
    len: usize,
    type_id: TypeId
) -> Result<bool, Box<dyn Error>>
[src]