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 maybe_with_link<N, L>(self, name: N, link: Option<L>) -> Self
pub fn maybe_with_link<N, L>(self, name: N, link: Option<L>) -> Self
Add a new link to a HAL document.
Sourcepub fn with_embedded<N, H>(self, name: N, value: H) -> Self
pub fn with_embedded<N, H>(self, name: N, value: H) -> Self
Add a new embedded HAL document to the HAL document.
Sourcepub fn maybe_with_embedded<N, L>(self, name: N, embedded: Option<L>) -> Self
pub fn maybe_with_embedded<N, L>(self, name: N, embedded: Option<L>) -> Self
Add a new embedded HAL document to a HAL document.
Sourcepub fn with_template<N, T>(self, name: N, value: T) -> Self
pub fn with_template<N, T>(self, name: N, value: T) -> Self
Add a new action template to the HAL-FORMS document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hal
impl RefUnwindSafe for Hal
impl Send for Hal
impl Sync for Hal
impl Unpin for Hal
impl UnwindSafe for Hal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more