#clojure #edn #no-std

no-std clojure-reader

A Clojure reader

4 releases (2 breaking)

new 0.3.0 Dec 3, 2024
0.2.0 Nov 3, 2024
0.1.1 Jul 30, 2024
0.1.0 Jun 18, 2024

#3 in #clojure

Download history 13/week @ 2024-09-23 1/week @ 2024-10-07 7/week @ 2024-10-14 50/week @ 2024-10-28 117/week @ 2024-11-04 3/week @ 2024-11-11 10/week @ 2024-11-18 38/week @ 2024-11-25

218 downloads per month

Zlib license

56KB
1.5K SLoC

Rust 1.5K SLoC // 0.0% comments Clojure 156 SLoC // 0.0% comments Edn 50 SLoC Java 8 SLoC

clojure-reader

Coverage Status

A crate to read Clojure.

EDN (Extensible Data Notation)

MSRV (minimal supported rust version)

Stable minus 2 versions. Once stable (1.0.0), the plan is to indefinitely maintain the MSRV.

Default Features

The following features are enabled by default. To disable use this crate without default features.

std

When using no_std, this crate relies on alloc. You must supply your own #[global_allocator].

floats

Pulls in the dependency ordered-float for Edn::Double. Without this feature, parsing floating-point numbers will result in an Err.

Optional Features

The following features are not enabled by default. To enable them all, use with

 clojure-reader  = { features = ["full"] }

derive

Enables implementation for serde's Serialize and Deserialize traits for convenient to/from rust structures.

See serde example for tips/tricks (eg you'll probably want kebab-case).

Note that EDN is more generic than rust, so this feature will silently pass over things that rust and serde cannot handle. For example

{:foo 42, 42 "bar"}

will pass over the k/v pair (42 "bar") and transform :foo to foo.

If you need complete control, it is recommended to use the base read and read_string. See get-nth example for clojure-like navigation.

arbitrary-nums

Enables parsing of arbitrary length/precision Ints and Decimals. Relies on bigdecimal and num-bigint crates.

no_std

See the pico example for a minimalistic example of using this crate with the raspberry pi pico (rp2040)

Dependencies

~0–430KB