cortex_m_log/printer/
generic.rs

1//! Generic printer
2
3use core::fmt;
4
5///Generic printer which works with any `core::fmt::Writer` compatible type
6pub struct GenericPrinter<W> {
7    writer: W,
8}
9
10impl<W> GenericPrinter<W> {
11    /// Create dummy printer
12    pub const fn new(writer: W) -> Self {
13        Self {
14            writer
15        }
16    }
17}
18
19impl<W: fmt::Write> super::Printer for GenericPrinter<W> {
20    type W = W;
21    type M = crate::modes::InterruptFree;
22
23    #[inline]
24    fn destination(&mut self) -> &mut Self::W {
25        &mut self.writer
26    }
27}
28
29//Because we use `InterruptFree` mode
30unsafe impl<W> Sync for GenericPrinter<W> {
31}