use std::io::{Read, Write}; use entry::Entry; pub mod entry; mod error; pub mod layer; pub mod processor; pub use error::Error; pub struct Trace { writer: W, receiver: tokio::sync::mpsc::UnboundedReceiver, } pub struct TraceReader { reader: R, } impl TraceReader { pub fn new(reader: R) -> Self { Self { reader } } fn read(&mut self) -> Option> { serde_json::Deserializer::from_reader(&mut self.reader) .into_iter() .next() .map(|res| res.map_err(Into::into)) } } impl Iterator for TraceReader { type Item = Result; fn next(&mut self) -> Option { self.read() } }