diff --git a/src/enc/mod.rs b/src/enc/mod.rs index d299d0e..dd963b9 100644 --- a/src/enc/mod.rs +++ b/src/enc/mod.rs @@ -1,4 +1,21 @@ //! Functions to generate nettext representations of data structures +//! +//! Example: +//! +//! ``` +//! use nettext::enc::*; +//! +//! let nettext_encoding = list([ +//! string("CALL").unwrap(), +//! string("myfunction").unwrap(), +//! dict([ +//! ("a", string("hello").unwrap()), +//! ("b", string("world").unwrap()), +//! ("c", raw(b"{ a = 12, b = 42 }").unwrap()), +//! ("d", bytes_split(&((0..128u8).collect::>()))), +//! ]), +//! ]).unwrap().encode(); +//! ``` use std::collections::HashMap;