Skip to main content

Property

Enum Property 

Source
pub enum Property {
Show 44 variants PropertyAdr(PropertyAdrData), PropertyAnniversary(PropertyAnniversaryData), PropertyBDay(PropertyBDayData), PropertyBirthPlace(PropertyBirthPlaceData), PropertyCalAdrUri(PropertyCalAdrUriData), PropertyCalUri(PropertyCalUriData), PropertyCategories(PropertyCategoriesData), PropertyClientPidMap(PropertyClientPidMapData), PropertyContactUri(PropertyContactUriData), PropertyDeathDate(PropertyDeathDateData), PropertyDeathPlace(PropertyDeathPlaceData), PropertyEmail(PropertyEmailData), PropertyExpertise(PropertyExpertiseData), PropertyFbUrl(PropertyFbUrlData), PropertyFn(PropertyFnData), PropertyGender(PropertyGenderData), PropertyGeo(PropertyGeoData), PropertyHobby(PropertyHobbyData), PropertyImpp(PropertyImppData), PropertyInterest(PropertyInterestData), PropertyKey(PropertyKeyData), PropertyKind(PropertyKindData), PropertyLang(PropertyLangData), PropertyLogo(PropertyLogoData), PropertyMember(PropertyMemberData), PropertyNickName(PropertyNickNameData), PropertyNote(PropertyNoteData), PropertyN(PropertyNData), PropertyOrgDirectory(PropertyOrgDirectoryData), PropertyOrg(PropertyOrgData), PropertyPhoto(PropertyPhotoData), PropertyProdId(PropertyProdIdData), PropertyRelated(PropertyRelatedData), PropertyRev(PropertyRevData), PropertyRole(PropertyRoleData), PropertySound(PropertySoundData), PropertySource(PropertySourceData), PropertyTel(PropertyTelData), PropertyTitle(PropertyTitleData), PropertyTz(PropertyTzData), PropertyUid(PropertyUidData), PropertyUrl(PropertyUrlData), PropertyXml(PropertyXmlData), PropertyXName(PropertyXNameData),
}

Variants§

§

PropertyAdr(PropertyAdrData)

Represents an ADR parameter, see RFC 6350 6.3.1.

§

PropertyAnniversary(PropertyAnniversaryData)

Represents an ANNIVERSARY parameter, see RFC 6350 6.2.6.

§

PropertyBDay(PropertyBDayData)

Represents an BDAY parameter, see RFC 6350 6.2.5.

§

PropertyBirthPlace(PropertyBirthPlaceData)

Represents an BIRTHPLACE parameter, see RFC 6474 2.1.

§

PropertyCalAdrUri(PropertyCalAdrUriData)

Represents an CALADRURI parameter, see RFC 6350 6.9.2.

§

PropertyCalUri(PropertyCalUriData)

Represents an CALURI parameter, see RFC 6350 6.9.3.

§

PropertyCategories(PropertyCategoriesData)

Represents an CATEGORIES parameter, see RFC 6350 6.7.1.

§

PropertyClientPidMap(PropertyClientPidMapData)

Represents an CLIENTPIDMAP parameter, see RFC 6350 6.7.1.

§

PropertyContactUri(PropertyContactUriData)

Represents an CONTACT parameter, see RFC 8605 2.1.

§

PropertyDeathDate(PropertyDeathDateData)

Represents an DEATHDATE parameter, see RFC 6474 2.3.

§

PropertyDeathPlace(PropertyDeathPlaceData)

Represents an DEATHPLACE parameter, see RFC 6474 2.2.

§

PropertyEmail(PropertyEmailData)

Represents an EMAIL parameter, see RFC 6350 6.4.2.

§

PropertyExpertise(PropertyExpertiseData)

Represents an EXPERTISE parameter, see RFC 6715 2.1.

§

PropertyFbUrl(PropertyFbUrlData)

Represents an FBURL parameter, see RFC 6350 6.9.1.

§

PropertyFn(PropertyFnData)

Represents an FN parameter, see RFC 6350 6.2.1.

§

PropertyGender(PropertyGenderData)

Represents an GENDER parameter, see RFC 6350 6.2.7.

§

PropertyGeo(PropertyGeoData)

Represents an GEO parameter, see RFC 6350 6.5.2.

§

PropertyHobby(PropertyHobbyData)

Represents an HOBBY parameter, see RFC 6715 2.2.

§

PropertyImpp(PropertyImppData)

Represents an IMPP parameter, see RFC 6350 6.4.3.

§

PropertyInterest(PropertyInterestData)

Represents an INTEREST parameter, see RFC 6715 2.3.

§

PropertyKey(PropertyKeyData)

Represents an KEY parameter, see RFC 6350 6.8.1.

§

PropertyKind(PropertyKindData)

Represents an KIND parameter, see RFC 6350 6.1.4.

§

PropertyLang(PropertyLangData)

Represents an LANG parameter, see RFC 6350 6.4.4.

Represents an LOGO parameter, see RFC 6350 6.6.3.

§

PropertyMember(PropertyMemberData)

Represents an MEMBER parameter, see RFC 6350 6.6.5.

§

PropertyNickName(PropertyNickNameData)

Represents an NICKNAME parameter, see RFC 6350 6.2.3.

§

PropertyNote(PropertyNoteData)

Represents an NOTE parameter, see RFC 6350 6.7.2.

§

PropertyN(PropertyNData)

Represents an N parameter, see RFC 6350 6.2.2.

§

PropertyOrgDirectory(PropertyOrgDirectoryData)

Represents an ORG-DIRECTORY parameter, see RFC 6715 2.4.

§

PropertyOrg(PropertyOrgData)

Represents an ORG parameter, see RFC 6350 6.6.4.

§

PropertyPhoto(PropertyPhotoData)

Represents an PHOTO parameter, see RFC 6350 6.2.4.

§

PropertyProdId(PropertyProdIdData)

Represents an PRODID parameter, see RFC 6350 6.7.3.

§

PropertyRelated(PropertyRelatedData)

Represents an RELATED parameter, see RFC 6350 6.6.6.

§

PropertyRev(PropertyRevData)

Represents an REV parameter, see RFC 6350 6.7.4.

§

PropertyRole(PropertyRoleData)

Represents an ROLE parameter, see RFC 6350 6.6.2.

§

PropertySound(PropertySoundData)

Represents an SOUND parameter, see RFC 6350 6.7.5.

§

PropertySource(PropertySourceData)

Represents an SOURCE parameter, see RFC 6350 6.1.3.

§

PropertyTel(PropertyTelData)

Represents an TEL parameter, see RFC 6350 6.4.1.

§

PropertyTitle(PropertyTitleData)

Represents an TITLE parameter, see RFC 6350 6.6.1.

§

PropertyTz(PropertyTzData)

Represents an TZ parameter, see RFC 6350 6.5.1.

§

PropertyUid(PropertyUidData)

Represents an UID parameter, see RFC 6350 6.7.6.

§

PropertyUrl(PropertyUrlData)

Represents an URL parameter, see RFC 6350 6.7.8.

§

PropertyXml(PropertyXmlData)

Represents an XML parameter, see RFC 6350 6.1.5.

§

PropertyXName(PropertyXNameData)

Represents an XNAME parameter, see RFC 6350 3.3.

Implementations§

Source§

impl Property

Source

pub fn create( (property_group, property_name, property_parameters, property_value): (Option<String>, &str, Vec<Parameter>, &str), ) -> Result<Self, VcardError>

Create a new property from required information (group, name, parameters, and value).

§Examples
use vcard_parser::traits::HasValue;
use vcard_parser::vcard::property::Property;
use vcard_parser::vcard::value::Value;
use vcard_parser::vcard::value::Value::ValueText;
use vcard_parser::vcard::value::value_text::ValueTextData;

let mut property = Property::default("FN");
assert_eq!(property.export(), "FN:\n");

property.set_value(Value::from(ValueTextData::from("John Doe"))).expect("Unable to set value.");
assert_eq!(property.export(), "FN:John Doe\n");
Source

pub fn create_from_data( ((group, name), parameters, (value, folds)): PropertyData<'_>, ) -> Result<Self, VcardError>

Source

pub fn create_from_str(str: &str) -> Result<Self, VcardError>

Source

pub fn default(name: &str) -> Self

Create a new property with default values.

§Examples
use vcard_parser::traits::HasValue;
use vcard_parser::vcard::property::Property;
use vcard_parser::vcard::value::Value;
use vcard_parser::vcard::value::Value::ValueText;
use vcard_parser::vcard::value::value_text::ValueTextData;

let mut property = Property::default("FN");
assert_eq!(property.export(), "FN:\n");

property.set_value(Value::from(ValueTextData::from("John Doe"))).expect("Unable to set value.");
assert_eq!(property.export(), "FN:John Doe\n");
Source

pub fn export(&self) -> String

Export a property without any pid information.

§Examples
use vcard_parser::parse::vcard::vcard;
use vcard_parser::vcard::property::Property;

let mut property = Property::try_from("FN;PID=1:John Doe\n").expect("Unable to parse property.");
assert_eq!(property.to_string(), "FN;PID=1:John Doe\n");
assert_eq!(property.export(), "FN:John Doe\n");

Trait Implementations§

Source§

impl Clone for Property

Source§

fn clone(&self) -> Property

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Property

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Property

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HasCardinality for Property

Source§

impl HasGroup for Property

Source§

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

Source§

impl HasName for Property

Source§

fn name(&self) -> &str

Source§

impl HasParameters for Property

Source§

fn allowed_parameters<'a>(&self) -> Vec<&'a str>

Source§

fn get_parameters(&self) -> Vec<Parameter>

Source§

fn set_parameters(&mut self, parameters: Vec<Parameter>)

Source§

fn add_parameters( &mut self, parameters: Vec<Parameter>, ) -> Result<(), VcardError>

Source§

fn add_parameter(&mut self, parameter: Parameter) -> Result<(), VcardError>

Source§

fn remove_parameter(&mut self, index: usize) -> Result<(), VcardError>

Source§

fn has_value_type(&mut self) -> Option<String>

Source§

impl HasValue for Property

Source§

fn get_value(&self) -> &Value

Source§

fn set_value(&mut self, value: Value) -> Result<(), VcardError>

Source§

impl PartialEq for Property

Matches properties based on RFC 6350 7.1.2 and RFC 6350 7.1.3.

Source§

fn eq(&self, other: &Property) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&str> for Property

Source§

type Error = VcardError

The type returned in the event of a conversion error.
Source§

fn try_from(str: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<((Option<&'a [u8]>, &'a [u8]), Vec<(&'a [u8], &'a [u8])>, (&'a [u8], Option<Vec<&'a [u8]>>))> for Property

Source§

type Error = VcardError

The type returned in the event of a conversion error.
Source§

fn try_from(data: PropertyData<'_>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<(Option<String>, &str, Vec<Parameter>, &str)> for Property

Source§

type Error = VcardError

The type returned in the event of a conversion error.
Source§

fn try_from( data: (Option<String>, &str, Vec<Parameter>, &str), ) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.