[][src]Trait dync::VTable

pub trait VTable<T> {
    fn build_vtable() -> Self;
}

VTable defines a type that represents a virtual function table for some type T.

T is different than a type that can be turned into a trait object like Box<dyn Any> because a VTable effectively decouples the type's behaviour from the data it contains.

This mechanism allows the virtual function table to be attached to a homogeneous container, to prevent storing duplicates of these tables for each type instance stored in the container.

This is precisely how it is used to build VecDyn<V>, which is generic over the virtual table rather than the type itself.

Required methods

fn build_vtable() -> Self

Loading content...

Implementations on Foreign Types

impl<T: Copy> VTable<T> for ()[src]

impl<T: DropBytes, V: VTable<T>> VTable<T> for (DropFn, V)[src]

Loading content...

Implementors

impl<T: DropBytes> VTable<T> for DropVTable[src]

Loading content...