diff options
author | Christian Cunningham <cc@localhost> | 2022-08-24 19:29:00 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-08-24 19:29:00 -0700 |
commit | 6e293d029bd60f5565bb18629e3baf2d049e53cf (patch) | |
tree | a2f0512d72f3465553035f1a3e8f80cd1c7cb8c3 /src/console.rs | |
parent | 0dd19888fdc38516525fe314a7a8d88f809f8319 (diff) |
*cargo fmt
Diffstat (limited to 'src/console.rs')
-rw-r--r-- | src/console.rs | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/src/console.rs b/src/console.rs index 1a732a7..ae3e62b 100644 --- a/src/console.rs +++ b/src/console.rs @@ -1,5 +1,5 @@ //! # UART Console module -//! +//! //! ## Encapsulates base trait for any console. //! ## Wraps the UART console. @@ -7,49 +7,51 @@ /// /// ## Provides trait for consoles. pub mod interface { - use core::fmt; - /// # Write Trait - /// - /// Structure must provide ways to: - /// - Write individual characters - /// - Write formatted strings - /// - Flush write queue - pub trait Write { - /// # Write Character - /// - /// Writes an individual character to a console - fn write_char(&self, c: char); - /// # Write Format - /// - /// Writes a formatted string to a console - fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; - /// # Flush - /// - /// Flush console write queue - fn flush(&self); - } + use core::fmt; + /// # Write Trait + /// + /// Structure must provide ways to: + /// - Write individual characters + /// - Write formatted strings + /// - Flush write queue + pub trait Write { + /// # Write Character + /// + /// Writes an individual character to a console + fn write_char(&self, c: char); + /// # Write Format + /// + /// Writes a formatted string to a console + fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; + /// # Flush + /// + /// Flush console write queue + fn flush(&self); + } - /// # Statistics Trait - /// - /// Structure must provide a way to: - /// - Get how many characters have been written - pub trait Statistics { - /// # Get Written Chars - /// - /// Gets the statistic associated with how many - /// characters have been written to a console. - fn chars_written(&self) -> usize { 0 } - } + /// # Statistics Trait + /// + /// Structure must provide a way to: + /// - Get how many characters have been written + pub trait Statistics { + /// # Get Written Chars + /// + /// Gets the statistic associated with how many + /// characters have been written to a console. + fn chars_written(&self) -> usize { + 0 + } + } - /// # All Trait - /// - /// Structure must provide both Write + Statistics - pub trait All: Write + Statistics {} + /// # All Trait + /// + /// Structure must provide both Write + Statistics + pub trait All: Write + Statistics {} } /// # UART console /// /// Returns a borrow for the UART writer pub fn console() -> &'static crate::uart::Uart { - &crate::uart::UART_WRITER + &crate::uart::UART_WRITER } |