Skip to main content

Crate actpub_activitystreams

Crate actpub_activitystreams 

Source
Expand description

Activity Streams 2.0 data model and vocabulary.

This crate provides pure data types (no I/O, no networking) for the W3C Activity Streams 2.0 Core and Activity Vocabulary specifications, as used by the ActivityPub protocol.

§Design

The types are designed for idiomatic serde (de)serialization with tolerant handling of the JSON-LD variants emitted by real-world Fediverse implementations such as Mastodon, Pleroma, Lemmy and Misskey.

Core AS 2.0 types (Object, Link, [Activity], [Collection]) are concrete structs with every specification-defined property represented as Option<T> or OneOrMany<T>. Concrete vocabulary types that add no new properties (Note, Article, Create, …) share the core structs and are discriminated by string type constants (kind), while types that add new properties (Question, Place, Tombstone) are provided as dedicated structs that flatten the core object.

§Interoperability

Real Fediverse JSON-LD is inconsistent and requires tolerance:

  • Array-typed properties may appear as a single value (handled by OneOrMany<T>)
  • Object properties may be inlined or appear as plain URL strings (handled by UrlOr<T>)
  • The Public audience appears in multiple equivalent forms
  • Unknown properties are preserved via flattened extension maps

Modules§

kind
String type constants for every name defined in the Activity Streams 2.0 vocabulary and the ActivityPub extension types.

Structs§

Context
The value of a JSON-LD @context property.
Endpoints
ActivityPub §4.1 endpoints block.
Link
An Activity Streams 2.0 Link.
Multikey
FEP-521a Multikey block.
Object
The universal Activity Streams 2.0 object container.
OneOrMany
A value that may serialize as either a single T or as an ordered array of T.
Proof
FEP-8b32 / W3C Data Integrity Proof block.
Public
The Public pseudo-actor used for public audience targeting in ActivityPub.
PublicKey
W3C Security v1 publicKey block.
WithContext
Wraps any Activity Streams payload with a JSON-LD @context.

Enums§

ContextEntry
A single entry in the @context array.
Error
Errors that can arise when parsing or constructing Activity Streams values.
UrlOr
A value that may appear inlined as T or as a bare URL reference.

Traits§

HasId
Types with an optional id URL, enabling uniform reference resolution.

Type Aliases§

AssertionMethod
A reference to a verification method, either as a bare URL or an inlined Multikey document.
LanguageMap
A language map keyed by BCP-47 language tag, as used by contentMap, summaryMap, and nameMap.
ObjectRef
A reference-valued property that may appear as a bare URL or as an inlined Object.
Result
Crate Result alias with the default error type set to Error.