Skip to main content

Module links

Module links 

Source
Expand description

HATEOAS Link and Links types for hypermedia-driven API responses.

A Link captures a single hypermedia relation (rel, href, optional method). Links is an ordered collection of Link values with helper factory methods for the most common rels.

§Example

use api_bones::links::{Link, Links};

let links = Links::new()
    .push(Link::self_link("/resources/42"))
    .push(Link::next("/resources?page=2"));

assert_eq!(links.find("self").unwrap().href, "/resources/42");

Structs§

Link
A single HATEOAS link with a relation type, target URL, and optional HTTP method hint.
Links
An ordered collection of Link values.