pub trait Contactish {
// Required methods
fn email(&self) -> Option<&String>;
fn name(&self) -> Option<&String>;
fn comment(&self) -> Option<&String>;
fn new<T>(required: T) -> Self
where T: AsRef<str>;
fn set_name<T>(self, name: T) -> Self
where T: AsRef<str>;
fn set_email<T>(self, email: T) -> Self
where T: AsRef<str>;
fn set_comment<T>(self, comment: T) -> Self
where T: AsRef<str>;
fn to_contact(self) -> Contact;
}Expand description
Unified interface for all contact types
Required Methods§
fn email(&self) -> Option<&String>
fn name(&self) -> Option<&String>
fn comment(&self) -> Option<&String>
fn new<T>(required: T) -> Self
fn set_name<T>(self, name: T) -> Self
fn set_email<T>(self, email: T) -> Self
fn set_comment<T>(self, comment: T) -> Self
fn to_contact(self) -> Contact
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl Contactish for Contact
Will be handed down on our variants’ contents, which implement the same trait
The exception to the rule is the ::new method.
Please note: the current implementation does not (yet?) magically change
a Contact::Garbage variant into a Contact::Email one if you try to call
::set_email. It merely returns an unchanged Self.