Struct http_halforms::Hal
source · pub struct Hal {
pub links: BTreeMap<String, SingleOrMultiple<Link>>,
pub embedded: BTreeMap<String, SingleOrMultiple<Hal>>,
pub templates: BTreeMap<String, Template>,
pub payload: Value,
}Expand description
Representation of a HAL document.
Fields§
§links: BTreeMap<String, SingleOrMultiple<Link>>§embedded: BTreeMap<String, SingleOrMultiple<Hal>>§templates: BTreeMap<String, Template>§payload: ValueImplementations§
source§impl Hal
impl Hal
sourcepub fn new<V>(value: V) -> Selfwhere
V: Serialize,
pub fn new<V>(value: V) -> Selfwhere
V: Serialize,
Create a new HAL document for the given payload value.
Panics
This will panic if the value provided can not be serialized into JSON for some reason.
sourcepub fn with_link<N, L>(self, name: N, link: L) -> Selfwhere
N: ToString,
L: Into<Link>,
pub fn with_link<N, L>(self, name: N, link: L) -> Selfwhere
N: ToString,
L: Into<Link>,
Add a new link to a HAL document.
Examples found in repository?
More examples
sourcepub fn maybe_with_link<N, L>(self, name: N, link: Option<L>) -> Selfwhere
N: ToString,
L: Into<Link>,
pub fn maybe_with_link<N, L>(self, name: N, link: Option<L>) -> Selfwhere
N: ToString,
L: Into<Link>,
Add a new link to a HAL document.
sourcepub fn with_embedded<N, H>(self, name: N, value: H) -> Selfwhere
N: ToString,
H: Into<Hal>,
pub fn with_embedded<N, H>(self, name: N, value: H) -> Selfwhere
N: ToString,
H: Into<Hal>,
Add a new embedded HAL document to the HAL document.
Examples found in repository?
More examples
sourcepub fn maybe_with_embedded<N, L>(self, name: N, embedded: Option<L>) -> Selfwhere
N: ToString,
L: Into<Hal>,
pub fn maybe_with_embedded<N, L>(self, name: N, embedded: Option<L>) -> Selfwhere
N: ToString,
L: Into<Hal>,
Add a new embedded HAL document to a HAL document.
sourcepub fn with_template<N, T>(self, name: N, value: T) -> Selfwhere
N: ToString,
T: Into<Template>,
pub fn with_template<N, T>(self, name: N, value: T) -> Selfwhere
N: ToString,
T: Into<Template>,
Add a new action template to the HAL-FORMS document.