Skip to content

Commit 959b9f4

Browse files
ctrlaltmilkGabrielMajeri
authored andcommitted
Implement core::fmt::Write for Serial
1 parent d2f0b3d commit 959b9f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/proto/console/serial.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Abstraction over byte stream devices, also known as serial I/O devices.
22
3+
use core::fmt::Write;
4+
35
use crate::proto::Protocol;
46
use crate::{unsafe_guid, Result, Status};
57
use bitflags::bitflags;
@@ -113,6 +115,12 @@ impl<'boot> Serial<'boot> {
113115
}
114116
}
115117

118+
impl<'boot> Write for Serial<'boot> {
119+
fn write_str(&mut self, s: &str) -> core::fmt::Result {
120+
self.write(s.as_bytes()).map_err(|_| core::fmt::Error)
121+
}
122+
}
123+
116124
/// Structure representing the device's current parameters.
117125
///
118126
/// The default values for all UART-like devices is:

0 commit comments

Comments
 (0)