#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct DpdkDriver<'a>(NonNull<rte_driver>, PhantomData<&'a rte_driver>);
impl<'a> DpdkDriver<'a>
{
#[inline(always)]
pub fn next(&self) -> Option<Self>
{
let next = self.reference().next.tqe_next;
if next.is_null()
{
None
}
else
{
Some(DpdkDriver(unsafe { NonNull::new_unchecked(next) }, PhantomData))
}
}
#[inline(always)]
pub fn name(&self) -> &'a CStr
{
unsafe { CStr::from_ptr(self.reference().name) }
}
#[inline(always)]
pub fn alias(&self) -> Option<&'a CStr>
{
let alias = self.reference().alias;
if alias.is_null()
{
None
}
else
{
Some(unsafe { CStr::from_ptr(alias) })
}
}
#[inline(always)]
fn reference(&self) -> &rte_driver
{
unsafe { & * self.0.as_ptr() }
}
}