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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Convert self to an expression for Diesel’s query builder. Read more

Convert &self to an expression for Diesel’s query builder. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.