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<EventStream, KuteError>
pub fn events(&self) -> u64
pub fn timed(&self) -> bool
Sourcepub fn validate(&self) -> Result<(), KuteError>
pub fn validate(&self) -> Result<(), KuteError>
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, KuteError>
pub fn fingerprint(&self) -> Result<String, KuteError>
SHA-256 over the schema and every record: keys, names and times.
Sourcepub fn split_last(
self,
fraction: f64,
) -> Result<(EventStream, EventStream), KuteError>
pub fn split_last( self, fraction: f64, ) -> Result<(EventStream, EventStream), KuteError>
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<(), KuteError>
pub fn read_jsonl( &mut self, reader: impl BufRead, source: &str, ) -> Result<(), KuteError>
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§fn clone(&self) -> EventStream
fn clone(&self) -> EventStream
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 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<EventStream, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventStream, <__D as Deserializer<'de>>::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
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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more