[][src]Trait activitystreams_new::activity::OriginRefExt

pub trait OriginRefExt: OriginRef {
    fn origin(&self) -> &OneOrMany<AnyBase> { ... }
fn set_origin<T>(&mut self, origin: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_origins<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_origin<T>(&mut self, origin: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... } }

Helper methods for interacting with Activity types with an origin

Documentation for the origin field can be found on the Arrive struct

Provided methods

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

Fetch the origin for the current activity

use activitystreams_new::prelude::*;

let origin_ref = arrive.origin();
println!("{:?}", origin_ref);

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

Set the origin for the current activity

This overwrites the contents of origin

use activitystreams_new::prelude::*;

arrive.set_origin(uri!("https://example.com"));

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

Set many origins for the current activity

This overwrites the contents of origin

use activitystreams_new::prelude::*;

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

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

Add a origin to the current activity

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

use activitystreams_new::prelude::*;

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

Implementors

impl<T> OriginRefExt for T where
    T: OriginRef
[src]

Loading content...