edn-rs
Near Stable
- 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. For more information on Edn Spec please visit: https://github.com/edn-format/edn.
- Current example usage in crate https://crates.io/crates/transistor
Usage
Cargo.toml
[]
= "0.9.1"
Parse an EDN token into a Edn
with edn!
macro:
use ;
Parse an EDN String with parse_edn
:
use ;
use FromStr;
To navigate through Edn
data you can just use get
and get_mut
:
use ;
Serializes Rust Types into EDN
use ;
use ;
Emits EDN format from a Json file
use json_to_edn;
Current Features
- Define
struct
to map EDN infoEdnNode
- Define EDN types,
EdnType
- Edn Type into primitive:
Edn::Bool(true).into() -> true
- Parse EDN data
parse_edn
:- 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}"
- Map
"{:a 1 :b 2 }"
- Nested structures
"{:a \"2\" :b [true false] :c #{:A {:a :b} nil}}"
- nil
- Simple data structures in one another
edn!
:- 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
- Navigate through Sets
- Json to Edn
- Json String to EDN String
- macro to process Structs and Enums to EDN
- trait Deserialize EDN to Struct
- trait Serialize struct to EDN
Could be done in another project edn-derive
-
derive Serialize
-
derive Deserialize