[][src]Trait activitystreams::actor::ApActorExt

pub trait ApActorExt<Inner>: AsApActor<Inner> {
    fn inbox<'a, Kind>(&'a self) -> Result<&'a Url, DomainError>
    where
        Self: BaseExt<Kind> + 'a,
        Inner: 'a,
        Kind: 'a
, { ... }
fn inbox_unchecked<'a>(&'a self) -> &'a Url
    where
        Inner: 'a
, { ... }
fn inbox_mut<'a>(&'a mut self) -> &'a mut Url
    where
        Inner: 'a
, { ... }
fn set_inbox(&mut self, inbox: Url) -> &mut Self { ... }
fn outbox<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn outbox_unchecked<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn outbox_mut<'a>(&'a mut self) -> Option<&'a mut Url>
    where
        Inner: 'a
, { ... }
fn set_outbox(&mut self, outbox: Url) -> &mut Self { ... }
fn take_outbox(&mut self) -> Option<Url> { ... }
fn delete_outbox(&mut self) -> &mut Self { ... }
fn following<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn following_unchecked<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn following_mut<'a>(&'a mut self) -> Option<&'a mut Url>
    where
        Inner: 'a
, { ... }
fn set_following(&mut self, following: Url) -> &mut Self { ... }
fn take_following(&mut self) -> Option<Url> { ... }
fn delete_following(&mut self) -> &mut Self { ... }
fn followers<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn followers_unchecked<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn followers_mut<'a>(&'a mut self) -> Option<&'a mut Url>
    where
        Inner: 'a
, { ... }
fn set_followers(&mut self, followers: Url) -> &mut Self { ... }
fn take_followers(&mut self) -> Option<Url> { ... }
fn delete_followers(&mut self) -> &mut Self { ... }
fn liked<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn liked_unchecked<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn liked_mut<'a>(&'a mut self) -> Option<&'a mut Url>
    where
        Inner: 'a
, { ... }
fn set_liked(&mut self, liked: Url) -> &mut Self { ... }
fn take_liked(&mut self) -> Option<Url> { ... }
fn delete_liked(&mut self) -> &mut Self { ... }
fn streams<'a, Kind>(
        &'a self
    ) -> Result<Option<OneOrMany<&'a Url>>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn streams_unchecked<'a>(&'a self) -> Option<OneOrMany<&'a Url>>
    where
        Inner: 'a
, { ... }
fn streams_mut<'a>(&'a mut self) -> Option<OneOrMany<&'a mut Url>>
    where
        Inner: 'a
, { ... }
fn set_streams(&mut self, streams: Url) -> &mut Self { ... }
fn set_many_streams<I, U>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = U>,
        U: Into<Url>
, { ... }
fn add_streams(&mut self, stream: Url) -> &mut Self { ... }
fn take_streams(&mut self) -> Option<OneOrMany<Url>> { ... }
fn delete_streams(&mut self) -> &mut Self { ... }
fn preferred_username<'a>(&'a self) -> Option<&'a str>
    where
        Inner: 'a
, { ... }
fn set_preferred_username<T>(&mut self, string: T) -> &mut Self
    where
        T: Into<String>
, { ... }
fn take_preferred_username(&mut self) -> Option<String> { ... }
fn delete_preferred_username(&mut self) -> &mut Self { ... }
fn endpoints<'a, Kind>(
        &'a self
    ) -> Result<Option<Endpoints<&'a Url>>, DomainError>
    where
        Self: BaseExt<Kind>,
        Inner: 'a,
        Kind: 'a
, { ... }
fn endpoints_unchecked<'a>(&'a self) -> Option<Endpoints<&'a Url>>
    where
        Inner: 'a
, { ... }
fn endpoints_mut<'a>(&'a mut self) -> Option<Endpoints<&'a mut Url>>
    where
        Inner: 'a
, { ... }
fn set_endpoints(&mut self, endpoints: Endpoints<Url>) -> &mut Self { ... }
fn take_endpoints(&mut self) -> Option<Endpoints<Url>> { ... }
fn delete_endpoints(&mut self) -> &mut Self { ... } }

Helper methods for interacting with ActivityPub Actor types

This trait represents methods valid for any ActivityPub Actor.

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

Provided methods

fn inbox<'a, Kind>(&'a self) -> Result<&'a Url, DomainError> where
    Self: BaseExt<Kind> + 'a,
    Inner: 'a,
    Kind: 'a, 

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

use activitystreams::prelude::*;

let inbox = person.inbox()?;
println!("{:?}", inbox);

fn inbox_unchecked<'a>(&'a self) -> &'a Url where
    Inner: 'a, 

Fetch the inbox for the current actor

use activitystreams::prelude::*;

let inbox_ref = person.inbox_unchecked();

fn inbox_mut<'a>(&'a mut self) -> &'a mut Url where
    Inner: 'a, 

Fetch a mutable referece to the current actor's inbox

use activitystreams::prelude::*;

let inbox_mut = person.inbox_mut();
inbox_mut.set_path("/inbox");

fn set_inbox(&mut self, inbox: Url) -> &mut Self

Set the inbox for the current actor

use activitystreams::prelude::*;

person.set_inbox(uri!("https://example.com/inbox"));

fn outbox<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

Fetch the outbox for the current user, erroring if the oubox's domain does not match the ID's domain

use activitystreams::prelude::*;

let outbox_ref = person.outbox()?;

fn outbox_unchecked<'a>(&'a self) -> Option<&'a Url> where
    Inner: 'a, 

Fetch the outbox for the current actor

use activitystreams::prelude::*;

let outbox_ref = person.outbox_unchecked();

fn outbox_mut<'a>(&'a mut self) -> Option<&'a mut Url> where
    Inner: 'a, 

Mutably fetch the outbox for the current actor

use activitystreams::prelude::*;

if let Some(outbox) = person.outbox_mut() {
    outbox.set_path("/outbox");
    println!("{:?}", outbox);
}

fn set_outbox(&mut self, outbox: Url) -> &mut Self

Set the outbox for the current actor

use activitystreams::prelude::*;

person.set_outbox(uri!("https://example.com/outbox"));

fn take_outbox(&mut self) -> Option<Url>

Take the outbox from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(outbox) = person.take_outbox() {
    println!("{:?}", outbox);
}

fn delete_outbox(&mut self) -> &mut Self

Delete the outbox from the current object

use activitystreams::prelude::*;

assert!(person.outbox_unchecked().is_some());
person.delete_outbox();
assert!(person.outbox_unchecked().is_none());

fn following<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

Fetch the following link for the current user, erroring if the following link's domain does not match the ID's domain

use activitystreams::prelude::*;

if let Some(following) = person.following()? {
    println!("{:?}", following);
}

fn following_unchecked<'a>(&'a self) -> Option<&'a Url> where
    Inner: 'a, 

Fetch the following link for the current actor

use activitystreams::prelude::*;

if let Some(following) = person.following_unchecked() {
    println!("{:?}", following);
}

fn following_mut<'a>(&'a mut self) -> Option<&'a mut Url> where
    Inner: 'a, 

Mutably fetch the following link for the current actor

use activitystreams::prelude::*;

if let Some(following) = person.following_mut() {
    following.set_path("/following");
    println!("{:?}", following);
}

fn set_following(&mut self, following: Url) -> &mut Self

Set the following link for the current actor

use activitystreams::prelude::*;

person.set_following(uri!("https://example.com/following"));

fn take_following(&mut self) -> Option<Url>

Take the following link from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(following) = person.take_following() {
    println!("{:?}", following);
}

fn delete_following(&mut self) -> &mut Self

Delete the following link from the current object

use activitystreams::prelude::*;

assert!(person.following_unchecked().is_some());
person.delete_following();
assert!(person.following_unchecked().is_none());

fn followers<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

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

use activitystreams::prelude::*;

if let Some(followers) = person.followers()? {
    println!("{:?}", followers);
}

fn followers_unchecked<'a>(&'a self) -> Option<&'a Url> where
    Inner: 'a, 

Fetch the followers link for the current actor

use activitystreams::prelude::*;

if let Some(followers) = person.followers_unchecked() {
    println!("{:?}", followers);
}

fn followers_mut<'a>(&'a mut self) -> Option<&'a mut Url> where
    Inner: 'a, 

Mutably fetch the followers link for the current actor

use activitystreams::prelude::*;

if let Some(followers) = person.followers_mut() {
    followers.set_path("/followers");
    println!("{:?}", followers);
}

fn set_followers(&mut self, followers: Url) -> &mut Self

Set the followers link for the current actor

use activitystreams::prelude::*;

person.set_followers(uri!("https://example.com/followers"));

fn take_followers(&mut self) -> Option<Url>

Take the followers link from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(followers) = person.take_followers() {
    println!("{:?}", followers);
}

fn delete_followers(&mut self) -> &mut Self

Delete the followers link from the current object

use activitystreams::prelude::*;

assert!(person.followers_unchecked().is_some());
person.delete_followers();
assert!(person.followers_unchecked().is_none());

fn liked<'a, Kind>(&'a self) -> Result<Option<&'a Url>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

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

use activitystreams::prelude::*;

if let Some(liked) = person.liked()? {
    println!("{:?}", liked);
}

fn liked_unchecked<'a>(&'a self) -> Option<&'a Url> where
    Inner: 'a, 

Fetch the liked link for the current actor

use activitystreams::prelude::*;

if let Some(liked) = person.liked_unchecked() {
    println!("{:?}", liked);
}

fn liked_mut<'a>(&'a mut self) -> Option<&'a mut Url> where
    Inner: 'a, 

Mutably fetch the liked link for the current actor

use activitystreams::prelude::*;

if let Some(liked) = person.liked_mut() {
    liked.set_path("/liked");
    println!("{:?}", liked);
}

fn set_liked(&mut self, liked: Url) -> &mut Self

Set the liked link for the current actor

use activitystreams::prelude::*;

person.set_streams(uri!("https://example.com/liked"));

fn take_liked(&mut self) -> Option<Url>

Take the liked link from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(liked) = person.take_liked() {
    println!("{:?}", liked);
}

fn delete_liked(&mut self) -> &mut Self

Delete the liked link from the current object

use activitystreams::prelude::*;

assert!(person.liked_unchecked().is_some());
person.delete_liked();
assert!(person.liked_unchecked().is_none());

fn streams<'a, Kind>(
    &'a self
) -> Result<Option<OneOrMany<&'a Url>>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

Fetch the streams links for the current actor, erroring if the streams links's domains do not match the ID's domains

use activitystreams::prelude::*;

if let Some(streams) = person.streams()? {
    println!("{:?}", streams);
}

fn streams_unchecked<'a>(&'a self) -> Option<OneOrMany<&'a Url>> where
    Inner: 'a, 

Fetch the streams links for the current actor

use activitystreams::prelude::*;

if let Some(streams) = person.streams_unchecked() {
    println!("{:?}", streams);
}

fn streams_mut<'a>(&'a mut self) -> Option<OneOrMany<&'a mut Url>> where
    Inner: 'a, 

Mutably fetch the streams links for the current actor

use activitystreams::prelude::*;

if let Some(mut streams) = person.streams_mut() {
    streams.one_mut().map(|url| url.set_path("/streams"));
    streams.many_mut().map(|urls| {
        for url in urls.iter_mut() {
            url.set_path("/streams");
        }
    });
    println!("{:?}", streams);
}

fn set_streams(&mut self, streams: Url) -> &mut Self

Set the streams links for the current actor

use activitystreams::prelude::*;

person.set_streams(uri!("https://example.com/streams"));

fn set_many_streams<I, U>(&mut self, items: I) -> &mut Self where
    I: IntoIterator<Item = U>,
    U: Into<Url>, 

Set many streams links for the current actor

use activitystreams::prelude::*;

person.set_many_streams(vec![
    uri!("https://example.com/streams1"),
    uri!("https://example.com/streams2"),
]);

fn add_streams(&mut self, stream: Url) -> &mut Self

Add a streams link for the current actor

use activitystreams::prelude::*;

person
    .add_streams(uri!("https://example.com/streams1"))
    .add_streams(uri!("https://example.com/streams2"));

fn take_streams(&mut self) -> Option<OneOrMany<Url>>

Take the streams links from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(streams) = person.take_streams() {
    println!("{:?}", streams);
}

fn delete_streams(&mut self) -> &mut Self

Delete the streams links from the current object

use activitystreams::prelude::*;

assert!(person.streams_unchecked().is_some());
person.delete_streams();
assert!(person.streams_unchecked().is_none());

fn preferred_username<'a>(&'a self) -> Option<&'a str> where
    Inner: 'a, 

Fetch the preferred_username for the current actor

use activitystreams::prelude::*;

if let Some(preferred_username) = person.preferred_username() {
    println!("{:?}", preferred_username);
}

fn set_preferred_username<T>(&mut self, string: T) -> &mut Self where
    T: Into<String>, 

Set the preferred_username for the current actor

use activitystreams::prelude::*;

person.set_preferred_username("user123");

fn take_preferred_username(&mut self) -> Option<String>

Take the preferred_username from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(preferred_username) = person.take_preferred_username() {
    println!("{:?}", preferred_username);
}

fn delete_preferred_username(&mut self) -> &mut Self

Delete the preferred_username from the current actor

use activitystreams::prelude::*;

assert!(person.preferred_username().is_some());
person.delete_preferred_username();
assert!(person.preferred_username().is_none());

fn endpoints<'a, Kind>(
    &'a self
) -> Result<Option<Endpoints<&'a Url>>, DomainError> where
    Self: BaseExt<Kind>,
    Inner: 'a,
    Kind: 'a, 

Fetch the endpoints for the current actor, erroring if the Endpoints' domains do not match the ID's domain

use activitystreams::prelude::*;

if let Some(endpoints) = person.endpoints()? {
    println!("{:?}", endpoints);
}

fn endpoints_unchecked<'a>(&'a self) -> Option<Endpoints<&'a Url>> where
    Inner: 'a, 

Fetch the endpoints for the current actor

use activitystreams::prelude::*;

if let Some(endpoints) = person.endpoints_unchecked() {
    println!("{:?}", endpoints);
}

fn endpoints_mut<'a>(&'a mut self) -> Option<Endpoints<&'a mut Url>> where
    Inner: 'a, 

Mutably fetch the endpoints for the current actor

use activitystreams::prelude::*;

if let Some(mut endpoints) = person.endpoints_mut() {
    endpoints.shared_inbox.as_mut().map(|url| url.set_path("/inbox"));
    println!("{:?}", endpoints);
}

fn set_endpoints(&mut self, endpoints: Endpoints<Url>) -> &mut Self

Set the endpoints for the current actor

use activitystreams::prelude::*;

person.set_endpoints(Endpoints {
    shared_inbox: Some(uri!("https://example.com/inbox")),
    ..Default::default()
});

fn take_endpoints(&mut self) -> Option<Endpoints<Url>>

Take the endpoints from the current actor, leaving nothing

use activitystreams::prelude::*;

if let Some(endpoints) = person.take_endpoints() {
    println!("{:?}", endpoints);
}

fn delete_endpoints(&mut self) -> &mut Self

Delete the endpoints from the current actor

use activitystreams::prelude::*;

assert!(person.endpoints_unchecked().is_some());
person.delete_endpoints();
assert!(person.endpoints_unchecked().is_none());
Loading content...

Implementors

impl<T, Inner> ApActorExt<Inner> for T where
    T: AsApActor<Inner>, 
[src]

Loading content...