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.
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
impl LinkProperties
Sourcepub fn id_string(&self) -> Result<String>
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
Sourcepub fn set_id_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn context_object<T: Object>(&self) -> Result<T>
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
Sourcepub fn set_context_object<T: Object>(&mut self, item: T) -> Result<()>
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
Sourcepub fn context_object_vec<T: Object>(&self) -> Result<Vec<T>>
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
Sourcepub fn set_context_object_vec<T: Object>(&mut self, item: Vec<T>) -> Result<()>
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
Sourcepub fn context_link<T: Link>(&self) -> Result<T>
pub fn context_link<T: Link>(&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
Sourcepub fn set_context_link<T: Link>(&mut self, item: T) -> Result<()>
pub fn set_context_link<T: Link>(&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
Sourcepub fn context_link_vec<T: Link>(&self) -> Result<Vec<T>>
pub fn context_link_vec<T: Link>(&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
Sourcepub fn set_context_link_vec<T: Link>(&mut self, item: Vec<T>) -> Result<()>
pub fn set_context_link_vec<T: Link>(&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
Sourcepub fn context_string(&self) -> Result<String>
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
Sourcepub fn set_context_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn context_string_vec(&self) -> Result<Vec<String>>
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
Sourcepub fn set_context_string_vec(&mut self, item: Vec<String>) -> Result<()>
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
Sourcepub fn name_string(&self) -> Result<String>
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
Sourcepub fn set_name_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn name_string_vec(&self) -> Result<Vec<String>>
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
Sourcepub fn set_name_string_vec(&mut self, item: Vec<String>) -> Result<()>
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
Sourcepub fn href_string(&self) -> Result<String>
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
Sourcepub fn set_href_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn hreflang_string(&self) -> Result<String>
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
Sourcepub fn set_hreflang_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn media_type_string(&self) -> Result<String>
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
Sourcepub fn set_media_type_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn rel_string(&self) -> Result<String>
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
Sourcepub fn set_rel_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn rel_string_vec(&self) -> Result<Vec<String>>
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
Sourcepub fn set_rel_string_vec(&mut self, item: Vec<String>) -> Result<()>
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
Sourcepub fn height_u64(&self) -> Result<u64>
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
Sourcepub fn set_height_u64(&mut self, item: u64) -> Result<()>
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
Sourcepub fn width_u64(&self) -> Result<u64>
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
Sourcepub fn set_width_u64(&mut self, item: u64) -> Result<()>
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
Sourcepub fn preview_object<T: Object>(&self) -> Result<T>
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
Sourcepub fn set_preview_object<T: Object>(&mut self, item: T) -> Result<()>
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
Sourcepub fn preview_object_vec<T: Object>(&self) -> Result<Vec<T>>
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
Sourcepub fn set_preview_object_vec<T: Object>(&mut self, item: Vec<T>) -> Result<()>
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
Sourcepub fn preview_link<T: Link>(&self) -> Result<T>
pub fn preview_link<T: Link>(&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
Sourcepub fn set_preview_link<T: Link>(&mut self, item: T) -> Result<()>
pub fn set_preview_link<T: Link>(&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
Sourcepub fn preview_link_vec<T: Link>(&self) -> Result<Vec<T>>
pub fn preview_link_vec<T: Link>(&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
Sourcepub fn set_preview_link_vec<T: Link>(&mut self, item: Vec<T>) -> Result<()>
pub fn set_preview_link_vec<T: Link>(&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
Sourcepub fn preview_string(&self) -> Result<String>
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
Sourcepub fn set_preview_string(&mut self, item: String) -> Result<()>
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
Sourcepub fn preview_string_vec(&self) -> Result<Vec<String>>
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§impl LinkProperties
impl LinkProperties
Sourcepub fn media_type(&self) -> Result<Mime>
pub fn media_type(&self) -> Result<Mime>
Fetch a typed Mime struct from the media_type field.
Trait Implementations§
Source§impl Clone for LinkProperties
impl Clone for LinkProperties
Source§fn clone(&self) -> LinkProperties
fn clone(&self) -> LinkProperties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more