Struct vtable::VOffset

source ·
#[repr(C)]
pub struct VOffset<Base, T: ?Sized + VTableMeta, PinFlag = NotPinned> { /* private fields */ }
Expand description

Represents an offset to a field of type matching the vtable, within the Base container structure.

Implementations§

source§

impl<Base, T: ?Sized + VTableMeta, Flag> VOffset<Base, T, Flag>

source

pub fn apply(self, base: &Base) -> VRef<'_, T>

Apply this offset to a reference to the base to obtain a VRef with the same lifetime as the base lifetime

source

pub fn apply_mut(self, base: &mut Base) -> VRefMut<'_, T>

Apply this offset to a reference to the base to obtain a VRefMut with the same lifetime as the base lifetime

source

pub fn new<X: HasStaticVTable<T>>(o: FieldOffset<Base, X, Flag>) -> Self

Create an new VOffset from a FieldOffset where the target type implement the HasStaticVTable trait.

source

pub unsafe fn from_raw(vtable: &'static T::VTable, offset: usize) -> Self

Create a new VOffset from raw data

§Safety

There must be a field that matches the vtable at offset T in base.

source§

impl<Base, T: ?Sized + VTableMeta> VOffset<Base, T, AllowPin>

source

pub fn apply_pin(self, base: Pin<&Base>) -> Pin<VRef<'_, T>>

Apply this offset to a reference to the base to obtain a Pin<VRef<'a, T>> with the same lifetime as the base lifetime

Trait Implementations§

source§

impl<Base, T: ?Sized + VTableMeta, Flag> Clone for VOffset<Base, T, Flag>

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<Base, T: ?Sized + VTableMeta, PinFlag> Debug for VOffset<Base, T, PinFlag>

source§

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

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

impl<Base, T: ?Sized + VTableMeta, Flag> Copy for VOffset<Base, T, Flag>

Auto Trait Implementations§

§

impl<Base, T: ?Sized, PinFlag> Freeze for VOffset<Base, T, PinFlag>

§

impl<Base, T: ?Sized, PinFlag> RefUnwindSafe for VOffset<Base, T, PinFlag>
where PinFlag: RefUnwindSafe, <T as VTableMeta>::VTable: RefUnwindSafe,

§

impl<Base, T: ?Sized, PinFlag> Send for VOffset<Base, T, PinFlag>
where PinFlag: Send, <T as VTableMeta>::VTable: Sync,

§

impl<Base, T: ?Sized, PinFlag> Sync for VOffset<Base, T, PinFlag>
where PinFlag: Sync, <T as VTableMeta>::VTable: Sync,

§

impl<Base, T: ?Sized, PinFlag> Unpin for VOffset<Base, T, PinFlag>
where PinFlag: Unpin,

§

impl<Base, T: ?Sized, PinFlag> UnwindSafe for VOffset<Base, T, PinFlag>
where PinFlag: UnwindSafe, <T as VTableMeta>::VTable: 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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

§

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>,

§

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>,

§

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.