Struct slotmap::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]
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<DefaultKey> for KeyData
[src]
impl From<DefaultKey> for KeyData
[src]fn from(k: DefaultKey) -> Self
[src]
impl PartialOrd<KeyData> for KeyData
[src]
impl PartialOrd<KeyData> for KeyData
[src]