vcard-rs 0.2.1

vCard parser, validator, editor and builder library for Rust
Documentation
//! # URI value
//!
//! The decoded URI value kind.
//!
//! Backs every RFC 6350 property whose value is a URI (RFC 6350 4.2): `SOURCE`,
//! `PHOTO`, `IMPP`, `LOGO`, `MEMBER`, `RELATED`, `SOUND`, `UID`, `KEY`, `GEO`,
//! `URL`, `FBURL`, `CALADRURI`, `CALURI`. The reference is kept verbatim as a
//! string; the crate does not parse or validate it.

use alloc::{borrow::Cow, string::String};

/// A decoded URI value, kept verbatim.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct VcardUri<'a>(pub Cow<'a, str>);

impl<'a> From<&'a str> for VcardUri<'a> {
    fn from(value: &'a str) -> Self {
        Self(Cow::Borrowed(value))
    }
}

impl From<String> for VcardUri<'_> {
    fn from(value: String) -> Self {
        Self(Cow::Owned(value))
    }
}

impl<'a> From<Cow<'a, str>> for VcardUri<'a> {
    fn from(value: Cow<'a, str>) -> Self {
        Self(value)
    }
}