Contactish

Trait Contactish 

Source
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§

Source

fn email(&self) -> Option<&String>

Source

fn name(&self) -> Option<&String>

Source

fn comment(&self) -> Option<&String>

Source

fn new<T>(required: T) -> Self
where T: AsRef<str>,

Source

fn set_name<T>(self, name: T) -> Self
where T: AsRef<str>,

Source

fn set_email<T>(self, email: T) -> Self
where T: AsRef<str>,

Source

fn set_comment<T>(self, comment: T) -> Self
where T: AsRef<str>,

Source

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§

Source§

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.

Source§

impl Contactish for EmailContact

Source§

impl Contactish for GarbageContact