rustic_hal/lib.rs
1//! # Rustic Hal
2//!
3//! A simple library for serializing (and deserializing coming soon) resources following the [HAL Spec](https://tools.ietf.org/html/draft-kelly-json-hal-08)
4//!
5//! ## Usage
6//!
7//! Add the dependency to your Cargo.toml:
8//!
9//! ```toml
10//!
11//! [dependencies]
12//! rustic_hal="0.2.0"
13//! serde="1.0"
14//! serde_json="1.0"
15//! serde_derive="1.0"
16//!
17//! ```
18//! and to use:
19//!
20//! ```rust
21//! extern crate rustic_hal;
22//! extern crate serde_json;
23//! extern crate serde;
24//! #[macro_use] extern crate serde_derive;
25//!
26//! use rustic_hal::*;
27//! use serde::Serialize;
28//! use serde_json::to_string;
29//!
30//! #[derive(Serialize)]
31//! pub struct MyResource {
32//! pub test: String
33//! }
34//!
35//! # fn main() {
36//! let mr = MyResource { test: "Hello, World!".to_string() };
37//! let hal_res = HalResource::new(mr).with_link("self", "/api/myresource/0");
38//!
39//! println!("json representation: {}", to_string(&hal_res).unwrap());
40//!
41//! # }
42//! ```
43//!
44//! ## Credits
45//!
46//! This library is heavily inspired by the [hal-rs](https://github.com/hjr3/hal-rs) library by Herman J. Radtke III.
47//!
48
49extern crate serde;
50extern crate serde_json;
51#[macro_use]
52extern crate serde_derive;
53
54pub mod error;
55pub mod link;
56pub mod resource;
57
58pub use self::error::{HalError, HalResult};
59pub use self::link::HalLink;
60pub use self::resource::HalResource;
61
62#[cfg(test)]
63mod tests;