pub struct IcalValueCursor<'c, 'a> {
pub line: &'c mut IcalLine<'a>,
}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<'_, '_>
impl IcalValueCursor<'_, '_>
Sourcepub fn text(&self) -> Cow<'_, str>
pub fn text(&self) -> Cow<'_, str>
The whole value as a single decoded text, its ; and , kept literal.
Sourcepub fn set_text(&mut self, value: impl AsRef<str>)
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.
Sourcepub fn bytes(&self) -> Cow<'_, [u8]>
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.
Sourcepub fn set_bytes(&mut self, value: impl AsRef<[u8]>)
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.
Sourcepub fn quoted_printable(&self) -> Vec<u8> ⓘ
Available on crate feature quoted-printable only.
pub fn quoted_printable(&self) -> Vec<u8> ⓘ
quoted-printable only.Sourcepub fn charset(&self) -> String
Available on crate feature encoding only.
pub fn charset(&self) -> String
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.
Sourcepub fn list(&self) -> Vec<Cow<'_, str>>
pub fn list(&self) -> Vec<Cow<'_, str>>
The whole value as a decoded list (its ,-separated values), its ;
kept literal.
Sourcepub fn set_list<S: AsRef<str>>(&mut self, values: &[S])
pub fn set_list<S: AsRef<str>>(&mut self, values: &[S])
Set the whole value to a list, escaping each value.
Sourcepub fn component(&self, i: usize) -> Vec<Cow<'_, str>>
pub fn component(&self, i: usize) -> Vec<Cow<'_, str>>
The ith component as a decoded list, for structured values.
Sourcepub fn set_component<S: AsRef<str>>(&mut self, i: usize, values: &[S])
pub fn set_component<S: AsRef<str>>(&mut self, i: usize, values: &[S])
Set the ith component, escaping each value and preserving the rest.
Sourcepub fn param<P: IcalParamLens>(&self) -> Option<P::Target<'_>>
pub fn param<P: IcalParamLens>(&self) -> Option<P::Target<'_>>
The first parameter of type P on this line, decoded.