Trait StaticType

Source
pub unsafe trait StaticType {
    type Ref: ?Sized;

    // Required method
    fn ref_ptr(&self) -> *const Self::Ref;
}
Expand description

A value that is fixed in memory.

If you implement this you need to guarantee that Self and Ref does not move in memory

Most probably it should be allocated on the heap

Required Associated Types§

Required Methods§

Source

fn ref_ptr(&self) -> *const Self::Ref

the caller of ref_ptr promises to not use the ptr after Self goes out of scope and to use the ptr only to cast to a references

Implementations on Foreign Types§

Source§

impl<T: ?Sized> StaticType for Box<T>

Source§

type Ref = T

Source§

fn ref_ptr(&self) -> *const Self::Ref

Implementors§