Managed

Struct Managed 

Source
#[repr(C)]
pub struct Managed { pub pointer: *mut (), pub drop: extern "C" fn(*mut ()), }

Fields§

§pointer: *mut ()§drop: extern "C" fn(*mut ())

Implementations§

Source§

impl Managed

Source

pub fn from_value<T>(value: T) -> Self

Source

pub fn from_box<T>(b: Box<T>) -> Self

Source

pub fn from_static<T>(static_ref: &'static T) -> Self

Source

pub fn as_mut_ptr(&self) -> *mut ()

Source

pub fn as_ptr(&self) -> *const ()

Source

pub unsafe fn into_value<T>(self) -> T

Consume this managed value, turning it into the type

Safety: This is unsafe because we don’t know the type behind the raw pointer

Source

pub unsafe fn null() -> Self

Construct a managed null value

Safety: This is unsafe because caller’s behavior is unknown

Trait Implementations§

Source§

impl Drop for Managed

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<ManagedCloneable> for Managed

Source§

fn from(ma: ManagedCloneable) -> Self

Converts to this type from the input type.
Source§

impl Send for Managed

Source§

impl Sync for Managed

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.