Struct notedealer::activitypub::Object
source · [−]pub struct Object<'a> {Show 36 fields
pub context: Option<ObjectsOrLinks<'a>>,
pub type_: Option<Links<'a>>,
pub id: Option<Cow<'a, str>>,
pub attributed_to: Option<ObjectsOrLinks<'a>>,
pub name: Option<Cow<'a, str>>,
pub name_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>,
pub summary: Option<Cow<'a, str>>,
pub summary_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>,
pub audience: Option<ObjectsOrLinks<'a>>,
pub content: Option<Cow<'a, str>>,
pub content_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>,
pub to: Option<ObjectsOrLinks<'a>>,
pub bto: Option<ObjectsOrLinks<'a>>,
pub cc: Option<ObjectsOrLinks<'a>>,
pub bcc: Option<ObjectsOrLinks<'a>>,
pub in_reply_to: Option<ObjectsOrLinks<'a>>,
pub published: Option<Date>,
pub actor: Option<ObjectsOrLinks<'a>>,
pub object: Option<ObjectOrLink<'a>>,
pub target: Option<ObjectOrLink<'a>>,
pub total_items: Option<u32>,
pub current: Option<ObjectOrLink<'a>>,
pub first: Option<ObjectOrLink<'a>>,
pub last: Option<ObjectOrLink<'a>>,
pub ordered_items: Option<ObjectsOrLinks<'a>>,
pub prev: Option<ObjectOrLink<'a>>,
pub next: Option<ObjectOrLink<'a>>,
pub part_of: Option<ObjectOrLink<'a>>,
pub inbox: Option<Cow<'a, str>>,
pub outbox: Option<Cow<'a, str>>,
pub following: Option<Cow<'a, str>>,
pub followers: Option<Cow<'a, str>>,
pub liked: Option<Cow<'a, str>>,
pub streams: Option<Links<'a>>,
pub preferred_username: Option<Cow<'a, str>>,
pub endpoints: Option<ApEndpoints<'a>>,
}Expand description
A general struct describing any* Activity Streams 2.0 object. See also: Activity Vocabulary.
This is simply a strongly typed version of the JSON used to describe the objects specified in the standard. Extensions are not supported by design.
Most of the fields contain ObjectsOrLinks as the standard is quite loose
with specifying what fits in which property: almost all of them can have
none, one, or many values, and those values can simply refer to an object by
id (“links”) or be the entire object, hence the very nested and recursive
structure of this object. In practice, these objects aren’t that
sprawling, mostly recursing one or two levels deep.
All the properties are converted from snake_case to camelCase. See the 4. Properties chapter of the Activity Vocabulary for descriptions of all the fields.
* Currently not all properties of Activity Streams 2.0 objects are included, as this isn’t a full implementation.
Fields
context: Option<ObjectsOrLinks<'a>>Serializes and deserializes to and from “@context”. Renamed for Rust variable naming rules.
type_: Option<Links<'a>>Serializes and deserializes to and from “type”. Renamed for Rust variable naming rules.
id: Option<Cow<'a, str>>This is a Some in almost all cases: only anonymous objects, such as
those submitted to the server during a C2S interaction where the Object
hasn’t yet been properly finalized.
attributed_to: Option<ObjectsOrLinks<'a>>name: Option<Cow<'a, str>>name_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>summary: Option<Cow<'a, str>>summary_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>audience: Option<ObjectsOrLinks<'a>>content: Option<Cow<'a, str>>content_map: Option<HashMap<Cow<'a, str>, Cow<'a, str>>>to: Option<ObjectsOrLinks<'a>>bto: Option<ObjectsOrLinks<'a>>cc: Option<ObjectsOrLinks<'a>>bcc: Option<ObjectsOrLinks<'a>>in_reply_to: Option<ObjectsOrLinks<'a>>published: Option<Date>actor: Option<ObjectsOrLinks<'a>>object: Option<ObjectOrLink<'a>>target: Option<ObjectOrLink<'a>>total_items: Option<u32>current: Option<ObjectOrLink<'a>>first: Option<ObjectOrLink<'a>>last: Option<ObjectOrLink<'a>>ordered_items: Option<ObjectsOrLinks<'a>>prev: Option<ObjectOrLink<'a>>next: Option<ObjectOrLink<'a>>part_of: Option<ObjectOrLink<'a>>inbox: Option<Cow<'a, str>>outbox: Option<Cow<'a, str>>following: Option<Cow<'a, str>>followers: Option<Cow<'a, str>>liked: Option<Cow<'a, str>>streams: Option<Links<'a>>preferred_username: Option<Cow<'a, str>>endpoints: Option<ApEndpoints<'a>>Implementations
sourceimpl Object<'_>
impl Object<'_>
sourcepub fn has_type(&self, link: &str) -> bool
pub fn has_type(&self, link: &str) -> bool
Returns true if the type_ field of the object is or contains the given
link. Generally these are from the Activity Streams spec, so they’re not
fully qualified urls, e.g. "Note" or "Follow".
sourcepub fn is_actor(&self) -> bool
pub fn is_actor(&self) -> bool
Returns true if the type of this object is one of the Actor types. See 3.2 Actor Types in the Activity Vocabulary.
sourcepub fn compact(&mut self)
pub fn compact(&mut self)
Recursively calls ObjectOrLink::compact for all the ObjectOrLink
and ObjectsOrLinks properties in this object.