[−][src]Struct slotmap::KeyData
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 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<DefaultKey> for KeyData
[src]
fn from(k: DefaultKey) -> Self
[src]
impl From<KeyData> for DefaultKey
[src]
impl Hash for KeyData
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for KeyData
[src]
fn cmp(&self, other: &KeyData) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<KeyData> for KeyData
[src]
impl PartialOrd<KeyData> for KeyData
[src]
fn partial_cmp(&self, other: &KeyData) -> Option<Ordering>
[src]
fn lt(&self, other: &KeyData) -> bool
[src]
fn le(&self, other: &KeyData) -> bool
[src]
fn gt(&self, other: &KeyData) -> bool
[src]
fn ge(&self, other: &KeyData) -> bool
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Slottable for T where
T: Copy,
[src]
T: Copy,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,