pub trait ApObjectExt: AsApObject {
Show 18 methods // Provided methods fn shares<'a>(&'a self) -> Option<&'a IriString> where Self::Inner: 'a { ... } fn set_shares(&mut self, shares: IriString) -> &mut Self { ... } fn take_shares(&mut self) -> Option<IriString> { ... } fn delete_shares(&mut self) -> &mut Self { ... } fn likes<'a>(&'a self) -> Option<&'a IriString> where Self::Inner: 'a { ... } fn set_likes(&mut self, likes: IriString) -> &mut Self { ... } fn take_likes(&mut self) -> Option<IriString> { ... } fn delete_likes(&mut self) -> &mut Self { ... } fn source<'a>(&'a self) -> Option<&'a AnyBase> where Self::Inner: 'a { ... } fn set_source<T>(&mut self, source: T) -> &mut Self where T: Into<AnyBase> { ... } fn take_source(&mut self) -> Option<AnyBase> { ... } fn delete_source(&mut self) -> &mut Self { ... } fn upload_media<'a>(&'a self) -> Option<OneOrMany<&'a IriString>> where Self::Inner: 'a { ... } fn set_upload_media(&mut self, upload_media: IriString) -> &mut Self { ... } fn set_many_upload_medias<I, U>(&mut self, items: I) -> &mut Self where I: IntoIterator<Item = U>, U: Into<IriString> { ... } fn add_upload_media(&mut self, upload_media: IriString) -> &mut Self { ... } fn take_upload_media(&mut self) -> Option<OneOrMany<IriString>> { ... } fn delete_upload_media(&mut self) -> &mut Self { ... }
}
Expand description

Helper methods for interacting with ActivityPub Object types

This trait represents methods valid for any ActivityPub Object.

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

Provided Methods§

source

fn shares<'a>(&'a self) -> Option<&'a IriString>where Self::Inner: 'a,

Fetch the shares for the current object

use activitystreams::prelude::*;

if let Some(shares) = video.shares() {
    println!("{:?}", shares);
}
source

fn set_shares(&mut self, shares: IriString) -> &mut Self

Set the shares for the current object

This overwrites the contents of shares

use activitystreams::{prelude::*, iri};

video.set_shares(iri!("https://example.com"));
source

fn take_shares(&mut self) -> Option<IriString>

Take the shares from the current object, leaving nothing

use activitystreams::prelude::*;

if let Some(shares) = video.take_shares() {
    println!("{:?}", shares);
}
source

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

Delete the shares from the current object

use activitystreams::prelude::*;

assert!(video.shares().is_some());
video.delete_shares();
assert!(video.shares().is_none());
source

fn likes<'a>(&'a self) -> Option<&'a IriString>where Self::Inner: 'a,

Fetch the likes for the current object

use activitystreams::prelude::*;

if let Some(likes) = video.likes() {
    println!("{:?}", likes);
}
source

fn set_likes(&mut self, likes: IriString) -> &mut Self

Set the likes for the current object

This overwrites the contents of likes

use activitystreams::{prelude::*, iri};

video.set_likes(iri!("https://example.com"));
source

fn take_likes(&mut self) -> Option<IriString>

Take the likes from the current object, leaving nothing

use activitystreams::prelude::*;

if let Some(likes) = video.take_likes() {
    println!("{:?}", likes);
}
source

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

Delete the likes from the current object

use activitystreams::prelude::*;

assert!(video.likes().is_some());
video.delete_likes();
assert!(video.likes().is_none());
source

fn source<'a>(&'a self) -> Option<&'a AnyBase>where Self::Inner: 'a,

Fetch the source for the current object

use activitystreams::prelude::*;

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

fn set_source<T>(&mut self, source: T) -> &mut Selfwhere T: Into<AnyBase>,

Set the source for the current object

This overwrites the contents of source

use activitystreams::prelude::*;

video.set_source(iri!("https://example.com"));
source

fn take_source(&mut self) -> Option<AnyBase>

Take the source from the current object, leaving nothing

use activitystreams::prelude::*;

if let Some(source) = video.take_source() {
    println!("{:?}", source);
}
source

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

Delete the source from the current object

use activitystreams::prelude::*;

assert!(video.source().is_some());
video.delete_source();
assert!(video.source().is_none());
source

fn upload_media<'a>(&'a self) -> Option<OneOrMany<&'a IriString>>where Self::Inner: 'a,

Fetch the upload_media for the current object

use activitystreams::prelude::*;

if let Some(upload_media) = video.upload_media() {
    println!("{:?}", upload_media);
}
source

fn set_upload_media(&mut self, upload_media: IriString) -> &mut Self

Set the upload_media for the current object

This overwrites the contents of upload_media

use activitystreams::{prelude::*, iri};

video.set_upload_media(iri!("https://example.com"));
source

fn set_many_upload_medias<I, U>(&mut self, items: I) -> &mut Selfwhere I: IntoIterator<Item = U>, U: Into<IriString>,

Set many upload_medias for the current object

This overwrites the contents of upload_media

use activitystreams::{prelude::*, iri};

video.set_many_upload_medias(vec![
    iri!("https://example.com/one"),
    iri!("https://example.com/two"),
]);
source

fn add_upload_media(&mut self, upload_media: IriString) -> &mut Self

Add a upload_media to the current object

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

use activitystreams::{prelude::*, iri};

video
    .add_upload_media(iri!("https://example.com/one"))
    .add_upload_media(iri!("https://example.com/two"));
source

fn take_upload_media(&mut self) -> Option<OneOrMany<IriString>>

Take the upload_media from the current object, leaving nothing

use activitystreams::prelude::*;

if let Some(upload_media) = video.take_upload_media() {
    println!("{:?}", upload_media);
}
source

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

Delete the upload_media from the current object

use activitystreams::prelude::*;

assert!(video.upload_media().is_some());
video.delete_upload_media();
assert!(video.upload_media().is_none());

Implementors§

source§

impl<T> ApObjectExt for Twhere T: AsApObject,