pub struct RecordingWriter { /* private fields */ }Expand description
Append-only JSONL writer. One file = one stream of exchanges.
Cheap drop semantics: flush is best-effort on drop, explicit
flush available for callers who need durability.
Implementations§
Source§impl RecordingWriter
impl RecordingWriter
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open path, creating it (or appending if it exists).
Sourcepub fn write(&mut self, ex: &RecordedExchange) -> Result<()>
pub fn write(&mut self, ex: &RecordedExchange) -> Result<()>
Append one exchange. Errors propagate so callers can downgrade to “log on failure, don’t crash the request”.
pub fn flush(&mut self) -> Result<()>
Trait Implementations§
Source§impl Drop for RecordingWriter
impl Drop for RecordingWriter
Auto Trait Implementations§
impl Freeze for RecordingWriter
impl RefUnwindSafe for RecordingWriter
impl Send for RecordingWriter
impl Sync for RecordingWriter
impl Unpin for RecordingWriter
impl UnsafeUnpin for RecordingWriter
impl UnwindSafe for RecordingWriter
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> 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