2 releases
0.1.1 | Mar 9, 2020 |
---|---|
0.1.0 | Feb 23, 2020 |
#12 in #clojure
45KB
1.5K
SLoC
serde_clj
Convert Rust data structures to/from (relatively) idiomatic Clojure data in memory using JNI.
See test/src/lib.rs for a usage example.
Example
#[derive(Serialize)]
struct MyStruct {
number: i32,
names: Vec<String>
}
becomes
{:number 3
:names ["foo" "bar"]}
Notes/TODO
- Unsigned integers serialize to the 'next biggest' type (except u64, which becomes i64), since Java doesn't really support unsigned.
- TODO: convert to/from BigInt where necessary.
- If you want to serialize a
Vec<u8>
, you should annotate or wrap the field with serde_bytes, or you will end up with a vector ofjava.lang.Short
, which might not be what you wanted and isn't very efficient. - More extensive tests.
lib.rs
:
serde_clj
Convert Rust data structures to/from (relatively) idiomatic Clojure data in memory using JNI.
See test/src/lib.rs for a usage example.
Example
#[derive(Serialize)]
struct MyStruct {
number: i32,
names: Vec<String>
}
becomes
{:number 3
:names ["foo" "bar"]}
Dependencies
~1.5–2.6MB
~42K SLoC