pci: Implementing Debug for PciBdf to aid with debugging
Signed-off-by: Arvind Vasudev <avasudev@crusoeenergy.com>
This commit is contained in:
parent
2f9436bc12
commit
8c07294691
1 changed files with 14 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ mod msix;
|
|||
mod vfio;
|
||||
mod vfio_user;
|
||||
|
||||
use std::fmt::{self, Display};
|
||||
use std::fmt::{self, Debug, Display};
|
||||
use std::num::ParseIntError;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
|
@ -152,6 +152,19 @@ impl From<&PciBdf> for u16 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Debug for PciBdf {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{:04x}:{:02x}:{:02x}.{:01x}",
|
||||
self.segment(),
|
||||
self.bus(),
|
||||
self.device(),
|
||||
self.function()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for PciBdf {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue