Expose derive macro behind feature
This commit is contained in:
@@ -89,15 +89,14 @@ This matches the runtime model used for Decodal source-defined schema objects.
|
||||
|
||||
## Typed Rust integration
|
||||
|
||||
Hosts can use `decodal-derive` to keep a Rust struct, the Decodal schema, and the decoded result in sync.
|
||||
Hosts can enable the `derive` feature on `decodal` to keep a Rust struct, the Decodal schema, and the decoded result in sync.
|
||||
The derive implements two traits from the `decodal` crate:
|
||||
|
||||
- `DecodalSchema`: builds a `HostValue` schema that can be passed to `Engine::bind_global`.
|
||||
- `DecodalDecode`: decodes materialized `Data` back into the Rust type.
|
||||
|
||||
```rust
|
||||
use decodal::{DecodalDecode, DecodalSchema, EmptyLoader, Engine};
|
||||
use decodal_derive::Decodal;
|
||||
use decodal::{Decodal, DecodalDecode, DecodalSchema, EmptyLoader, Engine};
|
||||
|
||||
#[derive(Decodal)]
|
||||
struct Service {
|
||||
|
||||
@@ -28,8 +28,8 @@ Workspace support crates such as `decodal-cli` and `decodal-wasm` are not publis
|
||||
The project is dual licensed as `MIT OR Apache-2.0`.
|
||||
|
||||
```sh
|
||||
cargo publish -p decodal
|
||||
cargo publish -p decodal-derive
|
||||
cargo publish -p decodal
|
||||
```
|
||||
|
||||
Before publishing, run:
|
||||
@@ -38,8 +38,8 @@ Before publishing, run:
|
||||
cargo fmt --check
|
||||
cargo test
|
||||
cargo check -p decodal --no-default-features
|
||||
cargo publish -p decodal --dry-run
|
||||
cargo publish -p decodal-derive --dry-run
|
||||
cargo publish -p decodal --dry-run
|
||||
```
|
||||
|
||||
## Web site and playground
|
||||
|
||||
Reference in New Issue
Block a user