pub struct SpectraEvent {
pub table: String,
pub fields: Value,
pub ts: Option<DateTime<Utc>>,
}Expand description
Structured event envelope for transport publish wrappers.
Consumer side: deserialize from your bus, then append via
crate::EventStorageBackend or a Spectra runtime that owns events storage.
Direct in-process logging usually uses a generated *Logger or try_log_event.
§Examples
use serde_json::json;
use spectra_core::SpectraEvent;
let event = SpectraEvent::new(
"request_log",
json!({"message": "handled", "status": 200}),
);
assert_eq!(event.table, "request_log");
assert!(event.ts.is_none());Fields§
§table: StringEvent table name.
fields: ValueEvent field payload.
ts: Option<DateTime<Utc>>Optional explicit timestamp (defaults to sink time when absent).
Implementations§
Trait Implementations§
Source§impl Clone for SpectraEvent
impl Clone for SpectraEvent
Source§fn clone(&self) -> SpectraEvent
fn clone(&self) -> SpectraEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpectraEvent
impl Debug for SpectraEvent
Source§impl<'de> Deserialize<'de> for SpectraEvent
impl<'de> Deserialize<'de> for SpectraEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpectraEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpectraEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SpectraEvent
impl Serialize for SpectraEvent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SpectraEvent
impl RefUnwindSafe for SpectraEvent
impl Send for SpectraEvent
impl Sync for SpectraEvent
impl Unpin for SpectraEvent
impl UnsafeUnpin for SpectraEvent
impl UnwindSafe for SpectraEvent
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