Struct diagnostics_log_encoding::encode::Encoder
source · pub struct Encoder<B> { /* private fields */ }
Expand description
An Encoder
wraps any value implementing MutableBuffer
and writes diagnostic stream records
into it.
Implementations§
source§impl<B> Encoder<B>where
B: MutableBuffer,
impl<B> Encoder<B>where
B: MutableBuffer,
sourcepub fn inner(&self) -> &B
pub fn inner(&self) -> &B
Returns a reference to the underlying buffer being used for encoding.
sourcepub fn write_event<'a, E, MS, T>(
&mut self,
params: WriteEventParams<'a, E, T, MS>
) -> Result<(), EncodingError>
pub fn write_event<'a, E, MS, T>( &mut self, params: WriteEventParams<'a, E, T, MS> ) -> Result<(), EncodingError>
Writes a [tracing::Event
] to the buffer as a record.
Fails if there is insufficient space in the buffer for encoding.
sourcepub fn write_record<R>(&mut self, record: &R) -> Result<(), EncodingError>where
R: RecordFields,
pub fn write_record<R>(&mut self, record: &R) -> Result<(), EncodingError>where
R: RecordFields,
Writes a Record to the buffer.
sourcepub fn write_argument<'a>(
&mut self,
argument: impl Borrow<Argument<'a>>
) -> Result<(), EncodingError>
pub fn write_argument<'a>( &mut self, argument: impl Borrow<Argument<'a>> ) -> Result<(), EncodingError>
Writes an argument with this encoder.
Trait Implementations§
source§impl<B: MutableBuffer> Visit for Encoder<B>
impl<B: MutableBuffer> Visit for Encoder<B>
source§fn record_debug(&mut self, field: &Field, value: &dyn Debug)
fn record_debug(&mut self, field: &Field, value: &dyn Debug)
Visit a value implementing
fmt::Debug
.source§fn record_str(&mut self, field: &Field, value: &str)
fn record_str(&mut self, field: &Field, value: &str)
Visit a string value.
source§fn record_i64(&mut self, field: &Field, value: i64)
fn record_i64(&mut self, field: &Field, value: i64)
Visit a signed 64-bit integer value.
source§fn record_u64(&mut self, field: &Field, value: u64)
fn record_u64(&mut self, field: &Field, value: u64)
Visit an unsigned 64-bit integer value.
source§fn record_bool(&mut self, field: &Field, value: bool)
fn record_bool(&mut self, field: &Field, value: bool)
Visit a boolean value.
§fn record_f64(&mut self, field: &Field, value: f64)
fn record_f64(&mut self, field: &Field, value: f64)
Visit a double-precision floating point value.
§fn record_i128(&mut self, field: &Field, value: i128)
fn record_i128(&mut self, field: &Field, value: i128)
Visit a signed 128-bit integer value.
§fn record_u128(&mut self, field: &Field, value: u128)
fn record_u128(&mut self, field: &Field, value: u128)
Visit an unsigned 128-bit integer value.
§fn record_error(&mut self, field: &Field, value: &(dyn Error + 'static))
fn record_error(&mut self, field: &Field, value: &(dyn Error + 'static))
Records a type implementing
Error
.Auto Trait Implementations§
impl<B> Freeze for Encoder<B>where
B: Freeze,
impl<B> RefUnwindSafe for Encoder<B>where
B: RefUnwindSafe,
impl<B> Send for Encoder<B>where
B: Send,
impl<B> Sync for Encoder<B>where
B: Sync,
impl<B> Unpin for Encoder<B>where
B: Unpin,
impl<B> UnwindSafe for Encoder<B>where
B: UnwindSafe,
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