logo
#[repr(transparent)]
pub struct RawRelPtr<O> { /* private fields */ }
Expand description

An untyped pointer which resolves relative to its position in memory.

This is the most fundamental building block in rkyv. It allows the construction and use of pointers that can be safely relocated as long as the source and target are moved together. This is what allows memory to be moved from disk into memory and accessed without decoding.

Regular pointers are absolute, meaning that the pointee can be moved without invalidating the pointer. However, the target cannot be moved or the pointer is invalidated.

Relative pointers are relative, meaning that the pointee can be moved with the target without invalidating the pointer. However, if either the pointee or the target move independently, the pointer will be invalidated.

Implementations

Attempts to create a new RawRelPtr in-place between the given from and to positions.

Safety
  • out must be located at position from
  • to must be a position within the archive

Creates a new RawRelPtr in-place between the given from and to positions.

Safety
  • out must be located at position from
  • to must be a position within the archive
  • The offset between from and to must fit in an isize and not exceed the offset storage

Gets the base pointer for the relative pointer.

Gets the mutable base pointer for the relative pointer.

Gets the offset of the relative pointer from its base.

Gets whether the offset of the relative pointer is 0.

Calculates the memory address being pointed to by this relative pointer.

Returns an unsafe mutable pointer to the memory address being pointed to by this relative pointer.

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Deserializes using the given deserializer

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type for metadata in pointers and references to Self.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.