Struct idm::DefaultDash
source · [−]pub struct DefaultDash<T: Default>(pub T);Expand description
Wrapper that represents Default values with "-", allowing them in
contexts that cannot represent an empty value.
use idm::DefaultDash;
assert_eq!(
idm::from_str::<DefaultDash<String>>("-").unwrap(),
DefaultDash(String::default())
);
assert_eq!(
idm::from_str::<DefaultDash<String>>("xyzzy").unwrap(),
DefaultDash("xyzzy".to_string())
);
assert_eq!(
idm::to_string(&DefaultDash("xyzzy".to_string())).unwrap(),
"xyzzy"
);
assert_eq!(
idm::to_string(&DefaultDash(String::default())).unwrap(),
"-"
);Tuple Fields
0: TTrait Implementations
sourceimpl<T: Clone + Default> Clone for DefaultDash<T>
impl<T: Clone + Default> Clone for DefaultDash<T>
sourcefn clone(&self) -> DefaultDash<T>
fn clone(&self) -> DefaultDash<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl<T: Debug + Default> Debug for DefaultDash<T>
impl<T: Debug + Default> Debug for DefaultDash<T>
sourceimpl<T: Default + Default> Default for DefaultDash<T>
impl<T: Default + Default> Default for DefaultDash<T>
sourcefn default() -> DefaultDash<T>
fn default() -> DefaultDash<T>
Returns the “default value” for a type. Read more
sourceimpl<T: Default> Deref for DefaultDash<T>
impl<T: Default> Deref for DefaultDash<T>
sourceimpl<T: Default> DerefMut for DefaultDash<T>
impl<T: Default> DerefMut for DefaultDash<T>
sourceimpl<'de, T: DeserializeOwned + Default> Deserialize<'de> for DefaultDash<T>
impl<'de, T: DeserializeOwned + Default> Deserialize<'de> for DefaultDash<T>
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: Hash + Default> Hash for DefaultDash<T>
impl<T: Hash + Default> Hash for DefaultDash<T>
sourceimpl<T: Ord + Default> Ord for DefaultDash<T>
impl<T: Ord + Default> Ord for DefaultDash<T>
sourcefn cmp(&self, other: &DefaultDash<T>) -> Ordering
fn cmp(&self, other: &DefaultDash<T>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: PartialEq + Default> PartialEq<DefaultDash<T>> for DefaultDash<T>
impl<T: PartialEq + Default> PartialEq<DefaultDash<T>> for DefaultDash<T>
sourcefn eq(&self, other: &DefaultDash<T>) -> bool
fn eq(&self, other: &DefaultDash<T>) -> bool
sourceimpl<T: PartialOrd + Default> PartialOrd<DefaultDash<T>> for DefaultDash<T>
impl<T: PartialOrd + Default> PartialOrd<DefaultDash<T>> for DefaultDash<T>
sourcefn partial_cmp(&self, other: &DefaultDash<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &DefaultDash<T>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Copy + Default> Copy for DefaultDash<T>
impl<T: Eq + Default> Eq for DefaultDash<T>
impl<T: Default> StructuralEq for DefaultDash<T>
impl<T: Default> StructuralPartialEq for DefaultDash<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for DefaultDash<T>where
T: RefUnwindSafe,
impl<T> Send for DefaultDash<T>where
T: Send,
impl<T> Sync for DefaultDash<T>where
T: Sync,
impl<T> Unpin for DefaultDash<T>where
T: Unpin,
impl<T> UnwindSafe for DefaultDash<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more