LinkProperties

Struct LinkProperties 

Source
pub struct LinkProperties {
    pub id: Option<Value>,
    pub context: Option<Value>,
    pub name: Option<Value>,
    pub href: Option<Value>,
    pub hreflang: Option<Value>,
    pub media_type: Option<Value>,
    pub rel: Option<Value>,
    pub height: Option<Value>,
    pub width: Option<Value>,
    pub preview: Option<Value>,
}
Expand description

Define all the properties of the Object base type as described by the Activity Streams vocabulary.

The properties of the Link object are not the properties of the referenced resource, but are provided as hints for rendering agents to understand how to make use of the resource. For example, height and width might represent the desired rendered size of a referenced image, rather than the actual pixel dimensions of the referenced image.

The target URI of the Link is expressed using the required href property.

For example, all Objects can contain an image property whose value describes a graphical representation of the containing object. This property will typically be used to provide the URL to an image (e.g. JPEG, GIF or PNG) resource that can be displayed to the user. Any given object might have multiple such visual representations – multiple screenshots, for instance, or the same image at different resolutions. In Activity Streams 2.0, there are essentially three ways of describing such references.

Fields§

§id: Option<Value>

Provides the globally unique identifier for an Object or Link.

The id property is expressed as an absolute IRI in the spec, but for now is represented as a string.

  • Range: anyUri
  • Functional: true
§context: Option<Value>

Identifies the context within which the object exists or an activity was performed.

The notion of “context” used is intentionally vague. The intended function is to serve as a means of grouping objects and activities that share a common originating context or purpose. An example could be all activities relating to a common project or event.

  • Range: Object | Link
  • Functional: false
§name: Option<Value>

A simple, human-readable, plain-text name for the object.

HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.

  • Range: xsd:string | rdf:langString
  • Functional: false
§href: Option<Value>

The target resource pointed to by a Link.

  • Range: xsd:anyUri
  • Functional: true
§hreflang: Option<Value>

Hints as to the language used by the target resource.

Value MUST be a [BCP47] Language-Tag.

  • Range: [BCP47] Language Tag
  • Functional: true
§media_type: Option<Value>

When used on a Link, identifies the MIME media type of the referenced resource.

If not specified, the content property is assumed to contain text/html content.

  • Range: Mime Media Type
  • Functional: true
§rel: Option<Value>

A link relation associated with a Link.

The value MUST conform to both the [HTML5] and [RFC5988] “link relation” definitions.

In the [HTML5], any string not containing the “space” U+0020, “tab” (U+0009), “LF” (U+000A), “FF” (U+000C), “CR” (U+000D) or “,” (U+002C) characters can be used as a valid link relation.

  • Range: [RFC5988] or [HTML5] Link Relation
  • Functional: false
§height: Option<Value>

On a Link, specifies a hint as to the rendering height in device-independent pixels of the linked resource.

  • Range: xsd:nonNegativeInteger
  • Functional: true
§width: Option<Value>

On a Link, specifies a hint as to the rendering width in device-independent pixels of the linked resource.

  • Range: xsd:nonNegativeInteger
  • Functional: true
§preview: Option<Value>

Identifies an entity that provides a preview of this object.

  • Range: Object | Link
  • Functional: false

Implementations§

Source§

impl LinkProperties

Source

pub fn id_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_id_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn context_object<T: Object>(&self) -> Result<T>

Retrieve a value of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_context_object<T: Object>(&mut self, item: T) -> Result<()>

Set a value of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn context_object_vec<T: Object>(&self) -> Result<Vec<T>>

Retrieve many values of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_context_object_vec<T: Object>(&mut self, item: Vec<T>) -> Result<()>

Set many values of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Retrieve a value of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Set a value of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Retrieve many values of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Set many values of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn context_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_context_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn context_string_vec(&self) -> Result<Vec<String>>

Retrieve many values from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_context_string_vec(&mut self, item: Vec<String>) -> Result<()>

Set many values in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn name_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_name_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn name_string_vec(&self) -> Result<Vec<String>>

Retrieve many values from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_name_string_vec(&mut self, item: Vec<String>) -> Result<()>

Set many values in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn href_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_href_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn hreflang_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_hreflang_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn media_type_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_media_type_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn rel_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_rel_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn rel_string_vec(&self) -> Result<Vec<String>>

Retrieve many values from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_rel_string_vec(&mut self, item: Vec<String>) -> Result<()>

Set many values in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn height_u64(&self) -> Result<u64>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_height_u64(&mut self, item: u64) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn width_u64(&self) -> Result<u64>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_width_u64(&mut self, item: u64) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn preview_object<T: Object>(&self) -> Result<T>

Retrieve a value of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_preview_object<T: Object>(&mut self, item: T) -> Result<()>

Set a value of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn preview_object_vec<T: Object>(&self) -> Result<Vec<T>>

Retrieve many values of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_preview_object_vec<T: Object>(&mut self, item: Vec<T>) -> Result<()>

Set many values of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Retrieve a value of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Set a value of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Retrieve many values of type T from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Set many values of type T in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn preview_string(&self) -> Result<String>

Retrieve a value from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_preview_string(&mut self, item: String) -> Result<()>

Set a value in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source

pub fn preview_string_vec(&self) -> Result<Vec<String>>

Retrieve many values from the given struct

This method deserializes the item from JSON, so be wary of using this a lot.

Possible errors from this method are Error::NotFound and Error::Deserialize

Source

pub fn set_preview_string_vec(&mut self, item: Vec<String>) -> Result<()>

Set many values in the given struct

This method serializes the item to JSON, so be wary of using this a lot.

Possible errors from this method are Error::Serialize

Source§

impl LinkProperties

Source

pub fn media_type(&self) -> Result<Mime>

Fetch a typed Mime struct from the media_type field.

Trait Implementations§

Source§

impl Clone for LinkProperties

Source§

fn clone(&self) -> LinkProperties

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§

impl Debug for LinkProperties

Source§

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

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

impl Default for LinkProperties

Source§

fn default() -> LinkProperties

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for LinkProperties

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§

impl Serialize for LinkProperties

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>,