79 releases

new 0.6.14 May 10, 2025
0.6.13 Jan 5, 2025
0.6.12 Nov 22, 2024
0.6.11 Jun 26, 2024
0.1.5 Jul 24, 2021

#537 in Data structures

Download history 7/week @ 2025-01-20 4/week @ 2025-01-27 65/week @ 2025-02-03 198/week @ 2025-02-10 120/week @ 2025-02-17 39/week @ 2025-02-24 32/week @ 2025-03-03 21/week @ 2025-03-10 5/week @ 2025-03-17 8/week @ 2025-03-24 2/week @ 2025-03-31 6/week @ 2025-04-07 17/week @ 2025-04-14 16/week @ 2025-04-21 13/week @ 2025-04-28 56/week @ 2025-05-05

102 downloads per month
Used in 2 crates

MIT license

50KB
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

atom, which translates to a reference to a value:

atom 1

License

MIT

Dependencies

~1.5MB
~17K SLoC