[][src]Trait activitystreams::activity::ActorAndObjectRefExt

pub trait ActorAndObjectRefExt: ActorAndObjectRef {
    fn actor<'a, Kind>(&'a self) -> Result<&OneOrMany<AnyBase>, DomainError>
    where
        Self: BaseExt<Kind>,
        Kind: 'a
, { ... }
fn actor_unchecked(&self) -> &OneOrMany<AnyBase> { ... }
fn actor_is(&self, id: &Url) -> bool { ... }
fn set_actor<T>(&mut self, actor: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_actors<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_actor<T>(&mut self, actor: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn object(&self) -> &OneOrMany<AnyBase> { ... }
fn object_is(&self, id: &Url) -> bool { ... }
fn set_object<T>(&mut self, object: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_objects<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_object<T>(&mut self, object: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... } }

Helper methods for interacting with Activity types with actor and object fields

Documentation for the fields related to these methods can be found on the ActorAndObject struct

Provided methods

fn actor<'a, Kind>(&'a self) -> Result<&OneOrMany<AnyBase>, DomainError> where
    Self: BaseExt<Kind>,
    Kind: 'a, 

Fetch the actor for the current activity, erroring if the actor's domain does not match the ID's domain

use activitystreams::prelude::*;

let actor_ref = create.actor();
println!("{:?}", actor_ref);

fn actor_unchecked(&self) -> &OneOrMany<AnyBase>

Fetch the actor for the current activity

use activitystreams::prelude::*;

let actor_ref = create.actor_unchecked();
println!("{:?}", actor_ref);

fn actor_is(&self, id: &Url) -> bool

Check if the actor's ID is id

use activitystreams::prelude::*;

create.set_actor(uri!("https://example.com"));

assert!(create.actor_is(&uri!("https://example.com")));

fn set_actor<T>(&mut self, actor: T) -> &mut Self where
    T: Into<AnyBase>, 

Set the actor for the current activity

This overwrites the contents of actor

use activitystreams::prelude::*;

create.set_actor(uri!("https://example.com"));

fn set_many_actors<I, T>(&mut self, items: I) -> &mut Self where
    I: IntoIterator<Item = T>,
    T: Into<AnyBase>, 

Set many actors for the current activity

This overwrites the contents of actor

use activitystreams::prelude::*;

create.set_many_actors(vec![
    uri!("https://example.com/one"),
    uri!("https://example.com/two"),
]);

fn add_actor<T>(&mut self, actor: T) -> &mut Self where
    T: Into<AnyBase>, 

Add a actor to the current activity

This does not overwrite the contents of actor, only appends an item

use activitystreams::prelude::*;

create
    .add_actor(uri!("https://example.com/one"))
    .add_actor(uri!("https://example.com/two"));

fn object(&self) -> &OneOrMany<AnyBase>

Fetch the object for the current activity

use activitystreams::prelude::*;

let object_ref = create.object();
println!("{:?}", object_ref);

fn object_is(&self, id: &Url) -> bool

Check if the object's ID is id

use activitystreams::prelude::*;

create.set_object(uri!("https://example.com"));

assert!(create.object_is(&uri!("https://example.com")));

fn set_object<T>(&mut self, object: T) -> &mut Self where
    T: Into<AnyBase>, 

Set the object for the current activity

This overwrites the contents of object

use activitystreams::prelude::*;

create.set_object(uri!("https://example.com"));

fn set_many_objects<I, T>(&mut self, items: I) -> &mut Self where
    I: IntoIterator<Item = T>,
    T: Into<AnyBase>, 

Set many objects for the current activity

This overwrites the contents of object

use activitystreams::prelude::*;

create.set_many_objects(vec![
    uri!("https://example.com/one"),
    uri!("https://example.com/two"),
]);

fn add_object<T>(&mut self, object: T) -> &mut Self where
    T: Into<AnyBase>, 

Add a object to the current activity

This does not overwrite the contents of object, only appends an item

use activitystreams::prelude::*;

create
    .add_object(uri!("https://example.com/one"))
    .add_object(uri!("https://example.com/two"));
Loading content...

Implementors

impl<T> ActorAndObjectRefExt for T where
    T: ActorAndObjectRef
[src]

Loading content...