Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dlesl/serde_clj
Convert Rust data to idiomatic Clojure data using JNI
https://github.com/dlesl/serde_clj
clojure jni rust serde
Last synced: 2 months ago
JSON representation
Convert Rust data to idiomatic Clojure data using JNI
- Host: GitHub
- URL: https://github.com/dlesl/serde_clj
- Owner: dlesl
- License: mit
- Created: 2020-02-22T13:32:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T22:36:15.000Z (almost 4 years ago)
- Last Synced: 2024-10-08T15:19:34.208Z (3 months ago)
- Topics: clojure, jni, rust, serde
- Language: Rust
- Homepage:
- Size: 659 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serde_clj
Convert Rust data structures to/from (relatively) idiomatic Clojure data
in memory using JNI.See [test/src/lib.rs](test/src/lib.rs) for a usage example.
## Example
```rust
#[derive(Serialize)]
struct MyStruct {
number: i32,
names: Vec
}
```
becomes
```clojure
{: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`, you should annotate or wrap
the field with [serde_bytes](https://crates.io/crates/serde_bytes),
or you will end up with a vector of `java.lang.Short`, which might
not be what you wanted and isn't very efficient.
* More extensive tests.