edn-rs
[Experimental] Crate to parse and emit EDN
- This lib does not make effort to conform the EDN received to EDN Spec. The lib that generated this EDN should be responsible for this.
Usage
Cargo.toml
[]
= "0.4.5"
Parse an EDN into a Edn with edn! macro:
extern crate edn_rs;
To navigate through Edn data you can just use get and get_mut:
let edn = edn!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Emits EDN format from a Json file
use emit_edn;
Current Features
- Define
structto map EDN infoEdnNode - Define EDN types,
EdnType - Parse simples EDN data:
- nil
"" - String
"\"string\"" - Numbers
"324352","3442.234","3/4" - Keywords
:a - Symbol
sym-bol-s - Vector
"[1 :2 \"d\"]" - List
"(1 :2 \"d\")" - Set
"#{1 2 3}"For now the usage of Set is defined as aVec<Edn>, this is due to the fact that the lib should not be necessarily responsible for assuring the Set's unicity. A solution could be changing the implementation toHashSet. - Map
"{:a 1 :b 2 }"
- nil
- Simple data structures in one another:
- Vec in Vec
"[1 2 [:3 \"4\"]]" - Set in Vec
"[1 2 #{:3 \"4\"}]" - List in List
"(1 2 (:3 \"4\"))" - List in Set
"'#{1 2 (:3 \"4\")}" - Maps in general
"{:a 2 :b {:3 \"4\"}}","{:a 2 :b [:3 \"4\"]}"
- Vec in Vec
- Multiple simple data structures in one another (Map and Set in a vector)
- Multi deepen data structures (Map in a Set in a List in a Vec in a Vec)
- Navigate through Edn Data
- Json to Edn
- Json String to EDN String
- macro to process Structs and Enums to EDN
- Edn to Json