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§
fn into_boxed(self) -> Box<dyn Any>
fn from_boxed(boxed: Box<dyn Any>) -> Result<Self, Box<dyn Any>>
Sourcefn into_raw(self) -> NonNullFREData
fn into_raw(self) -> NonNullFREData
In typical usage of this crate, this function should not be called directly.
Sourceunsafe fn from_raw(raw: NonNullFREData) -> Self
unsafe fn from_raw(raw: NonNullFREData) -> Self
In typical usage of this crate, this function should not be called directly.
Sourceunsafe fn ref_from<'a>(raw: NonNullFREData) -> Result<&'a Self, &'a dyn Any>
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.
Sourceunsafe fn mut_from<'a>(
raw: NonNullFREData,
) -> Result<&'a mut Self, &'a mut dyn Any>
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.