HalLink

Struct HalLink 

Source
pub struct HalLink {
    pub href: String,
    pub templated: bool,
    pub media_type: Option<String>,
    pub deprecation: Option<String>,
    pub name: Option<String>,
    pub profile: Option<String>,
    pub title: Option<String>,
    pub hreflang: Option<String>,
}
Expand description

A Link object for linking HAL Resources.

The link represents a related resource. If follows the HAL Draft Spec

§Examples

use rustic_hal::HalLink;

let link = HalLink::new("http://sowewhere.com");

Fields§

§href: String

The “href” property is REQUIRED.

Its value is either a URI [RFC3986] or a URI Template [RFC6570].

If the value is a URI Template then the Link Object SHOULD have a “templated” attribute whose value is true.

§templated: bool

The “templated” property is OPTIONAL.

Its value is boolean and SHOULD be true when the Link Object’s “href” property is a URI Template.

Its value SHOULD be considered false if it is undefined or any other value than true.

§media_type: Option<String>

The “type” property is OPTIONAL.

Its value is a string used as a hint to indicate the media type expected when dereferencing the target resource.

§deprecation: Option<String>

The “deprecation” property is OPTIONAL.

Its presence indicates that the link is to be deprecated (i.e. removed) at a future date. Its value is a URL that SHOULD provide further information about the deprecation.

A client SHOULD provide some notification (for example, by logging a warning message) whenever it traverses over a link that has this property. The notification SHOULD include the deprecation property’s value so that a client manitainer can easily find information about the deprecation.

§name: Option<String>

The “name” property is OPTIONAL.

Its value MAY be used as a secondary key for selecting Link Objects which share the same relation type.

§profile: Option<String>

The “profile” property is OPTIONAL.

Its value is a string which is a URI that hints about the profile (as defined by [I-D.wilde-profile-link]) of the target resource.

§title: Option<String>

The “title” property is OPTIONAL.

Its value is a string and is intended for labelling the link with a human-readable identifier (as defined by [RFC5988]).

§hreflang: Option<String>

The “hreflang” property is OPTIONAL.

Its value is a string and is intended for indicating the language of the target resource (as defined by [RFC5988]).

Implementations§

Source

pub fn new<S>(href: S) -> HalLink
where S: Into<String>,

Source

pub fn templated(self, templated: bool) -> Self

Source

pub fn with_media_type(self, media_type: &str) -> Self

Source

pub fn media_type(&self) -> Option<String>

Source

pub fn with_deprecation(self, deprecation: &str) -> Self

Source

pub fn deprecation(&self) -> Option<String>

Source

pub fn with_name(self, name: &str) -> Self

Source

pub fn name(&self) -> Option<String>

Source

pub fn with_profile(self, profile: &str) -> Self

Source

pub fn profile(&self) -> Option<String>

Source

pub fn with_title(self, title: &str) -> Self

Source

pub fn title(&self) -> Option<String>

Source

pub fn with_hreflang(self, hreflang: &str) -> Self

Source

pub fn hreflang(&self) -> Option<String>

Trait Implementations§

Source§

fn clone(&self) -> HalLink

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

fn from(s: T) -> Self

Converts to this type from the input type.
Source§

fn eq(&self, other: &HalLink) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,