diff options
author | Christian Cunningham <cc@localhost> | 2022-08-19 21:22:18 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-08-19 21:22:18 -0700 |
commit | 26ab71043d97c1b06bdd252378b64171cb95b1a9 (patch) | |
tree | 9bea25574fc20e77a4faae6811add97e0a248175 /src/console.rs | |
parent | 0d061dac9e31831e4fe426a0df777463043868d7 (diff) |
Updated docs
Diffstat (limited to 'src/console.rs')
-rw-r--r-- | src/console.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/console.rs b/src/console.rs index bcde05a..1a732a7 100644 --- a/src/console.rs +++ b/src/console.rs @@ -1,18 +1,55 @@ +//! # UART Console module +//! +//! ## Encapsulates base trait for any console. +//! ## Wraps the UART console. + +/// # Interface module +/// +/// ## 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); } + /// # 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 {} } +/// # UART console +/// +/// Returns a borrow for the UART writer pub fn console() -> &'static crate::uart::Uart { &crate::uart::UART_WRITER } |