pub struct RelativePtr<T, const ALIGN: usize, E: Endian = NativeEndian> { /* private fields */ }Available on (crate features
alloc or std or derive or serde or zero-copy or static-size) and crate feature zero-copy only.Expand description
A relative pointer that stores the offset from its own address to the target data. This allows zero-copy deserialization without runtime allocations.
Implementations§
Source§impl<T, const ALIGN: usize, E: Endian> RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E: Endian> RelativePtr<T, ALIGN, E>
Trait Implementations§
Source§impl<'a, T, const ALIGN: usize, E: Endian> Arbitrary<'a> for RelativePtr<T, ALIGN, E>
Available on crate feature fuzzing only.
impl<'a, T, const ALIGN: usize, E: Endian> Arbitrary<'a> for RelativePtr<T, ALIGN, E>
Available on crate feature
fuzzing only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl<'de, T: StaticSize, const ALIGN: usize, E: Endian, Context> BorrowDecode<'de, Context> for RelativePtr<T, ALIGN, E>
impl<'de, T: StaticSize, const ALIGN: usize, E: Endian, Context> BorrowDecode<'de, Context> for RelativePtr<T, ALIGN, E>
Source§fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given [
BorrowDecode]. Read moreSource§impl<T: Clone, const ALIGN: usize, E: Clone + Endian> Clone for RelativePtr<T, ALIGN, E>
impl<T: Clone, const ALIGN: usize, E: Clone + Endian> Clone for RelativePtr<T, ALIGN, E>
Source§fn clone(&self) -> RelativePtr<T, ALIGN, E>
fn clone(&self) -> RelativePtr<T, ALIGN, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: StaticSize, const ALIGN: usize, E: Endian, Context> Decode<Context> for RelativePtr<T, ALIGN, E>
impl<T: StaticSize, const ALIGN: usize, E: Endian, Context> Decode<Context> for RelativePtr<T, ALIGN, E>
Source§impl<T: ZeroCopy + DeepValidator, const ALIGN: usize, E: Endian> DeepValidator for RelativePtr<T, ALIGN, E>
impl<T: ZeroCopy + DeepValidator, const ALIGN: usize, E: Endian> DeepValidator for RelativePtr<T, ALIGN, E>
Source§fn is_valid_deep(&self, buffer: &[u8]) -> bool
fn is_valid_deep(&self, buffer: &[u8]) -> bool
Performs a deep validation check on the relative pointer.
Source§impl<T: StaticSize, const ALIGN: usize, E: Endian> Encode for RelativePtr<T, ALIGN, E>
impl<T: StaticSize, const ALIGN: usize, E: Endian> Encode for RelativePtr<T, ALIGN, E>
Source§impl<T: PartialEq, const ALIGN: usize, E: PartialEq + Endian> PartialEq for RelativePtr<T, ALIGN, E>
impl<T: PartialEq, const ALIGN: usize, E: PartialEq + Endian> PartialEq for RelativePtr<T, ALIGN, E>
Source§impl<T, const ALIGN: usize, E: Endian> StaticSize for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E: Endian> StaticSize for RelativePtr<T, ALIGN, E>
Source§impl<T, const ALIGN: usize, E: Endian> ZeroCopy for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E: Endian> ZeroCopy for RelativePtr<T, ALIGN, E>
Source§impl<E: Endian, T, const ALIGN: usize> ZeroCopyType<E> for RelativePtr<T, ALIGN, E>where
T: ZeroCopy + ZeroCopyType<E>,
Available on crate feature alloc only.
impl<E: Endian, T, const ALIGN: usize> ZeroCopyType<E> for RelativePtr<T, ALIGN, E>where
T: ZeroCopy + ZeroCopyType<E>,
Available on crate feature
alloc only.Source§type Builder = RelativeBuilder<<T as ZeroCopyType<E>>::Builder, ALIGN>
type Builder = RelativeBuilder<<T as ZeroCopyType<E>>::Builder, ALIGN>
The builder type associated with this trait.
impl<T: Copy, const ALIGN: usize, E: Copy + Endian> Copy for RelativePtr<T, ALIGN, E>
impl<T: Eq, const ALIGN: usize, E: Eq + Endian> Eq for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E: Endian> StructuralPartialEq for RelativePtr<T, ALIGN, E>
Auto Trait Implementations§
impl<T, const ALIGN: usize, E> Freeze for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E> RefUnwindSafe for RelativePtr<T, ALIGN, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, const ALIGN: usize, E> Send for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E> Sync for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E> Unpin for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E> UnsafeUnpin for RelativePtr<T, ALIGN, E>
impl<T, const ALIGN: usize, E> UnwindSafe for RelativePtr<T, ALIGN, E>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more