projects
/
riscv_baremetal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f606ba4
)
console.rs: write entire strings without a loop
author
Kit Rhett Aultman
<kit@kitaultman.com>
Mon, 2 Sep 2024 23:45:48 +0000
(19:45 -0400)
committer
Kit Rhett Aultman
<kit@kitaultman.com>
Mon, 2 Sep 2024 23:45:48 +0000
(19:45 -0400)
The MmioSerialPort already has a write_str() function, so there's no
need to loop the bytes.
Actually, given that MmioSerialPort also has a fmt::Write trait, it's
possible that we don't actually need to implement it for Console at all.
src/console.rs
patch
|
blob
|
history
diff --git
a/src/console.rs
b/src/console.rs
index 3644555f286b6e307726ee71c2b989295e699b8e..511e1a571ce164352b696e60e44e5cd1e4475c90 100644
(file)
--- a/
src/console.rs
+++ b/
src/console.rs
@@
-35,10
+35,7
@@
impl Console {
impl core::fmt::Write for Console {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
- for byte in s.bytes() {
- self.serial_port.send(byte);
- }
- Ok(())
+ return self.serial_port.write_str(s);
}
}