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

extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;

pub mod error;
pub mod link;
pub mod resource;

pub use self::error::{HalError, HalResult};
pub use self::link::HalLink;
pub use self::resource::HalResource;

#[cfg(test)]
mod tests;