[][src]Trait activitystreams_new::activity::TargetRefExt

pub trait TargetRefExt: TargetRef {
    fn target(&self) -> &OneOrMany<AnyBase> { ... }
fn set_target<T>(&mut self, target: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_targets<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_target<T>(&mut self, target: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... } }

Helper methods for interacting with Activity types with a target field

Documentation for the target field can be found on the Invite struct

Provided methods

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

Fetch the target for the current activity

use activitystreams_new::prelude::*;

let target_ref = invite.target();
println!("{:?}", target_ref);

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

Set the target for the current activity

This overwrites the contents of target

use activitystreams_new::prelude::*;

invite.set_target(uri!("https://example.com"));

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

Set many targets for the current activity

This overwrites the contents of target

use activitystreams_new::prelude::*;

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

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

Add a target to the current activity

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

use activitystreams_new::prelude::*;

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

Implementors

impl<T> TargetRefExt for T where
    T: TargetRef
[src]

Loading content...