Struct mbox::mbox::MBox [] [src]

pub struct MBox<T: ?Sized + Free>(_);

A malloc-backed box. This structure allows Rust to exchange objects with C without cloning.

Methods

impl<T: ?Sized + Free> MBox<T>
[src]

Constructs a new malloc-backed box from a pointer allocated by malloc. The content of the pointer must be already initialized.

Obtains the pointer owned by the box.

Obtains the mutable pointer owned by the box.

impl<T: ?Sized + Free> MBox<T>
[src]

Consumes the box and returns the original pointer.

The caller is responsible for freeing the pointer after this.

impl<T> MBox<T>
[src]

Constructs a new malloc-backed box, and move an initialized value into it.

impl<T> MBox<[T]>
[src]

Constructs a new malloc-backed slice from the pointer and the length (number of items).

The malloced size of the pointer must be at least len * size_of::<T>(). The content must already been initialized.

impl<T: Clone> MBox<[T]>
[src]

Creates a new malloc-boxed slice by cloning the content of an existing slice.

impl MBox<str>
[src]

Constructs a new malloc-backed string from the pointer and the length (number of UTF-8 code units).

The malloced size of the pointer must be at least len. The content must already been initialized and be valid UTF-8.

Constructs a new malloc-backed string from the pointer and the length (number of UTF-8 code units).

The malloced size of the pointer must be at least len. If the content does not contain valid UTF-8, this method returns an Err.

Converts the string into raw bytes.

Creates a string from raw bytes. The bytes must be valid UTF-8.

Creates a string from raw bytes. If the content does not contain valid UTF-8, this method returns an Err.

Creates a new malloc-boxed string by cloning the content of an existing string slice.

Trait Implementations

impl<T: ?Sized + Free> Drop for MBox<T>
[src]

A method called when the value goes out of scope. Read more

impl<T: ?Sized + Free> Deref for MBox<T>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<T: ?Sized + Free> DerefMut for MBox<T>
[src]

The method called to mutably dereference a value

impl<T: ?Sized + Free> AsRef<T> for MBox<T>
[src]

Performs the conversion.

impl<T: ?Sized + Free> AsMut<T> for MBox<T>
[src]

Performs the conversion.

impl<T: ?Sized + Free> Borrow<T> for MBox<T>
[src]

Immutably borrows from an owned value. Read more

impl<T: ?Sized + Free> BorrowMut<T> for MBox<T>
[src]

Mutably borrows from an owned value. Read more

impl<T: ?Sized + Free + Unsize<U>, U: ?Sized + Free> CoerceUnsized<MBox<U>> for MBox<T>
[src]

impl<T: ?Sized + Free> Pointer for MBox<T>
[src]

Formats the value using the given formatter.

impl<T: ?Sized + Free + Debug> Debug for MBox<T>
[src]

Formats the value using the given formatter.

impl<T: ?Sized + Free + Display> Display for MBox<T>
[src]

Formats the value using the given formatter.

impl<T: ?Sized + Free + Hash> Hash for MBox<T>
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl<U: ?Sized + Free, T: ?Sized + Free + PartialEq<U>> PartialEq<MBox<U>> for MBox<T>
[src]

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

This method tests for !=.

impl<T: ?Sized + Free + Eq> Eq for MBox<T>
[src]

impl<U: ?Sized + Free, T: ?Sized + Free + PartialOrd<U>> PartialOrd<MBox<U>> for MBox<T>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: ?Sized + Free + Ord> Ord for MBox<T>
[src]

This method returns an Ordering between self and other. Read more

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

Performs the conversion.

impl<T: Clone> Clone for MBox<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Default> Default for MBox<T>
[src]

Returns the "default value" for a type. Read more

impl<T> Default for MBox<[T]>
[src]

Returns the "default value" for a type. Read more

impl<T: Clone> Clone for MBox<[T]>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> FromIterator<T> for MBox<[T]>
[src]

Creates a value from an iterator. Read more

impl<T> IntoIterator for MBox<[T]>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, T> IntoIterator for &'a MBox<[T]>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, T> IntoIterator for &'a mut MBox<[T]>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl Default for MBox<str>
[src]

Returns the "default value" for a type. Read more

impl Clone for MBox<str>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Boxed for MBox<T>
[src]

Unstable (placement_new_protocol)

The kind of data that is stored in this kind of box.

Unstable (placement_new_protocol)

The place that will negotiate the storage of the data.

Unstable (placement_new_protocol)

Converts filled place into final owning value, shifting deallocation/cleanup responsibilities (if any remain), over to returned instance of Self and forgetting filled. Read more