Struct 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 duplicate 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, PinFlag> Freeze for VOffset<Base, T, PinFlag>
where T: ?Sized,

§

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

§

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

§

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

§

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

§

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

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.

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.