Skip to main content

ical/tree/value/
uri.rs

1//! # URI value codec (RFC 5545 3.3.13)
2//!
3//! [`Codec`] for the URI value. RFC 5545 section 3.3.13 gives a URI no
4//! escaping and no structure, so its `;` and `,` are part of the reference:
5//! the whole value is read, and written back exactly as it is held.
6
7use crate::{
8    tree::{
9        codec::{Codec, encode::verbatim_node, mode::Escaper},
10        value::node::IcalValueNode,
11    },
12    value::uri::IcalUri,
13};
14
15impl<'v> Codec<'v> for IcalUri<'v> {
16    fn decode(node: &'v IcalValueNode<'_>) -> Self {
17        IcalUri(node.decode())
18    }
19
20    fn encode(&self, escaper: Escaper) -> IcalValueNode<'static> {
21        verbatim_node(&self.0, escaper)
22    }
23}