1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use super::cons::Cons;
use super::element::Element;
use std::rc::Rc;
pub trait Quoted<'el> {
fn quoted<C>(self) -> Element<'el, C>;
}
impl<'el> Quoted<'el> for String {
fn quoted<C>(self) -> Element<'el, C> {
Element::Quoted(Cons::Rc(Rc::new(self)))
}
}
impl<'el> Quoted<'el> for &'el str {
fn quoted<C>(self) -> Element<'el, C> {
Element::Quoted(Cons::Borrowed(self))
}
}
impl<'el> Quoted<'el> for Rc<String> {
fn quoted<C>(self) -> Element<'el, C> {
Element::Quoted(Cons::Rc(self))
}
}
impl<'el> Quoted<'el> for Cons<'el> {
fn quoted<C>(self) -> Element<'el, C> {
Element::Quoted(self)
}
}