pub struct UsedRing<'a> {
pub flags: &'a mut u16,
pub idx: &'a mut u16,
pub ring: &'a mut [RawUsedRingEntry],
pub avail_event: &'a mut u16,
}
Expand description
Used ring structure
This structure is wrapped around the RawUsedRing
structure.
It provides a safe interface to access the used ring entries.
Fields§
§flags: &'a mut u16
§idx: &'a mut u16
§ring: &'a mut [RawUsedRingEntry]
§avail_event: &'a mut u16
Implementations§
Source§impl<'a> UsedRing<'a>
impl<'a> UsedRing<'a>
Sourcepub unsafe fn new(size: usize, ptr: *mut RawUsedRing) -> Self
pub unsafe fn new(size: usize, ptr: *mut RawUsedRing) -> Self
Create a new UsedRing
instance
This function creates a new UsedRing
instance from a raw pointer to a RawUsedRing
.
§Safety
This function is unsafe because it dereferences raw pointers and assumes that the memory layout is correct.
The caller must ensure that the pointer is valid and points to a properly initialized RawUsedRing
.
§Arguments
size
- The size of the ring.ptr
- A raw pointer to aRawUsedRing
.
§Returns
UsedRing
- A new UsedRing
instance.