Skip to main content

Object

Struct Object 

Source
pub struct Object {
Show 82 fields pub id: Option<Url>, pub kind: OneOrMany<String>, pub attachment: OneOrMany<ObjectRef>, pub attributed_to: OneOrMany<ObjectRef>, pub audience: OneOrMany<ObjectRef>, pub content: Option<String>, pub content_map: Option<LanguageMap>, pub context: OneOrMany<ObjectRef>, pub name: Option<String>, pub name_map: Option<LanguageMap>, pub end_time: Option<DateTime<FixedOffset>>, pub generator: OneOrMany<ObjectRef>, pub icon: OneOrMany<ObjectRef>, pub image: OneOrMany<ObjectRef>, pub in_reply_to: OneOrMany<ObjectRef>, pub location: OneOrMany<ObjectRef>, pub preview: OneOrMany<ObjectRef>, pub published: Option<DateTime<FixedOffset>>, pub replies: Option<Box<ObjectRef>>, pub start_time: Option<DateTime<FixedOffset>>, pub summary: Option<String>, pub summary_map: Option<LanguageMap>, pub source: Option<Box<ObjectRef>>, pub sensitive: Option<bool>, pub tag: OneOrMany<ObjectRef>, pub updated: Option<DateTime<FixedOffset>>, pub url: OneOrMany<ObjectRef>, pub to: OneOrMany<ObjectRef>, pub bto: OneOrMany<ObjectRef>, pub cc: OneOrMany<ObjectRef>, pub bcc: OneOrMany<ObjectRef>, pub media_type: Option<String>, pub duration: Option<String>, pub actor: OneOrMany<ObjectRef>, pub object: OneOrMany<ObjectRef>, pub target: OneOrMany<ObjectRef>, pub result: OneOrMany<ObjectRef>, pub origin: OneOrMany<ObjectRef>, pub instrument: OneOrMany<ObjectRef>, pub total_items: Option<u64>, pub current: Option<Box<ObjectRef>>, pub first: Option<Box<ObjectRef>>, pub last: Option<Box<ObjectRef>>, pub items: OneOrMany<ObjectRef>, pub ordered_items: OneOrMany<ObjectRef>, pub part_of: Option<Box<ObjectRef>>, pub next: Option<Box<ObjectRef>>, pub prev: Option<Box<ObjectRef>>, pub start_index: Option<u64>, pub accuracy: Option<f64>, pub altitude: Option<f64>, pub latitude: Option<f64>, pub longitude: Option<f64>, pub radius: Option<f64>, pub units: Option<String>, pub one_of: OneOrMany<ObjectRef>, pub any_of: OneOrMany<ObjectRef>, pub closed: Option<Value>, pub former_type: Option<String>, pub deleted: Option<DateTime<FixedOffset>>, pub relationship_subject: Option<Box<ObjectRef>>, pub relationship: OneOrMany<ObjectRef>, pub describes: Option<Box<ObjectRef>>, pub preferred_username: Option<String>, pub inbox: Option<Url>, pub outbox: Option<Url>, pub followers: Option<Url>, pub following: Option<Url>, pub liked: Option<Url>, pub streams: Vec<Url>, pub public_key: Option<PublicKey>, pub endpoints: Option<Endpoints>, pub featured: Option<Url>, pub featured_tags: Option<Url>, pub manually_approves_followers: Option<bool>, pub discoverable: Option<bool>, pub indexable: Option<bool>, pub memorial: Option<bool>, pub assertion_method: Vec<AssertionMethod>, pub authentication: Vec<AssertionMethod>, pub proof: OneOrMany<Proof>, pub extra: BTreeMap<String, Value>,
}
Expand description

The universal Activity Streams 2.0 object container.

Every specification-defined property across Object, Activity, Collection, and CollectionPage is represented as a typed field. Properties that are absent on the wire are deserialised as None (for scalar fields) or an empty OneOrMany (for array fields). Unknown properties are preserved verbatim in extra, ensuring lossless round-trips across implementations that emit non-standard extensions.

Fields§

§id: Option<Url>

Globally unique identifier of this object.

§kind: OneOrMany<String>

Type(s) of this object. Multiple types are permitted; most Fediverse implementations emit exactly one.

§attachment: OneOrMany<ObjectRef>

Files or media objects attached to this object.

§attributed_to: OneOrMany<ObjectRef>

The actors attributed as creators of this object.

§audience: OneOrMany<ObjectRef>

Intended audience for this object.

§content: Option<String>

Plain-text or HTML content of this object.

§content_map: Option<LanguageMap>

Localised content variants keyed by BCP-47 language tag.

§context: OneOrMany<ObjectRef>

AS 2.0 application-level context property.

Note: this is not the JSON-LD @context — that is handled by WithContext.

§name: Option<String>

Plain-text display name.

§name_map: Option<LanguageMap>

Localised display names keyed by BCP-47 language tag.

§end_time: Option<DateTime<FixedOffset>>

End time for an interval-valued object (xsd:dateTime).

§generator: OneOrMany<ObjectRef>

Entity that generated this object.

§icon: OneOrMany<ObjectRef>

Small iconic representation of this object.

§image: OneOrMany<ObjectRef>

Primary image associated with this object.

§in_reply_to: OneOrMany<ObjectRef>

Objects this object is in reply to.

§location: OneOrMany<ObjectRef>

Associated physical or virtual location.

§preview: OneOrMany<ObjectRef>

Preview resource associated with this object.

§published: Option<DateTime<FixedOffset>>

Publication timestamp (xsd:dateTime).

§replies: Option<Box<ObjectRef>>

Collection of replies to this object.

§start_time: Option<DateTime<FixedOffset>>

Start time for an interval-valued object (xsd:dateTime).

§summary: Option<String>

Plain-text or HTML summary of this object.

§summary_map: Option<LanguageMap>

Localised summary variants keyed by BCP-47 language tag.

§source: Option<Box<ObjectRef>>

ActivityPub §3.3 source property carrying the original representation of the content before transformation to content. Commonly set to {"content": "...", "mediaType": "text/markdown"} by Lemmy, PeerTube and other Fediverse implementations that need a lossless edit channel distinct from the rendered HTML.

§sensitive: Option<bool>

Activity Streams 2.0 extension as:sensitive: marks content as requiring a content warning before display. Mastodon uses this to gate media behind a “show more” control; flipping it on objects without media still propagates the cw flag to compatible clients.

§tag: OneOrMany<ObjectRef>

Tags (mentions, hashtags, emoji) linked to this object.

§updated: Option<DateTime<FixedOffset>>

Last-updated timestamp (xsd:dateTime).

§url: OneOrMany<ObjectRef>

URL(s) providing alternate representations of this object.

§to: OneOrMany<ObjectRef>

Public primary recipients.

§bto: OneOrMany<ObjectRef>

Private primary recipients (stripped before delivery).

§cc: OneOrMany<ObjectRef>

Public secondary recipients.

§bcc: OneOrMany<ObjectRef>

Private secondary recipients (stripped before delivery).

§media_type: Option<String>

MIME type of this object’s payload.

§duration: Option<String>

xsd:duration lexical form (e.g. "PT5M").

§actor: OneOrMany<ObjectRef>

One or more actors performing the activity.

§object: OneOrMany<ObjectRef>

Object of the activity. Omitted for IntransitiveActivity.

§target: OneOrMany<ObjectRef>

Indirect target of the activity.

§result: OneOrMany<ObjectRef>

Result of the activity.

§origin: OneOrMany<ObjectRef>

Origin from which the activity proceeds.

§instrument: OneOrMany<ObjectRef>

Instrument used to perform the activity.

§total_items: Option<u64>

Number of items in the collection.

§current: Option<Box<ObjectRef>>

Current page of a paged collection.

§first: Option<Box<ObjectRef>>

First page of a paged collection.

§last: Option<Box<ObjectRef>>

Last page of a paged collection.

§items: OneOrMany<ObjectRef>

Items in an unordered collection.

§ordered_items: OneOrMany<ObjectRef>

Items in an ordered collection.

§part_of: Option<Box<ObjectRef>>

Collection this page is part of.

§next: Option<Box<ObjectRef>>

Next page.

§prev: Option<Box<ObjectRef>>

Previous page.

§start_index: Option<u64>

Starting index (OrderedCollectionPage only).

§accuracy: Option<f64>

Place: accuracy of the position coordinates in percent [0.0, 100.0].

§altitude: Option<f64>

Place: altitude of the position in units.

§latitude: Option<f64>

Place: latitude of the position in decimal degrees.

§longitude: Option<f64>

Place: longitude of the position in decimal degrees.

§radius: Option<f64>

Place: radius of the position in units.

§units: Option<String>

Place: measurement units for altitude and radius. The AS2.0 vocabulary defines a fixed set ("cm", "feet", "inches", "km", "m", "miles") but any URI is permitted as an extension, so the raw string is preserved.

§one_of: OneOrMany<ObjectRef>

Question: exclusive list of options (only one may be selected).

§any_of: OneOrMany<ObjectRef>

Question: inclusive list of options (any subset may be selected).

§closed: Option<Value>

Question: indicates a question has closed. Per AS2.0 this property is polymorphic (xsd:dateTime | Object | Link | xsd:boolean), so the raw JSON value is preserved verbatim.

§former_type: Option<String>

Tombstone: the type of the object that was deleted.

§deleted: Option<DateTime<FixedOffset>>

Tombstone: timestamp of when the object was deleted.

§relationship_subject: Option<Box<ObjectRef>>

Relationship: the subject individual in the relationship.

Renamed on the wire to avoid clashing with attributed_to; the property name in AS2.0 is subject.

§relationship: OneOrMany<ObjectRef>

Relationship: kind of relationship between relationship_subject and object. May be a URI or an inlined Relationship vocabulary term.

§describes: Option<Box<ObjectRef>>

Profile: the object this profile describes.

§preferred_username: Option<String>

ActivityPub §4.1: short, mention-friendly handle (e.g. "alice"). Mandatory on every Mastodon-style actor.

§inbox: Option<Url>

ActivityPub §4.1: actor’s inbox URL. Servers POST activities here to deliver them to this actor.

§outbox: Option<Url>

ActivityPub §4.1: actor’s outbox URL containing the OrderedCollection of activities they have authored.

§followers: Option<Url>

ActivityPub §4.1: collection of actors following this actor.

§following: Option<Url>

ActivityPub §4.1: collection of actors this actor follows.

§liked: Option<Url>

ActivityPub §4.1: collection of objects this actor has liked.

§streams: Vec<Url>

ActivityPub §4.1: list of additional collections owned by this actor (e.g. groups, lists). Rarely used in practice but defined in the spec.

§public_key: Option<PublicKey>

W3C Security v1 / ActivityPub-via-Mastodon: legacy Cavage-style HTTP-Signature verification key. See PublicKey.

§endpoints: Option<Endpoints>

ActivityPub §4.1 endpoints block (shared inbox, OAuth endpoints, …). See Endpoints.

§featured: Option<Url>

Mastodon toot:featured collection of pinned posts.

§featured_tags: Option<Url>

Mastodon toot:featuredTags collection of pinned hashtags.

§manually_approves_followers: Option<bool>

AS 2.0: whether the actor’s follow requests require manual approval (i.e. private profile).

§discoverable: Option<bool>

Mastodon toot:discoverable: whether the actor opts in to inclusion in directory listings.

§indexable: Option<bool>

Mastodon toot:indexable: whether posts may be indexed by full-text search engines.

§memorial: Option<bool>

Mastodon toot:memorial: whether this account has been memorialised (read-only after death).

§assertion_method: Vec<AssertionMethod>

FEP-521a assertionMethod array of verification methods used for content-signing (FEP-8b32 proofs and similar).

§authentication: Vec<AssertionMethod>

W3C Controlled Identifiers authentication array of verification methods used for proving control of the actor URL (challenge-response auth, signed delete tombstones, …).

§proof: OneOrMany<Proof>

FEP-8b32: zero or more Object Integrity Proofs attached to this document. Multiple entries form a proof chain.

§extra: BTreeMap<String, Value>

Unknown or extension properties preserved verbatim.

This captures any JSON property that does not map to a typed field, ensuring lossless round-tripping through non-standard extensions (e.g. Mastodon’s toot: namespace fields, Lemmy’s moderation metadata, Misskey reactions).

Implementations§

Source§

impl Object

Source

pub fn new() -> Self

Creates an empty Object with no properties set.

Source

pub fn with_kind(kind: impl Into<String>) -> Self

Creates an Object with the given type.

Source

pub fn with_id(self, id: Url) -> Self

Sets the id.

Source

pub fn is_kind(&self, kind: &str) -> bool

Returns true if any of this object’s declared types equals kind.

Source

pub fn primary_kind(&self) -> Option<&str>

Returns the primary (first) type name, if any.

Source

pub fn is_actor(&self) -> bool

Returns true if this object is any of the five standard actor types (Person, Group, Organization, Application, Service).

Source

pub fn is_collection(&self) -> bool

Returns true if this object is any kind of collection or page.

Source

pub fn is_public(&self) -> bool

Returns true if any of the public audience properties address the ActivityPub Public pseudo-actor in any of its spellings.

Per ActivityPub §5.6 only the public-facing addressing fields (to, cc, audience) participate in the public-visibility check. The bto and bcc fields MUST be stripped by the server before delivery to remote inboxes, so including them here would produce incorrect results on the receiver side.

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Object

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Object

Source§

fn default() -> Object

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Object

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl HasId for Object

Source§

fn id(&self) -> Option<&Url>

Returns the id of this object, if set.
Source§

impl PartialEq for Object

Source§

fn eq(&self, other: &Object) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Object

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Object

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.