pub fn read(edn: &str) -> Result<(Edn<'_>, &str), Error>Expand description
Reads the first object from the &str and the remaining unread &str.
§Errors
Default behavior of Clojure’s read is to throw an error on EOF, unlike read_string.
https://clojure.github.io/tools.reader/#clojure.tools.reader.edn/read
See crate::error::Error.
Examples found in repository?
examples/read_quotes.rs (line 30)
29 30 31 32 33 34 35 36 37 38 39 40
fn quotify(s: &str) -> Edn<'_> {
let (edn, rest) = edn::read(s).unwrap();
let edn = if edn == Edn::Symbol("'") {
Edn::List(vec![Edn::Symbol("quote"), edn::read_string(rest).unwrap()])
} else {
edn
};
let edn = wrap_quote(edn);
edn
}