[][src]Struct c_bridge::RustBox

#[repr(transparent)]
pub struct RustBox(_);

An interface to work with FfiObjects containing a boxed Rust object

Methods

impl RustBox[src]

pub fn as_ref(&self) -> &(dyn Any + 'static)[src]

The underlying element as reference

pub fn as_mut(&mut self) -> &mut (dyn Any + 'static)[src]

The underlying element as mutable reference

pub fn move_into_box(self) -> Result<Box<dyn Any + 'static>, Self>[src]

Moves the underlying memory from the payload out of the FfiObject and creates a Box from it

Note: this only works if the Rust object was created using from_object (which should almost always be the case)

Trait Implementations

impl From<RustBox> for FfiObject[src]

impl<T: Any + 'static> From<Box<T>> for RustBox[src]

fn from(boxed: Box<T>) -> Self[src]

Creates a new Box from object and encapsulates it into a wrapped and owned FfiObject

impl TryFrom<FfiObject> for RustBox[src]

type Error = FfiObject

The type returned in the event of a conversion error.

fn try_from(object: FfiObject) -> Result<Self, Self::Error>[src]

Converts object into the Rust box if it has the correct type and is not empty

Auto Trait Implementations

impl !Send for RustBox

impl Unpin for RustBox

impl !Sync for RustBox

impl RefUnwindSafe for RustBox

impl UnwindSafe for RustBox

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]