[][src]Trait activitystreams_new::object::ApObjectExt

pub trait ApObjectExt<Inner>: AsApObject<Inner> {
    fn shares<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn set_shares(&mut self, shares: Url) -> &mut Self { ... }
fn take_shares(&mut self) -> Option<Url> { ... }
fn delete_shares(&mut self) -> &mut Self { ... }
fn likes<'a>(&'a self) -> Option<&'a Url>
    where
        Inner: 'a
, { ... }
fn set_likes(&mut self, likes: Url) -> &mut Self { ... }
fn take_likes(&mut self) -> Option<Url> { ... }
fn delete_likes(&mut self) -> &mut Self { ... }
fn source<'a>(&'a self) -> Option<&'a AnyBase>
    where
        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 Url>>
    where
        Inner: 'a
, { ... }
fn set_upload_media(&mut self, upload_media: Url) -> &mut Self { ... }
fn set_many_upload_medias<I>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = Url>
, { ... }
fn add_upload_media(&mut self, upload_media: Url) -> &mut Self { ... }
fn take_upload_media(&mut self) -> Option<OneOrMany<Url>> { ... }
fn delete_upload_media(&mut self) -> &mut Self { ... } }

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

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

Fetch the shares for the current object

use activitystreams_new::prelude::*;

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

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

Set the shares for the current object

This overwrites the contents of shares

use activitystreams_new::{prelude::*, uri};

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

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

Take the shares from the current object, leaving nothing

use activitystreams_new::prelude::*;

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

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

Delete the shares from the current object

use activitystreams_new::prelude::*;

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

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

Fetch the likes for the current object

use activitystreams_new::prelude::*;

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

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

Set the likes for the current object

This overwrites the contents of likes

use activitystreams_new::{prelude::*, uri};

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

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

Take the likes from the current object, leaving nothing

use activitystreams_new::prelude::*;

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

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

Delete the likes from the current object

use activitystreams_new::prelude::*;

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

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

Fetch the source for the current object

use activitystreams_new::prelude::*;

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

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

Set the source for the current object

This overwrites the contents of source

use activitystreams_new::prelude::*;

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

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

Take the source from the current object, leaving nothing

use activitystreams_new::prelude::*;

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

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

Delete the source from the current object

use activitystreams_new::prelude::*;

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

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

Fetch the upload_media for the current object

use activitystreams_new::prelude::*;

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

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

Set the upload_media for the current object

This overwrites the contents of upload_media

use activitystreams_new::{prelude::*, uri};

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

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

Set many upload_medias for the current object

This overwrites the contents of upload_media

use activitystreams_new::{prelude::*, uri};

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

fn add_upload_media(&mut self, upload_media: Url) -> &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_new::{prelude::*, uri};

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

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

Take the upload_media from the current object, leaving nothing

use activitystreams_new::prelude::*;

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

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

Delete the upload_media from the current object

use activitystreams_new::prelude::*;

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

Implementors

impl<T, Inner> ApObjectExt<Inner> for T where
    T: AsApObject<Inner>, 
[src]

Loading content...