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