[−][src]Enum ordered_multimap::list_ordered_multimap::KeyWrapper
A wrapper around a key that is either borrowed or owned.
This type is similar to std::borrow::Cow
but does not require a Clone
trait bound on the
key.
Variants
Borrowed(&'map Key)
An immutable reference to a key. This implies that the key is still associated to at least one value in the multimap.
An owned key. This will occur when a key is no longer associated with any values in the multimap.
Methods
impl<'map, Key> KeyWrapper<'map, Key>
[src]
pub fn into_owned(self) -> Key where
Key: Clone,
[src]
Key: Clone,
If the key wrapped is owned, it is returned. Otherwise, the borrowed key is cloned and returned.
Examples
use ordered_multimap::list_ordered_multimap::KeyWrapper; let borrowed = KeyWrapper::Borrowed(&0); assert_eq!(borrowed.into_owned(), 0); let owned = KeyWrapper::Owned(0); assert_eq!(borrowed.into_owned(), 0);
pub fn is_borrowed(&self) -> bool
[src]
Returns whether the wrapped key is borrowed.
Examples
use ordered_multimap::list_ordered_multimap::KeyWrapper; let borrowed = KeyWrapper::Borrowed(&0); assert!(borrowed.is_borrowed()); let owned = KeyWrapper::Owned(0); assert!(!owned.is_borrowed());
pub fn is_owned(&self) -> bool
[src]
Returns whether the wrapped key is owned.
Examples
use ordered_multimap::list_ordered_multimap::KeyWrapper; let borrowed = KeyWrapper::Borrowed(&0); assert!(!borrowed.is_owned()); let owned = KeyWrapper::Owned(0); assert!(owned.is_owned());
Trait Implementations
impl<'map, Key: Clone> Clone for KeyWrapper<'map, Key>
[src]
fn clone(&self) -> KeyWrapper<'map, Key>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'map, Key: Copy> Copy for KeyWrapper<'map, Key>
[src]
impl<'map, Key: Debug> Debug for KeyWrapper<'map, Key>
[src]
impl<'map, Key: Eq> Eq for KeyWrapper<'map, Key>
[src]
impl<'map, Key: Hash> Hash for KeyWrapper<'map, Key>
[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<'map, Key: PartialEq> PartialEq<KeyWrapper<'map, Key>> for KeyWrapper<'map, Key>
[src]
fn eq(&self, other: &KeyWrapper<'map, Key>) -> bool
[src]
fn ne(&self, other: &KeyWrapper<'map, Key>) -> bool
[src]
impl<'map, Key> StructuralEq for KeyWrapper<'map, Key>
[src]
impl<'map, Key> StructuralPartialEq for KeyWrapper<'map, Key>
[src]
Auto Trait Implementations
impl<'map, Key> RefUnwindSafe for KeyWrapper<'map, Key> where
Key: RefUnwindSafe,
Key: RefUnwindSafe,
impl<'map, Key> Send for KeyWrapper<'map, Key> where
Key: Send + Sync,
Key: Send + Sync,
impl<'map, Key> Sync for KeyWrapper<'map, Key> where
Key: Sync,
Key: Sync,
impl<'map, Key> Unpin for KeyWrapper<'map, Key> where
Key: Unpin,
Key: Unpin,
impl<'map, Key> UnwindSafe for KeyWrapper<'map, Key> where
Key: RefUnwindSafe + UnwindSafe,
Key: RefUnwindSafe + UnwindSafe,
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> 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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,