embassy-usb-logger

Crates

git

Versions

default

Flavors

embassy_usb_logger

Struct UsbLogger

Source
pub struct UsbLogger<const N: usize, T: ReceiverHandler + Send + Sync> { /* private fields */ }
Expand description

The logger handle, which contains a pipe with configurable size for buffering log messages.

Implementations§

Source§

impl<const N: usize, T: ReceiverHandler + Send + Sync> UsbLogger<N, T>

Source

pub const fn new() -> Self

Create a new logger instance.

Source

pub const fn with_custom_style( custom_style: fn(_: &Record<'_>, _: &mut Writer<'_, N>), ) -> Self

Create a new logger instance with a custom formatter.

Source

pub fn with_handler(&mut self, handler: T)

Add a command handler to the logger

Source

pub async fn run<'d, D>( &'d self, state: &'d mut LoggerState<'d>, driver: D, ) -> !
where D: Driver<'d>, Self: 'd,

Run the USB logger using the state and USB driver. Never returns.

Source

pub async fn create_future_from_class<'d, D>( &'d self, class: CdcAcmClass<'d, D>, )
where D: Driver<'d>,

Creates the futures needed for the logger from a given class This can be used in cases where the usb device is already in use for another connection

Trait Implementations§

Source§

impl<const N: usize, T: ReceiverHandler + Send + Sync> Log for UsbLogger<N, T>

Source§

fn enabled(&self, _metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be logged. Read more
Source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
Source§

fn flush(&self)

Flushes any buffered records. Read more

Auto Trait Implementations§

§

impl<const N: usize, T> !Freeze for UsbLogger<N, T>

§

impl<const N: usize, T> !RefUnwindSafe for UsbLogger<N, T>

§

impl<const N: usize, T> Send for UsbLogger<N, T>

§

impl<const N: usize, T> Sync for UsbLogger<N, T>

§

impl<const N: usize, T> Unpin for UsbLogger<N, T>
where T: Unpin,

§

impl<const N: usize, T> UnwindSafe for UsbLogger<N, T>
where T: UnwindSafe,

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.