pub struct Event<P = Value> {
pub protocol: String,
pub kind: String,
pub actor: AgentId,
pub created_at: i64,
pub nonce: u64,
pub room_id: Option<String>,
pub base_seq: Option<u64>,
pub base_hash: Option<String>,
pub mentions: Option<Vec<AgentId>>,
pub payload: P,
pub extra: BTreeMap<String, Value>,
}Fields§
§protocol: String§kind: String§actor: AgentId§created_at: i64§nonce: u64§room_id: Option<String>§base_seq: Option<u64>§base_hash: Option<String>§mentions: Option<Vec<AgentId>>None when the field is absent. An explicit empty list is kept, so a
deserialized event re-serializes to the bytes that were signed.
payload: P§extra: BTreeMap<String, Value>Unknown top-level fields, kept so the event hashes as signed. Protocol validators reject them (the closed event object, Section 5.1).
Implementations§
Source§impl<P> Event<P>
impl<P> Event<P>
pub fn new( protocol: impl Into<String>, kind: impl Into<String>, actor: AgentId, created_at: i64, nonce: u64, payload: P, ) -> Self
pub fn with_room_id(self, room_id: impl Into<String>) -> Self
pub fn with_room_head(self, base_seq: u64, base_hash: impl Into<String>) -> Self
pub fn with_mentions(self, mentions: Vec<AgentId>) -> Self
pub fn with_mention(self, agent_id: AgentId) -> Self
Trait Implementations§
Source§impl<'de, P> Deserialize<'de> for Event<P>where
P: Deserialize<'de>,
impl<'de, P> Deserialize<'de> for Event<P>where
P: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<P: PartialEq> StructuralPartialEq for Event<P>
Auto Trait Implementations§
impl<P> Freeze for Event<P>where
P: Freeze,
impl<P> RefUnwindSafe for Event<P>where
P: RefUnwindSafe,
impl<P> Send for Event<P>where
P: Send,
impl<P> Sync for Event<P>where
P: Sync,
impl<P> Unpin for Event<P>where
P: Unpin,
impl<P> UnsafeUnpin for Event<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Event<P>where
P: UnwindSafe,
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
Mutably borrows from an owned value. Read more