pub enum EventData {
Create(CreateData),
Update(UpdateData),
Move(MoveData),
Assign(AssignData),
Comment(CommentData),
Link(LinkData),
Unlink(UnlinkData),
Delete(DeleteData),
Compact(CompactData),
Snapshot(SnapshotData),
Redact(RedactData),
}Expand description
Typed payload for an event. The discriminant comes from EventType,
not from the JSON itself (it is an external tag in TSJSON).
Serde note: EventData implements Serialize manually (dispatching
to the inner struct) but does not implement Deserialize directly.
Use EventData::deserialize_for with the known EventType to
deserialize from JSON. The Event struct handles this
in its custom Deserialize impl.
Variants§
Create(CreateData)
Payload for item.create.
Update(UpdateData)
Payload for item.update.
Move(MoveData)
Payload for item.move.
Assign(AssignData)
Payload for item.assign.
Comment(CommentData)
Payload for item.comment.
Link(LinkData)
Payload for item.link.
Unlink(UnlinkData)
Payload for item.unlink.
Delete(DeleteData)
Payload for item.delete.
Compact(CompactData)
Payload for item.compact.
Snapshot(SnapshotData)
Payload for item.snapshot.
Redact(RedactData)
Payload for item.redact.
Implementations§
Source§impl EventData
impl EventData
Sourcepub fn deserialize_for(
event_type: EventType,
json: &str,
) -> Result<Self, DataParseError>
pub fn deserialize_for( event_type: EventType, json: &str, ) -> Result<Self, DataParseError>
Deserialize a JSON string into the correct EventData variant based
on the event type.
This is the primary deserialization entry point since the type discriminant lives in a separate TSJSON field, not in the JSON payload.
§Errors
Returns a DataParseError if the JSON is malformed or does not match
the expected schema for the given event type.
Sourcepub fn to_json_value(&self) -> Result<Value, Error>
pub fn to_json_value(&self) -> Result<Value, Error>
Serialize the payload to a serde_json::Value.
§Errors
Returns an error if the inner struct fails to serialize (should not happen with well-formed data).
Trait Implementations§
impl Eq for EventData
impl StructuralPartialEq for EventData
Auto Trait Implementations§
impl Freeze for EventData
impl RefUnwindSafe for EventData
impl Send for EventData
impl Sync for EventData
impl Unpin for EventData
impl UnsafeUnpin for EventData
impl UnwindSafe for EventData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.