Skip to main content

Codec

Trait Codec 

Source
pub trait Codec<'v>: Sized {
    // Required methods
    fn decode(node: &'v IcalValueNode<'_>) -> Self;
    fn encode(&self, escaper: Escaper) -> IcalValueNode<'static>;
}
Available on crate feature parser only.
Expand description

How a decoded value type projects to and from a syntax node.

decode reads it from a node, whose escaper carries the mode, and encode writes it back, escaping every leaf with the target Escaper and stamping it on the node. The two stay symmetric, the decoded value itself being escaper-agnostic clean text.

Required Methods§

Source

fn decode(node: &'v IcalValueNode<'_>) -> Self

Decode the value from a syntax node.

Source

fn encode(&self, escaper: Escaper) -> IcalValueNode<'static>

Encode the value into a syntax node for the given escaping mode.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'v> Codec<'v> for IcalBinary<'v>

Source§

impl<'v> Codec<'v> for IcalBoolean<'v>

Source§

impl<'v> Codec<'v> for IcalCalAddress<'v>

Source§

impl<'v> Codec<'v> for IcalDate<'v>

Source§

impl<'v> Codec<'v> for IcalDateTime<'v>

Source§

impl<'v> Codec<'v> for IcalDateTimeList<'v>

Source§

impl<'v> Codec<'v> for IcalDuration<'v>

Source§

impl<'v> Codec<'v> for IcalFloat<'v>

Source§

impl<'v> Codec<'v> for IcalGeo<'v>

Source§

impl<'v> Codec<'v> for IcalInteger<'v>

Source§

impl<'v> Codec<'v> for IcalPeriod<'v>

Source§

impl<'v> Codec<'v> for IcalRecur<'v>

Source§

impl<'v> Codec<'v> for IcalRequestStatus<'v>

Source§

impl<'v> Codec<'v> for IcalText<'v>

Source§

impl<'v> Codec<'v> for IcalTextList<'v>

Source§

impl<'v> Codec<'v> for IcalTime<'v>

Source§

impl<'v> Codec<'v> for IcalUnknownValue<'v>

Source§

impl<'v> Codec<'v> for IcalUri<'v>

Source§

impl<'v> Codec<'v> for IcalUtcOffset<'v>

Source§

impl<'v> Codec<'v> for IcalValue<'v>