[][src]Struct relative::Vtable

pub struct Vtable<T: ?Sized>(_, _);

Wraps &'static references to vtables such that they can be safely sent between other processes running the same binary.

For references into the segment that houses the vtables, typically the read-only data segment aka rodata.

The base used is the vtable of a static trait object:

This example is not tested
#[used]
#[no_mangle]
pub static RELATIVE_VTABLE_BASE: &(dyn Any + Sync) = &();

let base = transmute::<*const dyn Any, std::raw::TraitObject>(RELATIVE_VTABLE_BASE).vtable as usize;

Methods

impl<T: ?Sized> Vtable<T>[src]

pub unsafe fn from(ptr: &'static ()) -> Self[src]

Create a Vtable<T> from a &'static ().

Safety

This is unsafe as it is up to the user to ensure the pointer lies within static memory.

i.e. the pointer needs to be positioned the same relative to the base in every invocation, through e.g. being in the same segment, or the binary being statically linked.

pub fn to(&self) -> &'static ()[src]

Get back a &'static () from a Vtable<T>.

Trait Implementations

impl<T: ?Sized> Clone for Vtable<T>[src]

impl<T: ?Sized> Copy for Vtable<T>[src]

impl<T: ?Sized> Eq for Vtable<T>[src]

impl<T: ?Sized> Ord for Vtable<T>[src]

impl<T: ?Sized> PartialEq<Vtable<T>> for Vtable<T>[src]

impl<T: ?Sized> PartialOrd<Vtable<T>> for Vtable<T>[src]

impl<T: ?Sized> Debug for Vtable<T>[src]

impl<T: ?Sized> Hash for Vtable<T>[src]

impl<T: ?Sized + 'static> Serialize for Vtable<T>[src]

impl<'de, T: ?Sized + 'static> Deserialize<'de> for Vtable<T>[src]

Auto Trait Implementations

impl<T: ?Sized> Send for Vtable<T>

impl<T: ?Sized> Sync for Vtable<T>

impl<T: ?Sized> Unpin for Vtable<T>

impl<T: ?Sized> UnwindSafe for Vtable<T>

impl<T: ?Sized> RefUnwindSafe for Vtable<T>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self