[][src]Trait activitystreams::base::ExtendsExt

pub trait ExtendsExt<Kind>: Extends<Kind> {
    fn into_any_base(self) -> Result<AnyBase, Self::Error>
    where
        Kind: Serialize,
        Self::Error: From<Error>
, { ... }
fn from_any_base(any_base: AnyBase) -> Result<Option<Self>, Self::Error>
    where
        Kind: DeserializeOwned,
        Self::Error: From<Error>
, { ... } }

A helper function implemented for all Extends types to easily produce an AnyBase from a given object.

This is important because many APIs in this crate deal with AnyBases.

Provided methods

fn into_any_base(self) -> Result<AnyBase, Self::Error> where
    Kind: Serialize,
    Self::Error: From<Error>, 

Create an AnyBase from the given object

use activitystreams::{object::Video, prelude::*};
let video = Video::new();

let any_base = video.into_any_base()?;

fn from_any_base(any_base: AnyBase) -> Result<Option<Self>, Self::Error> where
    Kind: DeserializeOwned,
    Self::Error: From<Error>, 

Create an object from an AnyBase

Before calling this, make sure the AnyBase::is_base() and AnyBase::kind match your expectations

use activitystreams::{object::Video, prelude::*};
let video = Video::from_any_base(any_base)?;
Loading content...

Implementors

impl<T, Kind> ExtendsExt<Kind> for T where
    T: Extends<Kind>,
    T::Error: From<Error>, 
[src]

Loading content...