[][src]Struct activitystreams::link::LinkBox

pub struct LinkBox(_);

A wrapper type around a generic Link

Implementations

impl LinkBox[src]

pub fn from_concrete<T>(t: T) -> Result<Self, Error> where
    T: Link + Serialize
[src]

Coerce a concrete type into this wrapper type

This is done automatically via TryFrom in proprties setter methods

pub fn into_concrete<T>(self) -> Result<T, Error> where
    T: Link + DeserializeOwned
[src]

Attempt to deserialize the wrapper type to a concrete type

Before this method is called, the type should be verified via the kind or is_kind methods

pub fn is_kind(&self, kind: impl Display) -> bool[src]

Return whether the given wrapper type is expected.

For example

This example is not tested
use activitystreams::object::{
    kind::ImageType,
    apub::Image,
};
if my_wrapper_type.is_kind(ImageType) {
    let image = my_wrapper_type.into_concrete::<Image>()?;
    ...
}

pub fn kind(&self) -> Option<&str>[src]

Return the kind of wrapper type, if present

Example

This example is not tested
match my_wrapper_type.kind() {
    Some("Image") => {
        let image = my_wrapper_type.into_concrete::<Image>()?;
        ...
    }
    _ => ...,
}

Trait Implementations

impl Clone for LinkBox[src]

impl Debug for LinkBox[src]

impl<'de> Deserialize<'de> for LinkBox[src]

impl From<LinkBox> for LinkPropertiesContextTermEnum[src]

impl From<LinkBox> for LinkPropertiesPreviewTermEnum[src]

impl From<LinkBox> for ObjectPropertiesIconTermEnum[src]

impl From<LinkBox> for ObjectPropertiesImageTermEnum[src]

impl From<LinkBox> for ObjectPropertiesUrlTermEnum[src]

impl Serialize for LinkBox[src]

impl<T, U> TryFrom<Ext<T, U>> for LinkBox where
    T: Link + Serialize,
    U: Extension<T> + Serialize + Debug
[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Mention> for LinkBox[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for LinkBox

impl Send for LinkBox

impl Sync for LinkBox

impl Unpin for LinkBox

impl UnwindSafe for LinkBox

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.