[−][src]Enum contrie::ExistingOrNew
A simple enum to make a distinction if the returned value is an already existing one or a newly created instance.
As it dereferences to the held value, it acts almost as the value T
in many circumstances.
Otherwise it can also be extracted.
Variants
Existing(T)
The entry already existed.
New(T)
A new entry had to be inserted to satisfy the request.
Methods
impl<T> ExistingOrNew<T>
[src]
pub fn into_inner(self) -> T
[src]
Extracts the inner value.
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> ExistingOrNew<U>
[src]
Applies a transformation to the value.
This applies the function to the inner value, but preserves the information if it was a new or existing one.
pub fn is_new(&self) -> bool
[src]
Checks if the value was newly created one.
Trait Implementations
impl<T: PartialEq> PartialEq<ExistingOrNew<T>> for ExistingOrNew<T>
[src]
fn eq(&self, other: &ExistingOrNew<T>) -> bool
[src]
fn ne(&self, other: &ExistingOrNew<T>) -> bool
[src]
impl<T: Clone> Clone for ExistingOrNew<T>
[src]
fn clone(&self) -> ExistingOrNew<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialOrd> PartialOrd<ExistingOrNew<T>> for ExistingOrNew<T>
[src]
fn partial_cmp(&self, other: &ExistingOrNew<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &ExistingOrNew<T>) -> bool
[src]
fn le(&self, other: &ExistingOrNew<T>) -> bool
[src]
fn gt(&self, other: &ExistingOrNew<T>) -> bool
[src]
fn ge(&self, other: &ExistingOrNew<T>) -> bool
[src]
impl<T: Eq> Eq for ExistingOrNew<T>
[src]
impl<T: Ord> Ord for ExistingOrNew<T>
[src]
fn cmp(&self, other: &ExistingOrNew<T>) -> 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<T: Copy> Copy for ExistingOrNew<T>
[src]
impl<T> DerefMut for ExistingOrNew<T>
[src]
impl<T> Deref for ExistingOrNew<T>
[src]
impl<T: Debug> Debug for ExistingOrNew<T>
[src]
impl<T: Hash> Hash for ExistingOrNew<T>
[src]
Auto Trait Implementations
impl<T> Unpin for ExistingOrNew<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for ExistingOrNew<T> where
T: Sync,
T: Sync,
impl<T> Send for ExistingOrNew<T> where
T: Send,
T: Send,
impl<T> RefUnwindSafe for ExistingOrNew<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for ExistingOrNew<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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,