[][src]Trait vptr::HasVPtr

pub unsafe trait HasVPtr<Trait: ?Sized> {
    fn init() -> &'static VTableData;
fn get_vptr(&self) -> &VPtr<Self, Trait>
    where
        Self: Sized
;
fn get_vptr_mut(&mut self) -> &mut VPtr<Self, Trait>
    where
        Self: Sized
; fn as_thin_ref(&self) -> ThinRef<Trait>
    where
        Self: Sized
, { ... }
fn as_thin_ref_mut(&mut self) -> ThinRefMut<Trait>
    where
        Self: Sized
, { ... }
fn as_pin_thin_ref(self: Pin<&Self>) -> Pin<ThinRef<Trait>>
    where
        Self: Sized
, { ... }
fn as_pin_thin_ref_mut(self: Pin<&mut Self>) -> Pin<ThinRefMut<Trait>>
    where
        Self: Sized
, { ... } }

This trait indicate that the type has a VPtr field to the trait Trait

You should not implement this trait yourself, it is implemented by the vptr macro

Safety: For this to work correctly, the init() function must return a reference to a VTableData with valid content (the offset and vtable pointer need to be correct for this type) and get_vptr must return a reference of a field withi &self. The `#[vptr] macro does the right thing

Required methods

fn init() -> &'static VTableData

Initialize a VTableData suitable to initialize the VPtr within Self

fn get_vptr(&self) -> &VPtr<Self, Trait> where
    Self: Sized

return the a reference of the VPtr within Self

fn get_vptr_mut(&mut self) -> &mut VPtr<Self, Trait> where
    Self: Sized

return the a reference of the VPtr within Self

Loading content...

Provided methods

fn as_thin_ref(&self) -> ThinRef<Trait> where
    Self: Sized

return a thin reference to self

fn as_thin_ref_mut(&mut self) -> ThinRefMut<Trait> where
    Self: Sized

return a thin reference to self

fn as_pin_thin_ref(self: Pin<&Self>) -> Pin<ThinRef<Trait>> where
    Self: Sized

Map a pinned reference to to a pinned thin reference

fn as_pin_thin_ref_mut(self: Pin<&mut Self>) -> Pin<ThinRefMut<Trait>> where
    Self: Sized

Map a pinned mutable reference to to a pinned mutable thin reference

Loading content...

Implementors

Loading content...