#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct InputOutputPort(rte_pci_ioport);
impl Drop for InputOutputPort
{
#[inline(always)]
fn drop(&mut self)
{
let result = unsafe { ::dpdk_sys::rte_eal_pci_ioport_unmap(&mut self.0) };
if likely(result == 0)
{
return;
}
match result
{
negative if negative < 0 => panic!("Could not unmap PCI I/O Port"),
_ => panic!("rte_eal_pci_ioport_unmap() returned illegal result '{}'", result),
}
}
}
impl InputOutputPort
{
#[inline(always)]
pub fn new(data: rte_pci_ioport) -> Self
{
InputOutputPort(data)
}
#[inline(always)]
pub fn read(&mut self, readInto: &mut [u8], offsetIntoPort: isize)
{
unsafe { ::dpdk_sys::rte_eal_pci_ioport_read(&mut self.0, readInto.as_mut_ptr() as *mut c_void, readInto.len(), offsetIntoPort as off_t) }
}
#[inline(always)]
pub fn write(&mut self, writeFrom: &[u8], offsetIntoPort: isize)
{
unsafe { ::dpdk_sys::rte_eal_pci_ioport_read(&mut self.0, writeFrom.as_ptr() as *mut c_void, writeFrom.len(), offsetIntoPort as off_t) }
}
}