Struct GlobalPtr

Source
pub struct GlobalPtr<T> { /* private fields */ }
Expand description

A global pointer, containing a fully qualified object ID and offset.

Implementations§

Source§

impl<T> GlobalPtr<T>

Source

pub fn new(id: ObjID, offset: u64) -> Self

Creates a new global pointer.

Source

pub fn cast<U>(self) -> GlobalPtr<U>

Casts the global pointer to a different type.

Source

pub fn is_local(&self, place: impl AsRef<ObjectHandle>) -> bool

Checks if the global pointer is local from the perspective of a given object.

Source

pub unsafe fn resolve_stable(&self) -> Ref<'_, T>

Resolve a global pointer into a reference.

§Safety

The underlying object must not mutate while the reference exists, unless the underlying type is Sync + Send. The memory referenced by the pointer must have an valid representation of the type.

Source

pub unsafe fn resolve(&self) -> Ref<'_, T>

Resolve a global pointer into a reference.

§Safety

The underlying object must not mutate while the reference exists, unless the underlying type is Sync + Send. The memory referenced by the pointer must have an valid representation of the type.

Source

pub unsafe fn resolve_mut(&self) -> RefMut<'_, T>

Resolve a global pointer into a reference.

§Safety

The underlying object must not mutate while the reference exists, unless the underlying type is Sync + Send. The memory referenced by the pointer must have an valid representation of the type. No other references may be alive referring to the underlying data.

Source

pub fn is_null(&self) -> bool

Returns true if the global pointer is null.

Source

pub fn id(&self) -> ObjID

Returns the object ID of the global pointer.

Source

pub fn offset(&self) -> u64

Returns the offset of the global pointer.

Trait Implementations§

Source§

impl<T> Clone for GlobalPtr<T>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for GlobalPtr<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

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

impl<T: Default> Default for GlobalPtr<T>

Source§

fn default() -> GlobalPtr<T>

Returns the “default value” for a type. Read more
Source§

impl<T> From<GlobalPtr<T>> for FotEntry

Source§

fn from(value: GlobalPtr<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<Ref<'a, T>> for GlobalPtr<T>

Source§

fn from(value: Ref<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<RefMut<'a, T>> for GlobalPtr<T>

Source§

fn from(value: RefMut<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<RefSlice<'a, T>> for GlobalPtr<T>

Source§

fn from(value: RefSlice<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<RefSliceMut<'a, T>> for GlobalPtr<T>

Source§

fn from(value: RefSliceMut<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TxRef<T>> for GlobalPtr<T>

Source§

fn from(value: TxRef<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TxRefSlice<T>> for GlobalPtr<T>

Source§

fn from(value: TxRefSlice<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for GlobalPtr<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Ord> Ord for GlobalPtr<T>

Source§

fn cmp(&self, other: &GlobalPtr<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for GlobalPtr<T>

Source§

fn eq(&self, other: &GlobalPtr<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for GlobalPtr<T>

Source§

fn partial_cmp(&self, other: &GlobalPtr<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> Copy for GlobalPtr<T>

Source§

impl<T: Eq> Eq for GlobalPtr<T>

Source§

impl<T> StructuralPartialEq for GlobalPtr<T>

Auto Trait Implementations§

§

impl<T> Freeze for GlobalPtr<T>

§

impl<T> !ObjSafe for GlobalPtr<T>

§

impl<T> RefUnwindSafe for GlobalPtr<T>
where T: RefUnwindSafe,

§

impl<T> !Send for GlobalPtr<T>

§

impl<T> StoreCopy for GlobalPtr<T>
where T: StoreCopy,

§

impl<T> !Sync for GlobalPtr<T>

§

impl<T> Unpin for GlobalPtr<T>

§

impl<T> UnwindSafe for GlobalPtr<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more