Skip to main content

Link

Struct Link 

Source
pub struct Link {
    pub href: Option<Iri>,
    pub rels: Vec<String>,
    pub media_type: Option<String>,
    pub digest_multibase: Option<String>,
    pub name: Text,
    pub language: Option<String>,
    pub height: Option<u64>,
    pub width: Option<u64>,
    pub previews: Vec<LinkOrObject>,
}
Expand description

A Link is an indirect, qualified reference to a resource identified by a URL. The fundamental model for links is established by RFC 5988. Many of the properties defined by the Activity Vocabulary allow values that are either instances of {@link Object} or {@link Link}. When a {@link Link} is used, it establishes a qualified relation connecting the subject (the containing object) to the resource identified by the href. Properties of the {@link Link} are properties of the reference as opposed to properties of the resource.

The type https://www.w3.org/ns/activitystreams#Link.

Fields§

§href: Option<Iri>

The target resource pointed to by a {@link Link}.

§rels: Vec<String>

A link relation associated with a {@link Link}. The value MUST conform to both the HTML5 and RFC 5988 “link relation” definitions.

§media_type: Option<String>

When used on a {@link Link}, identifies the MIME media type of the referenced resource.

§digest_multibase: Option<String>

The multibase-encoded integrity digest of the linked resource.

§name: Text

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.

§language: Option<String>

Hints as to the language used by the target resource. Value MUST be a BCP 47 Language-Tag.

§height: Option<u64>

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

§width: Option<u64>

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

§previews: Vec<LinkOrObject>

Identifies an entity that provides a preview of this object.

Implementations§

Source

pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Link"

The type’s IRI.

Source

pub const TYPE: &'static str = "Link"

The type’s type in a normalised document.

Trait Implementations§

Source§

fn clone(&self) -> Link

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 default() -> Link

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

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

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

fn from_json(value: &Value) -> Result<Self, JsonError>

Read value. Read more
Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

fn to_json(&self) -> Value

Write self.
Source§

const TYPE: &'static str = "Link"

The type’s type in a normalised document, such as Create.

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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.