pub trait Deserializer:
DynClone
+ Send
+ Sync {
// Required method
fn parse(
&self,
bytes: Bytes,
log_namespace: LogNamespace,
) -> Result<SmallVec<[Event; 1]>>;
// Provided method
fn parse_traces(&self, _bytes: Bytes) -> Result<SmallVec<[Event; 1]>> { ... }
}Expand description
Parse structured events from bytes.
Required Methods§
Sourcefn parse(
&self,
bytes: Bytes,
log_namespace: LogNamespace,
) -> Result<SmallVec<[Event; 1]>>
fn parse( &self, bytes: Bytes, log_namespace: LogNamespace, ) -> Result<SmallVec<[Event; 1]>>
Parses structured events from bytes.
It returns a SmallVec rather than an Event directly, since one byte
frame can potentially hold multiple events, e.g. when parsing a JSON
array. However, we optimize the most common case of emitting one event
by not requiring heap allocations for it.
Note: The type of the produced events depends on the implementation.
Provided Methods§
Sourcefn parse_traces(&self, _bytes: Bytes) -> Result<SmallVec<[Event; 1]>>
fn parse_traces(&self, _bytes: Bytes) -> Result<SmallVec<[Event; 1]>>
Parses trace events from bytes.