Expand description
Derive macros for pack-abi Value conversion.
This crate provides #[derive(GraphValue)] which generates implementations
of From<T> for Value and TryFrom<Value> for T.
§Example
ⓘ
use packr_abi::{GraphValue, Value};
#[derive(GraphValue)]
struct Point {
x: i64,
y: i64,
}
let point = Point { x: 10, y: 20 };
let value: Value = point.into();
let back: Point = value.try_into().unwrap();§Crate Path
By default, the macro expects packr_abi to be in scope. For no_std guests
using packr_guest, specify the crate path:
ⓘ
use packr_guest::GraphValue;
#[derive(GraphValue)]
#[graph(crate = "packr_guest::composite_abi")]
struct MyState {
count: i32,
}Derive Macros§
- Graph
Value - Derive macro for converting between Rust types and
Value.