[−][src]Crate activitystreams_traits
Traits for Activity Streams
These traits don't provide any functionality other than anotations for types created in other
projects. See the activitystreams-types
crate for examples of how these traits could be used.
Examples
use activitystreams_traits::{Object, Actor}; use serde::{Deserialize, Serialize}; use std::any::Any; #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Persona { #[serde(rename = "@context")] context: String, #[serde(rename = "type")] kind: String, } #[typetag::serde] impl Object for Persona { fn as_any(&self) -> &(dyn Any + 'static) { self } fn as_any_mut(&mut self) -> &mut (dyn Any + 'static) { self } fn duplicate(&self) -> Box<dyn Object + 'static> { Box::new(self.clone()) } } impl Actor for Persona {}
Traits
Activity | An Activity is a subtype of |
Actor |
|
Collection | A Collection is a subtype of |
CollectionPage | Used to represent distinct subsets of items from a Collection. |
IntransitiveActivity | Instances of |
Link | A Link is an indirect, qualified reference to a resource identified by a URL. |
Object | Describes an object of any kind. |