pub struct Consumer<T> { /* private fields */ }Expand description
Consumes an ordered log of JSON records from a track, yielding every record in order.
A Decoder that owns its track: it reads one record per frame, in order. The log is a single
group, which is what makes the mode lossless: rolling to a second group means the records that
would have completed the first are gone, so a Producer that cannot write
ends the track instead. A second group is therefore a broken publisher, and reading it would
present a gap as a continuous log, so it fails with Error::Rolled
rather than yielding the remainder. When something else already owns the track, use the
Decoder directly.
The failure does not wait for the first group to end: whatever has already arrived in it is yielded, and the read then fails rather than blocking on a group a broken publisher may never finish.
Implementations§
Source§impl<T: DeserializeOwned> Consumer<T>
impl<T: DeserializeOwned> Consumer<T>
Sourcepub fn new(track: Subscriber, config: Config) -> Self
pub fn new(track: Subscriber, config: Config) -> Self
Create a consumer reading from the given track subscriber.
Set Config::compression to match the encoder that wrote the track.