Skip to content

Commit 44db49f

Browse files
committed
Update readme and upgrade docs
1 parent 534f441 commit 44db49f

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ versions.
1717
- `Env::is_process_alive` and `LocalPid::is_alive` (#599)
1818
- Encoding and decoding of 128 bit integers (#600)
1919
- Optional codec for `num_bigint::BigInt` using the `big_integer` feature (#601)
20+
- Add experimental `serde` support derived from `serde_rustler`
2021

2122
### Fixed
2223

README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,34 @@ they unwind into C.
1616
The library provides functionality for both Erlang and Elixir, however Elixir
1717
is favored as of now.
1818

19-
#### Features:
19+
#### Features
2020

21-
- Safety - The code you write in a Rust NIF should never be able to crash the BEAM.
22-
- Interop - Decoding and encoding rust values into Erlang terms is as easy as a function call.
23-
- Type composition - Making a Rust struct encodable and decodable to Erlang or Elixir can be done with a single attribute.
24-
- Resource objects - Enables you to safely pass a reference to a Rust struct into Erlang code. The struct will be automatically dropped when it's no longer referenced.
21+
Safety
22+
: The code you write in a Rust NIF should never be able to crash the BEAM.
2523

26-
#### Getting started
24+
Interop
25+
: Decoding and encoding rust values into Erlang terms is as easy as a function
26+
: call.
27+
28+
Type composition
29+
: Making a Rust struct encodable and decodable to Erlang or Elixir can be done
30+
: with a single attribute.
2731

28-
The easiest way of getting started is the [rustler elixir library](https://hex.pm/packages/rustler).
32+
Resource objects
33+
: Enables you to safely pass a reference to a Rust struct into Erlang code. The
34+
: struct will be automatically dropped when it's no longer referenced.
35+
36+
#### Getting started
2937

30-
- Add the [rustler elixir library](https://hex.pm/packages/rustler) as a dependency of your project.
31-
- Run `mix rustler.new` to generate a new NIF in your project. Follow the instructions.
32-
- If you're already using [`serde`](https://serde.rs), consider using [`serde_rustler`](https://github.com/sunny-g/serde_rustler/tree/master/serde_rustler) to easily encode and decode your data types into and from Elixir terms.
38+
The easiest way of getting started is the [rustler Elixir library](https://hex.pm/packages/rustler).
3339

34-
NOTE: If you have previously used Rustler, you need to run `mix archive.uninstall rustler_installer.ez` to remove it before generating the NIF.
40+
- Add the [rustler Elixir library](https://hex.pm/packages/rustler) as a
41+
dependency of your project.
42+
- Run `mix rustler.new` to generate a new NIF in your project. Follow the
43+
instructions.
44+
- If you are already using [`serde`](https://serde.rs) and/or have been using
45+
`serde_rustler` before, please enable the `serde` feature in your NIF crate's
46+
`Cargo.toml` on the `rustler` dependency.
3547

3648
#### What it looks like
3749

@@ -58,9 +70,9 @@ Rustler aims to support the newest three major OTP versions as well as newest th
5870
#### Supported NIF version
5971

6072
The minimal supported NIF version for a library should be defined via Cargo
61-
features. The default is currently `2.14` (Erlang/OTP 21). To use features from
62-
NIF version `2.16` (Erlang/OTP 24), the respective feature flag has to be
63-
enabled on the dependency:
73+
features. The default is currently `2.15` (Erlang/OTP 21). To use features from
74+
NIF version `2.16` (Erlang/OTP 24) or `2.17` (Erlang/OTP 26), the respective
75+
feature flag has to be enabled on the dependency:
6476

6577
```toml
6678
[dependencies]
@@ -84,5 +96,5 @@ at your option.
8496
##### Contribution
8597

8698
Unless you explicitly state otherwise, any contribution intentionally submitted
87-
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
88-
additional terms or conditions.
99+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
100+
dual licensed as above, without any additional terms or conditions.

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ This document is intended to simplify upgrading to newer versions by extending t
1111
wrapper. For most codebases, it will be enough to activate the feature and
1212
replace all `rustler_bigint::BigInt` usages by `rustler::BigInt` (or
1313
`num_bigint::BigInt`).
14+
2. `serde_rustler` has been integrated into `rustler` behind the feature flag
15+
`serde`. Arbitrary, `serde`-compatible objects (i.e. with `Deserialize` or
16+
`Serialize` `impl`s) can be wrapped in `SerdeTerm` to use them in place of
17+
`Encoder` or `Decoder`.
1418

1519
## 0.29 -> 0.30
1620

0 commit comments

Comments
 (0)