Struct cbox::CSemiBox
[−]
[src]
pub struct CSemiBox<'a, D: ?Sized> where
D: DisposeRef + 'a, { /* 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]
D: DisposeRef + 'a,
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]
D: DisposeRef + 'a,
impl<'a, D: ?Sized> Drop for CSemiBox<'a, D> where
D: DisposeRef + 'a,
[src]
D: DisposeRef + 'a,
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]
D: DisposeRef + 'a,
*mut D::RefTo: Into<&'a D>,
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]
D: DisposeRef + 'a,
*mut D::RefTo: Into<&'a D>,
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]
D: DisposeRef + 'a,
*mut D::RefTo: Into<&'a D>,
*mut D::RefTo: Into<&'a mut D>,
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]
T: Display + DisposeRef + 'a,
*mut T::RefTo: Into<&'a T>,
impl<'a, T> Debug for CSemiBox<'a, T> where
T: Debug + DisposeRef + 'a,
*mut T::RefTo: Into<&'a T>,
[src]
T: Debug + DisposeRef + 'a,
*mut T::RefTo: Into<&'a T>,
impl<'a, T> PartialEq<T> for CSemiBox<'a, T> where
T: 'a + DisposeRef + PartialEq,
*mut T::RefTo: Into<&'a T>,
[src]
T: 'a + DisposeRef + PartialEq,
*mut T::RefTo: Into<&'a T>,
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 !=
.