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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use Serialize;
use print;
use crateResult;
use crateto_value;
use io;
/// Serialize an instance of type `T` into an S-expression string, using the
/// default printer options.
///
/// ```
/// use serde_lexpr::to_string;
///
/// assert_eq!(to_string(&("foo", 1)).unwrap(), r#"#("foo" 1)"#.to_string())
/// ```
/// Serialize an instance of type `T` into an S-expression string.
///
/// ```
/// use serde_lexpr::{print, to_string_custom};
///
/// assert_eq!(to_string_custom(&("foo", 1), print::Options::elisp()).unwrap(), r#"["foo" 1]"#.to_string())
/// ```
/// Serialize an instance of type `T` into an S-expression byte vector, using the
/// default printer options.
///
/// ```
/// use serde_lexpr::to_vec;
///
/// let expected: Vec<u8> = r#"#("foo" 1)"#.into();
/// assert_eq!(to_vec(&("foo", 1)).unwrap(), expected);
/// ```
/// Serialize an instance of type `T` into an S-expression byte vector.
///
/// ```
/// use serde_lexpr::{print, to_vec_custom};
///
/// let expected: Vec<u8> = r#"["foo" 1]"#.into();
/// assert_eq!(to_vec_custom(&("foo", 1), print::Options::elisp()).unwrap(), expected);
/// ```
/// Serialize an instance of type `T` into an S-expression byte vector, using the
/// default printer options.
///
/// ```
/// use serde_lexpr::to_writer;
///
/// let mut output = Vec::new();
/// to_writer(&mut output, &("foo", 1)).unwrap();
/// assert_eq!(output, r#"#("foo" 1)"#.as_bytes());
/// ```
/// Serialize an instance of type `T` into an S-expression byte vector.
///
/// ```
/// use serde_lexpr::{print, to_writer_custom};
///
/// let mut output = Vec::new();
/// to_writer_custom(&mut output, &("foo", 1), print::Options::elisp()).unwrap();
/// assert_eq!(output, r#"["foo" 1]"#.as_bytes());
/// ```