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 (its escaper carries the mode),
encode writes it back, escaping every leaf with the given Escaper and
stamping it on the node. The escaper is symmetric across the two directions:
decode reads it off the incoming node, encode receives the target mode and
applies it (the decoded value itself is escaper-agnostic clean text).
Required Methods§
Sourcefn decode(node: &'v IcalValueNode<'_>) -> Self
fn decode(node: &'v IcalValueNode<'_>) -> Self
Decode the value from a syntax node.
Sourcefn encode(&self, escaper: Escaper) -> IcalValueNode<'static>
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".