Skip to main content

IcalValueNode

Struct IcalValueNode 

Source
pub struct IcalValueNode<'a> {
    pub escaper: Escaper,
    /* private fields */
}
Available on crate feature parser only.
Expand description

A raw value: ;-separated components, each a list of ,-separated raw value leaves.

From parse the value is held as one unsplit raw slice and walked lazily, so a parse that never decodes and a byte-faithful reserialize do no splitting at all. The first edit (or a model encode) splits it into owned components, which then take over as the source of truth. The escaper records which version’s escaping rules the codec must apply; it is stamped from the calendar version after parsing (see IcalCst::parse).

Fields§

§escaper: Escaper

The escaping rules to read and write this value with.

Implementations§

Source§

impl<'a> IcalValueNode<'a>

Source

pub fn parse(value: &'a [u8]) -> Self

Wrap a raw value, unsplit and borrowed, to be walked lazily. The colon, name and eol are the line’s business; this is only the bytes after the colon.

Source

pub fn component_count(&self) -> usize

The number of ;-separated components (at least one, since an empty value is one empty component).

Source

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

Decode the ith component into a clean (unescaped) value list.

Source

pub fn decode_bytes_at(&self, i: usize) -> Cow<'_, [u8]>

The ith component’s first value as raw unescaped bytes, not transcoded, for a value carrying a foreign charset.

Source

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

Decode the ith component’s first value (empty when there is none).

Source

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

Decode the ith component as a single value, keeping its ,-separated pieces joined. For values like URIs whose comma is a literal part of the value, not a list separator (so they must not be truncated).

Source

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

Set the ith component, escaping each value. Pads with empty components when needed; every other component is left untouched, so a parsed calendar keeps its bytes.

Source

pub fn set_bytes_at<B: AsRef<[u8]>>(&mut self, i: usize, values: &[B])

Set the ith component from raw value bytes (the foreign-charset escape hatch), escaping structural separators but writing the bytes verbatim.

Trait Implementations§

Source§

impl<'a> Clone for IcalValueNode<'a>

Source§

fn clone(&self) -> IcalValueNode<'a>

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<'a> Debug for IcalValueNode<'a>

Source§

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

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

impl<'a> Default for IcalValueNode<'a>

Source§

fn default() -> IcalValueNode<'a>

Returns the “default value” for a type. Read more
Source§

impl Display for IcalValueNode<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for IcalValueNode<'a>

§

impl<'a> RefUnwindSafe for IcalValueNode<'a>

§

impl<'a> Send for IcalValueNode<'a>

§

impl<'a> Sync for IcalValueNode<'a>

§

impl<'a> Unpin for IcalValueNode<'a>

§

impl<'a> UnsafeUnpin for IcalValueNode<'a>

§

impl<'a> UnwindSafe for IcalValueNode<'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> 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.