Struct DltLogWriter

Source
pub struct DltLogWriter { /* private fields */ }
Expand description

Builder for structured log messages with multiple typed fields

Construct log messages with typed data fields sent in binary format for efficiency. Each field retains type information for proper display in DLT viewers.

§Usage

  1. Start with DltContextHandle::log_write_start()
  2. Chain write_* methods to add fields
  3. Call finish() to send

Auto-finishes on drop if finish() not called (errors ignored).

§Example

    "Measurement and Bus Trace Interface")?;
let mut writer = ctx.log_write_start(DltLogLevel::Info)?;
writer.write_string("Temperature:")?
   .write_float32(87.5)?
   .write_string("°C")?;
writer.finish()?;

§Available Methods

write_string() | write_i32() | write_u32() | write_int64() | write_uint64() | write_float32() | write_float64() | write_bool()

Implementations§

Source§

impl DltLogWriter

Source

pub fn write_string(&mut self, text: &str) -> Result<&mut Self, DltSysError>

Write a string to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_u32(&mut self, value: u32) -> Result<&mut Self, DltSysError>

Write an unsigned integer to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_i32(&mut self, value: i32) -> Result<&mut Self, DltSysError>

Write a signed integer to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_uint64(&mut self, value: u64) -> Result<&mut Self, DltSysError>

Write an unsigned 64-bit integer to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_int64(&mut self, value: i64) -> Result<&mut Self, DltSysError>

Write a signed 64-bit integer to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_float32(&mut self, value: f32) -> Result<&mut Self, DltSysError>

Write a 32-bit float to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_float64(&mut self, value: f64) -> Result<&mut Self, DltSysError>

Write a 64-bit float to the log message

§Errors

Returns DltError if writing fails

Source

pub fn write_bool(&mut self, value: bool) -> Result<&mut Self, DltSysError>

Write a boolean to the log message

§Errors

Returns DltError if writing fails

Source

pub fn finish(self) -> Result<(), DltSysError>

Finish and send the log message

Explicitly finishes the log message. If not called, the message will be automatically finished when the DltLogWriter is dropped, but errors will be ignored.

§Errors

Returns DltError if finishing fails

Trait Implementations§

Source§

impl Drop for DltLogWriter

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.