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 PartialOrd for Unset
impl PartialOrd for Unset
impl 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)