[−][src]Trait activitystreams::object::TombstoneExt
Helper methods for interacting with Tombstone types
This trait represents methods valid for any Tombstone.
Documentation for the fields related to these methods can be found on the Tombstone
struct
Provided methods
fn former_type(&self) -> Option<&OneOrMany<AnyBase>>
Fetch the former_type for the current object
use activitystreams::prelude::*; if let Some(former_type) = tombstone.former_type() { println!("{:?}", former_type); }
fn set_former_type<T>(&mut self, former_type: T) -> &mut Self where
T: Into<AnyBase>,
T: Into<AnyBase>,
Set the former_type for the current object
This overwrites the contents of former_type
use activitystreams::prelude::*; tombstone.set_former_type(uri!("https://example.com"));
fn set_many_former_types<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 former_types for the current object
This overwrites the contents of former_type
use activitystreams::prelude::*; tombstone.set_many_former_types(vec![ uri!("https://example.com/one"), uri!("https://example.com/two"), ]);
fn add_former_type<T>(&mut self, former_type: T) -> &mut Self where
T: Into<AnyBase>,
T: Into<AnyBase>,
Add a former_type to the current object
This does not overwrite the contents of former_type, only appends an item
use activitystreams::prelude::*; tombstone .add_former_type(uri!("https://example.com/one")) .add_former_type(uri!("https://example.com/two"));
fn take_former_type(&mut self) -> Option<OneOrMany<AnyBase>>
Take the former_type from the current object, leaving nothing
use activitystreams::prelude::*; if let Some(former_type) = tombstone.take_former_type() { println!("{:?}", former_type); }
fn delete_former_type(&mut self) -> &mut Self
Delete the former_type from the current object
use activitystreams::prelude::*; assert!(tombstone.former_type().is_some()); tombstone.delete_former_type(); assert!(tombstone.former_type().is_none());
fn deleted(&self) -> Option<DateTime<FixedOffset>>
Fetch the deleted for the current object
use activitystreams::prelude::*; if let Some(deleted) = tombstone.deleted() { println!("{:?}", deleted); }
fn set_deleted(&mut self, deleted: DateTime<FixedOffset>) -> &mut Self
Set the deleted for the current object
This overwrites the contents of deleted
use activitystreams::prelude::*; tombstone.set_deleted("2020-04-20T04:20:00Z".parse()?);
fn take_deleted(&mut self) -> Option<DateTime<FixedOffset>>
Take the deleted from the current object, leaving nothing
use activitystreams::prelude::*; if let Some(deleted) = tombstone.take_deleted() { println!("{:?}", deleted); }
fn delete_deleted(&mut self) -> &mut Self
Delete the deleted from the current object
use activitystreams::prelude::*; assert!(tombstone.deleted().is_some()); tombstone.delete_deleted(); assert!(tombstone.deleted().is_none());
Implementors
impl<T> TombstoneExt for T where
T: AsTombstone,
[src]
T: AsTombstone,