Struct contack::read_write::component::Component[][src]

pub struct Component {
    pub name: String,
    pub parameters: HashMap<String, String>,
    pub values: Vec<Vec<String>>,
    // some fields omitted
}
This is supported on crate feature read_write only.
Expand description

A Component represents one single line of VCard. It has a name, it might have a group, and some parameters.

This is how it will look when turned into a string:

GROUP.NAME;PARAM=VAL;PARAM2=VAL2:VALUE1;VALUE2

I would like to point out that Component does not stop you doing stupid things. Please do not add ‘=’ signs to values (for the same reason you don’t do that normally.)

Fields

name: String

This is the name of the VCard property.

parameters: HashMap<String, String>

These are the parameters PARAM=VAL.

values: Vec<Vec<String>>

The values of the Component. They are an array of arrays. Major properties are separated by ; and minor properties by ,.

Implementations

Creates a component from a name.

Example

Create a FN component


use contack::read_write::Component;
assert_eq!(
    Component::new("FN".to_string()).to_string(),
    "FN:\r\n"
)

Sets the group to be the given value. Returns false on a group containing characters not included in [a-zA-Z0-9-], indicating the value has not been set.

Get’s this’ group

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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Allows a name to be translated into a component.

You should never need to call this directly and should prefer turning a whole contact into a VCard.

Example

Convert a name into a contact and print it out.

use contack::Name;
use contack::read_write::component::Component;
 
let name = Name {
   given: vec!["John".to_string()],
   family: vec!["Doe".to_string()],
   ..Default::default()
};

let component: Component = name.into();

// NAME:Doe;John;;;;
println!("{}", component);

Performs the conversion.

Performs the conversion.

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

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

This method tests for !=.

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.

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

Converts the given value to a String. 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.