A simple library for serializing (and deserializing coming soon) resources following the HAL Spec
Add the dependency to your Cargo.toml:
```toml
[dependencies] rustichal="0.1" serde="1.0" serdejson="1.0" serde_derive="1.0"
``` and to use:
```rust
extern crate rustic_hal; extern crate serde;
extern crate serdederive; extern crate serdejson;
use rustichal::*; use serdejson::to_string;
pub struct MyResource { pub test: String, }
fn main() { let mr = MyResource { test: "Hello, World!".tostring(), }; let mut halres = HalResource::new(mr); halres.withlink("self", "/api/myresource/0");
println!("json representation: {:?}", to_string(&hal_res));
}
```
see https://pduval.github.io/rustichal/rustichal/ for the cargo-doc pages.
This library is heavily inspired by (read copied from) the hal-rs library by Herman J. Radtke III.
I have only very recently started learning Rust, so the idiomatic quality of this code is probably very low.