logo
pub struct RelPtr<T: ArchivePointee + ?Sized, O> { /* private fields */ }
Expand description

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

This is a strongly-typed version of RawRelPtr.

See Archive for an example of creating one.

Implementations

Attempts to create a relative pointer from one position to another.

Safety
  • from must be the position of out within the archive
  • to must be the position of some valid T

Creates a relative pointer from one position to another.

Panics
  • The offset between from and to does not fit in an isize
  • The offset between from and to exceeds the offset storage
Safety
  • from must be the position of out within the archive
  • to must be the position of some valid T

Attempts to create a null relative pointer with default metadata.

Safety

pos must be the position of out within the archive.

Creates a null relative pointer with default metadata.

Panics
  • An offset of 0 does not fit in an isize
  • An offset of 0 exceeds the offset storage
Safety

pos must be the position of out within the archive.

Attempts to create a relative pointer from one position to another.

Safety
  • from must be the position of out within the archive
  • to must be the position of some valid T
  • value must be the value being serialized
  • metadata_resolver must be the result of serializing the metadata of value

Creates a relative pointer from one position to another.

Panics
  • The offset between from and to does not fit in an isize
  • The offset between from and to exceeds the offset storage
Safety
  • from must be the position of out within the archive
  • to must be the position of some valid T
  • value must be the value being serialized
  • metadata_resolver must be the result of serializing the metadata of value

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.

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

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.