Struct cbox::CSemiBox [] [src]

pub struct CSemiBox<'a, D: ?Sized> where D: DisposeRef + 'a {
    // some fields omitted
}

A wrapper for pointers made by C that are now partially owned in Rust.

This is necessary to allow owned and borrowed representations of C types to be represented by the same type as they are in C with little overhead

Methods

impl<'a, D: ?Sized> CSemiBox<'a, D> where D: DisposeRef + 'a
[src]

fn new(ptr: *mut D::RefTo) -> Self

Wrap the pointer in a CSemiBox

unsafe fn as_ptr(&self) -> *mut D::RefTo

Returns the internal pointer

unsafe fn unwrap(self) -> *mut D::RefTo

Returns the internal pointer

Trait Implementations

impl<'a, D: ?Sized> From<*mut D::RefTo> for CSemiBox<'a, D> where D: DisposeRef + 'a
[src]

fn from(ptr: *mut D::RefTo) -> Self

Performs the conversion.

impl<'a, D: ?Sized> Drop for CSemiBox<'a, D> where D: DisposeRef + 'a
[src]

fn drop(&mut self)

Run the destructor

impl<'a, D> Deref for CSemiBox<'a, D> where D: DisposeRef + 'a, *mut D::RefTo: Into<&'a D>
[src]

type Target = D

The resulting type after dereferencing

fn deref(&self) -> &D

The method called to dereference a value

impl<'a, D> Borrow<D> for CSemiBox<'a, D> where D: DisposeRef + 'a, *mut D::RefTo: Into<&'a D>
[src]

fn borrow(&self) -> &D

Immutably borrows from an owned value. Read more

impl<'a, D> DerefMut for CSemiBox<'a, D> where D: DisposeRef + 'a, *mut D::RefTo: Into<&'a D>, *mut D::RefTo: Into<&'a mut D>
[src]

fn deref_mut(&mut self) -> &mut D

The method called to mutably dereference a value

impl<'a, T> Display for CSemiBox<'a, T> where T: Display + DisposeRef + 'a, *mut T::RefTo: Into<&'a T>
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'a, T> Debug for CSemiBox<'a, T> where T: Debug + DisposeRef + 'a, *mut T::RefTo: Into<&'a T>
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'a, T> PartialEq<T> for CSemiBox<'a, T> where T: 'a + DisposeRef + PartialEq, *mut T::RefTo: Into<&'a T>
[src]

fn eq(&self, other: &T) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<'a> From<&'a CStr> for CSemiBox<'a, str>
[src]

fn from(text: &'a CStr) -> CSemiBox<'a, str>

Performs the conversion.