pub trait VcardCodec<'v>: Sized {
// Required methods
fn decode(node: &'v VcardValueNode<'_>) -> Self;
fn encode(&self, escaper: VcardEscaper) -> VcardValueNode<'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 VcardEscaper
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 VcardValueNode<'_>) -> Self
fn decode(node: &'v VcardValueNode<'_>) -> Self
Decode the value from a syntax node.
Sourcefn encode(&self, escaper: VcardEscaper) -> VcardValueNode<'static>
fn encode(&self, escaper: VcardEscaper) -> VcardValueNode<'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".