pub struct RecordEvent {
pub live: bool,
pub rev: CompactString,
pub did: Box<str>,
pub collection: Box<str>,
pub rkey: CompactString,
pub action: RecordAction,
pub cid: Option<CompactString>,
pub record: Option<Value>,
}Expand description
A repository record event from TAP.
Contains information about a record change in a user’s repository, including the action taken and the record data (for creates/updates).
Fields§
§live: boolTrue if from live firehose, false if from backfill/resync.
During initial sync or recovery, TAP delivers historical events
with live: false. Once caught up, live events have live: true.
rev: CompactStringRepository revision identifier.
Typically 13 characters, stored inline via CompactString SSO.
did: Box<str>Actor DID (e.g., “did:plc:xyz123”).
collection: Box<str>Collection NSID (e.g., “app.bsky.feed.post”).
rkey: CompactStringRecord key within the collection.
Typically a TID (13 characters), stored inline via CompactString SSO.
action: RecordActionThe action performed on the record.
cid: Option<CompactString>Content identifier (CID) of the record.
Present for create and update actions, absent for delete.
record: Option<Value>Record data as JSON value.
Present for create and update actions, absent for delete.
Use parse_record to deserialize on demand.
Implementations§
Source§impl RecordEvent
impl RecordEvent
Sourcepub fn parse_record<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn parse_record<T: DeserializeOwned>(&self) -> Result<T, Error>
Parse the record payload into a typed structure.
This method deserializes the raw JSON on demand, avoiding unnecessary allocations when the record data isn’t needed.
§Errors
Returns an error if the record is absent (delete events) or if deserialization fails.
§Example
use serde::Deserialize;
#[derive(Deserialize)]
struct Post {
text: String,
#[serde(rename = "createdAt")]
created_at: String,
}
let post: Post = record_event.parse_record()?;
println!("Post text: {}", post.text);Sourcepub fn record_value(&self) -> Option<&Value>
pub fn record_value(&self) -> Option<&Value>
Returns the record as a JSON Value reference, if present.
Trait Implementations§
Source§impl Clone for RecordEvent
impl Clone for RecordEvent
Source§fn clone(&self) -> RecordEvent
fn clone(&self) -> RecordEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more