Type Definition supercow::Phantomcow [] [src]

type Phantomcow<'a, OWNED, BORROWED = OWNED, SHARED = Box<DefaultFeatures<'static> + 'static>, STORAGE = BoxedStorage> = Supercow<'a, OWNED, BORROWED, SHARED, STORAGE, ()>;

Phantomcow<'a, Type> is to Supercow<'a, Type> as PhantomData<&'a Type> is to &'a Type.

That is, Phantomcow effects a lifetime dependency on the borrowed value, while still permitting the owned and shared modes of Supercow, and keeping the underlying objects alive as necessary.

There is not much one can do with a Phantomcow; it can be moved around, and in some cases cloned. Its main use is in FFI wrappers, where BORROWED maintains some external state or resource that will be destroyed when it is, and which the owner of the Phantomcow depends on to function.

The size of a Phantomcow is generally equal to the size of the corresponding Supercow type minus the size of &'a BORROWED, though this may not be exact depending on STORAGE alignment, etc.