[−][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 From<KeyData> for DefaultKey
[src]
impl From<DefaultKey> for KeyData
[src]
fn from(k: DefaultKey) -> Self
[src]
impl Ord for KeyData
[src]
fn cmp(&self, other: &KeyData) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
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 PartialEq<KeyData> for KeyData
[src]
impl Default for KeyData
[src]
impl Clone for KeyData
[src]
fn clone(&self) -> 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]
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]
T: Copy,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,