pub struct Envelope {
pub seq: Seq,
pub at: Instant,
pub actor: String,
pub body: Value,
}Expand description
A durably logged occurrence. The fields are §3.7’s, and actor is a stable identity — never
the live Session capability or a token (F5).
Fields§
§seq: Seq§at: Instant§actor: String§body: ValueThe event itself.
A Value, not a JSON tree. It was the latter through Phase 2, and the cost was paid on
every append and every read: build a serde_json::Value, serialise it to text, parse the
text, walk the tree back into a Value — four traversals and two allocations per event, at
the one point §3.7 makes serial. [beck_core::repr] is the encoding now; the JSON repr
stays for things a person reads.
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn to_value(&self, event: Value) -> Value
pub fn to_value(&self, event: Value) -> Value
The envelope as the Envelope[Event] record a fold sees.
Sourcepub fn event(&self) -> Result<Value>
pub fn event(&self) -> Result<Value>
The event. Kept as a method because every caller had one and the type changed underneath them; there is nothing to decode any more.
pub fn decode(bytes: &[u8]) -> Result<Envelope>
Trait Implementations§
impl StructuralPartialEq for Envelope
Auto Trait Implementations§
impl Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
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