Struct contack::Contact [−][src]
pub struct Contact {Show 14 fields
pub uid: String,
pub name: Name,
pub nickname: Option<String>,
pub anniversary: Option<DateTime>,
pub bday: Option<DateTime>,
pub photo: Option<Uri>,
pub title: Option<String>,
pub role: Option<String>,
pub org: Option<Org>,
pub logo: Option<Uri>,
pub contact_information: Vec<ContactInformation>,
pub gender: Option<Gender>,
pub work_address: Option<Address>,
pub home_address: Option<Address>,
}
Expand description
A structure to store contact information.
All fields correspond (at least somewhat) to the VCard 4 specification
Fields
uid: String
The Contact’s Uid
name: Name
The Contacts Name
nickname: Option<String>
The Contact’s Nickname
anniversary: Option<DateTime>
The Contact’s Anniversary
bday: Option<DateTime>
The Contact’s Birthday
photo: Option<Uri>
The Contact’s Photo
title: Option<String>
The Contact’s Job Title
role: Option<String>
The Contact’s Job Role
org: Option<Org>
The Contact’s Organization
logo: Option<Uri>
The Contact’s Organization’s Logo
contact_information: Vec<ContactInformation>
The Contact’s contact information, emails, phones etc
gender: Option<Gender>
The contact’s sex and gender
work_address: Option<Address>
The Contact’s Work Address
home_address: Option<Address>
The Contact’s Home Address
Implementations
Generates a uuid for the contact’s uid.
This should be called after cloning a contact, as not to have a clashing uid which breaks the specification.
The uuid
crate is used for this generation.
Example
Clone a contact and give it a new uid.
use contack::{Name, Contact};
let mut contact = contact_1.clone();
contact.gen_uid();
assert_ne!(contact.uid, "");
Creates a contact from a Name
It is required to use a name
from the VCard
specification, alongside a uid
, which is
generated automatically from the uuid
crate.
Example
Create a new contact with the name “John Doe”
use contack::{Name, Contact};
let contact = Contact::new(Name {
given: vec!["John".to_string()],
family: vec!["Doe".to_string()],
..Default::default()
});
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Error = SqlConversionError
type Error = SqlConversionError
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Contact
impl UnwindSafe for Contact
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert self
to an expression for Diesel’s query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel’s query builder. Read more