vcard/tree/value/uri.rs
1//! # URI value codec (RFC 6350 4.2)
2//!
3//! [`VcardCodec`] for a URI value. A URI's comma is literal, not a list
4//! separator, so the whole component is kept (not truncated at `,`).
5
6use crate::{
7 tree::{
8 codec::{VcardCodec, encode::scalar_node, mode::VcardEscaper},
9 value::node::VcardValueNode,
10 },
11 value::uri::VcardUri,
12};
13
14impl<'v> VcardCodec<'v> for VcardUri<'v> {
15 fn decode(node: &'v VcardValueNode<'_>) -> Self {
16 VcardUri(node.decode_joined_at(0))
17 }
18
19 fn encode(&self, escaper: VcardEscaper) -> VcardValueNode<'static> {
20 scalar_node(&self.0, escaper)
21 }
22}