[−][src]Trait activitystreams::activity::TargetRefExt
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::prelude::*; let target_ref = invite.target(); println!("{:?}", target_ref);
fn set_target<T>(&mut self, target: T) -> &mut Self where
T: Into<AnyBase>,
T: Into<AnyBase>,
Set the target for the current activity
This overwrites the contents of target
use activitystreams::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>,
I: IntoIterator<Item = T>,
T: Into<AnyBase>,
Set many targets for the current activity
This overwrites the contents of target
use activitystreams::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>,
T: Into<AnyBase>,
Add a target to the current activity
This does not overwrite the contents of target, only appends an item
use activitystreams::prelude::*; invite .add_target(uri!("https://example.com/one")) .add_target(uri!("https://example.com/two"));