pub struct Unset;
Expand description
A marker for generic types that specifies a variant of something being not specified.
This struct is mostly used with typed builder pattern.
§Examples
use mavio::protocol::Unset;
trait MaybeSomething {}
struct Something {
/* fields */
}
impl MaybeSomething for Something {}
impl MaybeSomething for Unset {}
struct Container<T: MaybeSomething> (T);
impl Container<Unset> {
fn new() -> Self {
Self(Unset)
}
fn add_something(something: Something) -> Container<Something> {
Container(something)
}
}
impl Container<Something> {
fn do_something(&self) {
/* logic specific to something */
}
}
Trait Implementations§
source§impl<'de> Deserialize<'de> for Unset
impl<'de> Deserialize<'de> for Unset
source§fn 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
source§impl Ord for Unset
impl Ord for Unset
source§impl PartialEq for Unset
impl PartialEq for Unset
source§impl PartialOrd for Unset
impl PartialOrd for Unset
1.0.0 · source§fn 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 Copy for Unset
impl Eq for Unset
impl StructuralPartialEq for Unset
Auto Trait Implementations§
impl Freeze for Unset
impl RefUnwindSafe for Unset
impl Send for Unset
impl Sync for Unset
impl Unpin for Unset
impl UnwindSafe for Unset
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more