Struct slotmap_fork_otter::KeyData[][src]

pub struct KeyData { /* fields omitted */ }

The actual data stored in a Key.

This implements Ord so keys can be stored in e.g. BTreeMap, but the order of keys is unspecified.

Implementations

impl KeyData[src]

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

Returns the key data as a 64-bit integer. No guarantees about its value are made other than that passing it to from_ffi will return a key equal to the original.

With this you can easily pass slot map keys as opaque handles to foreign code. After you get them back you can confidently use them in your slot map without worrying about unsafe behavior as you would with passing and receiving back references or pointers.

This is not a substitute for proper serialization, use serde for that. If you are not doing FFI, you almost surely do not need this function.

pub fn from_ffi(value: u64) -> Self[src]

Iff value is a value received from k.as_ffi(), returns a key equal to k. Otherwise the behavior is safe but unspecified.

Trait Implementations

impl Clone for KeyData[src]

impl Copy for KeyData[src]

impl Debug for KeyData[src]

impl Default for KeyData[src]

impl Eq for KeyData[src]

impl From<KeyData> for DefaultKey[src]

impl Hash for KeyData[src]

impl Ord for KeyData[src]

impl PartialEq<KeyData> for KeyData[src]

impl PartialOrd<KeyData> for KeyData[src]

impl StructuralEq for KeyData[src]

impl StructuralPartialEq for KeyData[src]

Auto Trait Implementations

impl RefUnwindSafe for KeyData

impl Send for KeyData

impl Sync for KeyData

impl Unpin for KeyData

impl UnwindSafe for KeyData

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.