pub struct EventStream {
pub schema: EventSchema,
pub records: Vec<EventRecord>,
}Fields§
§schema: EventSchema§records: Vec<EventRecord>Implementations§
Source§impl EventStream
impl EventStream
pub fn new(schema: EventSchema) -> Result<Self>
pub fn events(&self) -> u64
pub fn timed(&self) -> bool
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Structural check: times aligned with symbols and never going back.
Sourcepub fn symbol_records(&self) -> Vec<Vec<String>>
pub fn symbol_records(&self) -> Vec<Vec<String>>
The symbols alone, one sequence per record.
Sourcepub fn fingerprint(&self) -> Result<String>
pub fn fingerprint(&self) -> Result<String>
SHA-256 over the schema and every record: keys, names and times.
Sourcepub fn split_last(self, fraction: f64) -> Result<(EventStream, EventStream)>
pub fn split_last(self, fraction: f64) -> Result<(EventStream, EventStream)>
Split into the first records and the last fraction of them. Each
side gets at least one record; a stream with fewer than two is an error.
Sourcepub fn read_jsonl(&mut self, reader: impl BufRead, source: &str) -> Result<()>
pub fn read_jsonl(&mut self, reader: impl BufRead, source: &str) -> Result<()>
Read JSON Lines: one object per line, one event per object.
Records are formed by the group field and listed in order of first appearance. Within a record events are put in time order; events with equal times keep the order of the file. A line without the symbol field, with a symbol that is not a string, or with a time that is not a whole number is an error: nothing is skipped or rounded.
Trait Implementations§
Source§impl Clone for EventStream
impl Clone for EventStream
Source§impl Debug for EventStream
impl Debug for EventStream
Source§impl<'de> Deserialize<'de> for EventStream
impl<'de> Deserialize<'de> for EventStream
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 Eq for EventStream
Source§impl PartialEq for EventStream
impl PartialEq for EventStream
Source§impl Serialize for EventStream
impl Serialize for EventStream
impl StructuralPartialEq for EventStream
Auto Trait Implementations§
impl Forget for EventStream
impl Freeze for EventStream
impl Move for EventStream
impl RefUnwindSafe for EventStream
impl Send for EventStream
impl Sync for EventStream
impl Unpin for EventStream
impl UnsafeUnpin for EventStream
impl UnwindSafe for EventStream
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