Struct ffi_support::handle_map::Handle[][src]

pub struct Handle { /* fields omitted */ }

A Handle we allow to be returned over the FFI by implementing IntoFfi. This type is intentionally not #[repr(C)], and getting the data out of the FFI is done using Handle::from_u64, or it’s implemetation of From<u64>.

It consists of, at a minimum:

In practice, it may also contain extra information to help detect other errors (currently it stores a “magic value” used to detect invalid Handles).

These fields may change but the following guarantees are made about the internal representation:

Implementations

impl Handle[src]

pub fn into_u64(self) -> u64[src]

Convert a Handle to a u64. You can also use Into::into directly. Most uses of this will be automatic due to our IntoFfi implementation.

pub fn from_u64(v: u64) -> Result<Self, HandleError>[src]

Convert a u64 to a Handle. Inverse of into_u64. We also implement From::from (which will panic instead of returning Err).

Returns HandleError::InvalidHandle if the bits cannot possibly represent a valid handle.

pub fn is_valid(v: u64) -> bool[src]

Returns whether or not v makes a bit pattern that could represent an encoded Handle.

Trait Implementations

impl Clone for Handle[src]

impl Copy for Handle[src]

impl Debug for Handle[src]

impl From<u64> for Handle[src]

impl<T> Index<Handle> for HandleMap<T>[src]

type Output = T

The returned type after indexing.

impl IntoFfi for Handle[src]

type Value = u64

This type must be: Read more

impl PartialEq<Handle> for Handle[src]

impl StructuralPartialEq for Handle[src]

Auto Trait Implementations

impl RefUnwindSafe for Handle

impl Send for Handle

impl Sync for Handle

impl Unpin for Handle

impl UnwindSafe for Handle

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.