Skip to main content

IcalValueCursor

Struct IcalValueCursor 

Source
pub struct IcalValueCursor<'c, 'a> {
    pub line: &'c mut IcalLine<'a>,
}
Available on crate feature parser only.
Expand description

A typed cursor over a content line’s value, editing in place and byte preserving for the components it does not touch.

Fields§

§line: &'c mut IcalLine<'a>

The borrowed content line.

Implementations§

Source§

impl IcalValueCursor<'_, '_>

Source

pub fn text(&self) -> Cow<'_, str>

The whole value as a single decoded text, its ; and , kept literal.

Source

pub fn set_text(&mut self, value: impl AsRef<str>)

Set the whole value to a single text, escaping it. Writes UTF-8; to keep a foreign charset, transcode yourself and use set_bytes.

Source

pub fn bytes(&self) -> Cow<'_, [u8]>

The whole value’s raw bytes, unescaped but not otherwise decoded.

Neither transcoded nor transfer-decoded, for a value carrying a foreign charset. To resolve QUOTED-PRINTABLE or a CHARSET, use the quoted_printable / charset feature helpers.

Source

pub fn set_bytes(&mut self, value: impl AsRef<[u8]>)

Set the whole value to raw bytes (the foreign-charset escape hatch), escaping structural separators but writing the bytes verbatim. The calendar’s CHARSET parameter is left untouched: it is the caller’s to keep consistent.

Source

pub fn quoted_printable(&self) -> Vec<u8>

Available on crate feature quoted-printable only.

Decode the value’s QUOTED-PRINTABLE =XX octets to raw bytes.

Only when the line declares that encoding, else the raw bytes. Still in the value’s own (possibly foreign) charset; pair with charset to get text. Requires the quoted-printable feature.

Source

pub fn charset(&self) -> String

Available on crate feature encoding only.

Transcode the value to text using its CHARSET parameter (defaulting to UTF-8 when absent or unrecognised). When the quoted-printable feature is also on, QUOTED-PRINTABLE octets are resolved first. Requires the encoding feature.

Source

pub fn list(&self) -> Vec<Cow<'_, str>>

The whole value as a decoded list (its ,-separated values), its ; kept literal.

Source

pub fn set_list<S: AsRef<str>>(&mut self, values: &[S])

Set the whole value to a list, escaping each value.

Source

pub fn component(&self, i: usize) -> Vec<Cow<'_, str>>

The ith component as a decoded list, for structured values.

Source

pub fn set_component<S: AsRef<str>>(&mut self, i: usize, values: &[S])

Set the ith component, escaping each value and preserving the rest.

Source

pub fn param<P: IcalParamLens>(&self) -> Option<P::Target<'_>>

The first parameter of type P on this line, decoded.

Auto Trait Implementations§

§

impl<'c, 'a> !UnwindSafe for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> Freeze for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> RefUnwindSafe for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> Send for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> Sync for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> Unpin for IcalValueCursor<'c, 'a>

§

impl<'c, 'a> UnsafeUnpin for IcalValueCursor<'c, 'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.