[−][src]Trait activitystreams::activity::OptOriginRefExt
Helper methods for interacting with Activity types with an optional origin field
Documentation for the origin field can be found on the
Delete
struct
Provided methods
fn origin(&self) -> Option<&OneOrMany<AnyBase>>
Fetch the origin for the current activity
use activitystreams::prelude::*; if let Some(origin_ref) = delete.origin() { println!("{:?}", origin_ref); }
fn set_origin<T>(&mut self, origin: T) -> &mut Self where
T: Into<AnyBase>,
T: Into<AnyBase>,
Set the origin for the current activity
This overwrites the contents of origin
use activitystreams::prelude::*; delete.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>,
I: IntoIterator<Item = T>,
T: Into<AnyBase>,
Set many origins for the current activity
This overwrites the contents of origin
use activitystreams::prelude::*; delete.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>,
T: Into<AnyBase>,
Add a origin to the current activity
This does not overwrite the contents of origin, only appends an item
use activitystreams::prelude::*; delete .add_origin(uri!("https://example.com/one")) .add_origin(uri!("https://example.com/two"));
fn take_origin(&mut self) -> Option<OneOrMany<AnyBase>>
Take a origin from the current activity, leaving nothing
use activitystreams::prelude::*; if let Some(origin) = delete.take_origin() { println!("{:?}", origin); }
fn delete_origin(&mut self) -> &mut Self
Delete a origin from the current activity
use activitystreams::prelude::*; assert!(delete.origin().is_some()); delete.delete_origin(); assert!(delete.origin().is_none());
Implementors
impl<T> OptOriginRefExt for T where
T: OptOriginRef,
[src]
T: OptOriginRef,