pub struct Device(/* private fields */);
Expand description
The PCI device representation.
A PCI device is based on an always reference counted device:Device
instance. Cloning a PCI
device, hence, also increments the base device’ reference count.
§Invariants
Device
hold a valid reference of ARef<device::Device>
whose underlying struct device
is a
member of a struct pci_dev
.
Implementations§
Source§impl Device
impl Device
Sourcepub unsafe fn from_dev(dev: ARef<Device>) -> Self
pub unsafe fn from_dev(dev: ARef<Device>) -> Self
Create a PCI Device instance from an existing device::Device
.
§Safety
dev
must be an ARef<device::Device>
whose underlying bindings::device
is a member of
a bindings::pci_dev
.
Sourcepub fn enable_device_mem(&self) -> Result
pub fn enable_device_mem(&self) -> Result
Enable memory resources for this device.
Sourcepub fn set_master(&self)
pub fn set_master(&self)
Enable bus-mastering for this device.
Sourcepub fn resource_len(&self, bar: u32) -> Result<resource_size_t>
pub fn resource_len(&self, bar: u32) -> Result<resource_size_t>
Returns the size of the given PCI bar resource.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Device
impl !RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl !Unpin for Device
impl !UnwindSafe for Device
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more