Skip to content

Commit 22b667a

Browse files
authored
Merge branch 'main' into serial
2 parents 85c74e1 + 01a164c commit 22b667a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Add the list of code owners here (using their GitHub username)
2-
* @andreeaflorescu @lauralt @gsserge @roypat @JonathanWoollett-Light
2+
* @andreeaflorescu @lauralt @gsserge @roypat @ShadowCurse

rust-vmm-ci

vm-superio/src/serial.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! This is done by emulating an UART serial port.
1212
1313
use std::collections::VecDeque;
14+
use std::error::Error as StdError;
15+
use std::fmt;
1416
use std::io::{self, Write};
1517
use std::result::Result;
1618
use std::sync::Arc;
@@ -292,6 +294,18 @@ pub enum Error<E> {
292294
FullFifo,
293295
}
294296

297+
impl<E: fmt::Display> fmt::Display for Error<E> {
298+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
299+
match self {
300+
Error::Trigger(e) => write!(f, "Failed to trigger interrupt: {}", e),
301+
Error::IOError(e) => write!(f, "Couldn't write/flush to the given destination: {}", e),
302+
Error::FullFifo => write!(f, "No space left in FIFO"),
303+
}
304+
}
305+
}
306+
307+
impl<E: StdError> StdError for Error<E> {}
308+
295309
impl<T: Trigger, W: Write> Serial<T, NoEvents, W> {
296310
/// Creates a new `Serial` instance which writes the guest's output to
297311
/// `out` and uses `trigger` object to notify the driver about new

0 commit comments

Comments
 (0)