[][src]Struct slotmap::KeyData

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.

Methods

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 From<KeyData> for DefaultKey[src]

impl From<DefaultKey> for KeyData[src]

impl Ord for KeyData[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialOrd<KeyData> for KeyData[src]

impl PartialEq<KeyData> for KeyData[src]

impl Default for KeyData[src]

impl Clone for KeyData[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Eq for KeyData[src]

impl Copy for KeyData[src]

impl Debug for KeyData[src]

impl Hash for KeyData[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for KeyData

impl Unpin for KeyData

impl Sync for KeyData

impl UnwindSafe for KeyData

impl RefUnwindSafe for KeyData

Blanket Implementations

impl<T> Slottable for T where
    T: Copy
[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.

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

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

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