Skip to main content

Data

Trait Data 

Source
pub trait Data: 'static + Sized {
    // Provided methods
    fn into_boxed(self) -> Box<dyn Any> { ... }
    fn from_boxed(boxed: Box<dyn Any>) -> Result<Self, Box<dyn Any>> { ... }
    fn into_raw(self) -> NonNullFREData { ... }
    unsafe fn from_raw(raw: NonNullFREData) -> Self { ... }
    unsafe fn ref_from<'a>(raw: NonNullFREData) -> Result<&'a Self, &'a dyn Any> { ... }
    unsafe fn mut_from<'a>(
        raw: NonNullFREData,
    ) -> Result<&'a mut Self, &'a mut dyn Any> { ... }
}
Expand description

Should be implemented for all native data types to ensure safe pointer passing and correct memory management. Native data includes Extension Data, Context Data, and Function data.

Provided Methods§

Source

fn into_boxed(self) -> Box<dyn Any>

Source

fn from_boxed(boxed: Box<dyn Any>) -> Result<Self, Box<dyn Any>>

Source

fn into_raw(self) -> NonNullFREData

In typical usage of this crate, this function should not be called directly.

Source

unsafe fn from_raw(raw: NonNullFREData) -> Self

In typical usage of this crate, this function should not be called directly.

Source

unsafe fn ref_from<'a>(raw: NonNullFREData) -> Result<&'a Self, &'a dyn Any>

In typical usage of this crate, this function should not be called directly.

§Safety

The returned reference has an unbounded lifetime and is not tied to any input. Correct and safe usage requires the caller to impose additional lifetime constraints.

Source

unsafe fn mut_from<'a>( raw: NonNullFREData, ) -> Result<&'a mut Self, &'a mut dyn Any>

In typical usage of this crate, this function should not be called directly.

§Safety

The returned reference has an unbounded lifetime and is not tied to any input. Correct and safe usage requires the caller to impose additional lifetime constraints.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Data for ()

Source§

impl Data for Arc<Mutex<Box<dyn Any>>>

Source§

impl Data for RefCell<ContextRegistry>

Implementors§