pub trait AsActivityActorExt: AsActivityActor {
    fn actor(&self) -> Result<&OneOrMany<AnyBase>, CheckError>
    where
        Self: BaseExt
, { ... } fn actor_unchecked(&self) -> &OneOrMany<AnyBase> { ... } fn actor_is(&self, id: &IriString) -> 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>
, { ... } }
Expand description

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§

Fetch the actor for the current activity

use activitystreams::prelude::*;

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

Fetch the actor for the current activity

use activitystreams::prelude::*;

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

Check if the actor’s ID is id

use activitystreams::prelude::*;

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

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

Set the actor for the current activity

This overwrites the contents of actor

use activitystreams::prelude::*;

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

Set many actors for the current activity

This overwrites the contents of actor

use activitystreams::prelude::*;

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

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(iri!("https://example.com/one"))
    .add_actor(iri!("https://example.com/two"));

Implementors§