Rustic Hal

A simple library for serializing (and deserializing coming soon) resources following the HAL Spec

Clippy Linting Result Build Status

Usage

On nightly rust

Add the dependency to your Cargo.toml:

```toml

[dependencies] rustichal="0.1.0" serde="1.0" serdejson="1.0" serde_derive="1.0"

``` and to use:

```rust

extern crate rustic_hal; extern crate serde;

[macrouse] extern crate serdederive;

extern crate serde_json;

use rustichal::*; use serde::Serialize; use serdejson::to_json;

[derive(Serialize)]

pub struct MyResource { pub test: String; }

let mr = MyResource { test: "Hello, World!".tostring() }; let mut halres = HalResource::new(mr); halres.addlink("self", "/api/myresource/0");

println!("json representation: {}", tojson(halres));

```

Documentation

see https://pduval.github.io/rustichal/rustichal/ for the cargo-doc pages.

Credits

This library is heavily inspired by (read copied from) the hal-rs library by Herman J. Radtke III.

Warnings

I have only very recently started learning Rust, so the idiomatic quality of this code is probably very low.