Skip to content

Commit 566ef4f

Browse files
mkroeningIsaacWoods
authored andcommitted
feat: add forwarding impl ConfigRegionAccess for &T
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
1 parent c103e41 commit 566ef4f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ pub trait ConfigRegionAccess {
9292
unsafe fn write(&self, address: PciAddress, offset: u16, value: u32);
9393
}
9494

95+
impl<T: ConfigRegionAccess + ?Sized> ConfigRegionAccess for &T {
96+
#[inline]
97+
fn function_exists(&self, address: PciAddress) -> bool {
98+
(**self).function_exists(address)
99+
}
100+
101+
#[inline]
102+
unsafe fn read(&self, address: PciAddress, offset: u16) -> u32 {
103+
(**self).read(address, offset)
104+
}
105+
106+
#[inline]
107+
unsafe fn write(&self, address: PciAddress, offset: u16, value: u32) {
108+
(**self).write(address, offset, value)
109+
}
110+
}
111+
95112
#[non_exhaustive]
96113
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
97114
pub enum HeaderType {

0 commit comments

Comments
 (0)