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: StringThe Contact’s Uid
name: NameThe 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§
Source§impl Contact
impl Contact
Sourcepub fn gen_uid(&mut self)
pub fn gen_uid(&mut self)
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, "");Sourcepub fn new(name: Name) -> Self
pub fn new(name: Name) -> Self
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§
Source§impl PartialOrd for Contact
impl PartialOrd for Contact
Source§impl TryFrom<Contact> for SqlContact
Available on crate feature sql only.
impl TryFrom<Contact> for SqlContact
sql only.Source§impl TryFrom<SqlContact> for Contact
Available on crate feature sql only.
impl TryFrom<SqlContact> for Contact
sql only.Source§type Error = SqlConversionError
type Error = SqlConversionError
impl StructuralPartialEq for Contact
Auto Trait Implementations§
impl Freeze for Contact
impl RefUnwindSafe for Contact
impl Send for Contact
impl Sync for Contact
impl Unpin for Contact
impl UnwindSafe for Contact
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
&self to an expression for Diesel’s query builder. Read more