Struct rkyv::RelPtr[][src]

pub struct RelPtr<T: ArchivePointee + ?Sized> { /* fields omitted */ }
Expand description

A pointer which resolves to relative to its position in memory.

See Archive for an example of creating one.

Implementations

Checks the bytes of the given relative pointer.

This is done rather than implementing CheckBytes to force users to manually write their CheckBytes implementation since they need to also provide the ownership model of their memory.

Safety

The caller must guarantee that the given pointer is aligned and points to enough bytes to represent a RelPtr<T>.

Creates a new relative pointer from the given raw pointer and metadata.

Safety

The caller must guarantee that:

  • raw_ptr is a valid relative pointer in its final position
  • raw_ptr points to a valid value
  • metadata is valid metadata for the pointed value.

Creates a relative pointer from one position to another.

Safety

The caller must guarantee that from is the position of the relative pointer and to is the position of some valid memory.

Gets the base pointer for the relative pointer.

Gets the offset of the relative pointer.

Gets the metadata of the relative pointer.

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

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

Performs the conversion.

Performs the conversion.

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.