75 releases

new 0.6.10 Jun 3, 2024
0.6.3 Feb 25, 2024
0.5.0 Sep 2, 2023
0.4.0 May 26, 2023
0.1.5 Jul 24, 2021

#361 in Parser implementations

Download history 156/week @ 2024-02-14 348/week @ 2024-02-21 105/week @ 2024-02-28 51/week @ 2024-03-06 51/week @ 2024-03-13 30/week @ 2024-03-20 36/week @ 2024-03-27 62/week @ 2024-04-03 16/week @ 2024-04-10 29/week @ 2024-04-17 46/week @ 2024-04-24 10/week @ 2024-05-01 13/week @ 2024-05-08 987/week @ 2024-05-15 228/week @ 2024-05-22 167/week @ 2024-05-29

1,396 downloads per month
Used in 2 crates

MIT license

48KB
1.5K SLoC

Cirru Edn in Rust

Extensible data notations based on Cirru syntax

Usages

Rust Docs.

cargo add cirru_edn
use cirru_edn::Edn;

cirru_edn::parse("[] 1 2 true"); // Result<Edn, String>

cirru_edn::format(data, /* use_inline */ true); // Result<String, String>.

EDN Format

mixed data:

{} (:a 1.0)
  :b $ [] 2.0 3.0 4.0
  :c $ {} (:d 4.0)
    :e true
    :f :g
    :h $ {} (|a 1.0)
      |b true
{}
  :b $ [] 2 3 4
  :a 1
  :c $ {}
    :h $ {} (|b true) (|a 1)
    :f :g
    :e true
    :d 4

for top-level literals, need to use do expression:

do nil
do true
do false
do 1
do -1.1

quoted code:

do 'a
quote (a b)

tags(previously called "keyword")

do :a

string syntax, note it's using prefixed syntax of |:

do |a

string with special characters:

do \"|a b\"

nested list:

[] 1 2 $ [] 3
#{} ([] 3) 1

tuple, or tagged union, actually very limitted due to Calcit semantics:

:: :a

:: :b 1

extra values can be added to tuple since 0.3:

:: :a 1 |extra :l

a record, notice that now it's all using tags:

%{} :Demo (:a 1)
  :b 2
  :c $ [] 1 2 3

extra format for holding buffer, which is internally Vec<u8>:

buf 00 01 f1 11

License

MIT

Dependencies

~320KB