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§
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".