pub struct Cursor<T: Copy> { /* private fields */ }
Expand description
A structure for tracking a ring shared between a producer and consumer
See xsk.h.
Implementations§
Source§impl<T: Copy> Cursor<T>
impl<T: Copy> Cursor<T>
Sourcepub fn acquire_producer(&mut self, watermark: u32) -> u32
pub fn acquire_producer(&mut self, watermark: u32) -> u32
Acquires a cursor index for a producer half
The watermark
can be provided to avoid synchronization by reusing the cached cursor
value.
See xsk.h.
Sourcepub fn cached_producer(&self) -> u32
pub fn cached_producer(&self) -> u32
Returns the cached producer cursor which is also maxed by the cursor mask
See xsk.h.
Sourcepub fn cached_producer_len(&self) -> u32
pub fn cached_producer_len(&self) -> u32
Returns the cached number of available entries for the consumer
See xsk.h.
Sourcepub fn release_producer(&mut self, len: u32)
pub fn release_producer(&mut self, len: u32)
Releases a len
number of entries from the producer to the consumer.
See xsk.h.
The provided len
should not exceed the number from acquire_producer
. With
debug_assertions enabled, this will panic if it occurs.
Sourcepub fn acquire_consumer(&mut self, watermark: u32) -> u32
pub fn acquire_consumer(&mut self, watermark: u32) -> u32
Acquires a cursor index for a consumer half
The watermark
can be provided to avoid synchronization by reusing the cached cursor
value.
See xsk.h.
Sourcepub fn cached_consumer(&self) -> u32
pub fn cached_consumer(&self) -> u32
Returns the cached consumer cursor which is also maxed by the cursor mask
See xsk.h.
Sourcepub fn cached_consumer_len(&self) -> u32
pub fn cached_consumer_len(&self) -> u32
Returns the cached number of available entries for the consumer
See xsk.h.
Sourcepub fn release_consumer(&mut self, len: u32)
pub fn release_consumer(&mut self, len: u32)
Releases a len
number of entries from the consumer to the producer.
See xsk.h.
The provided len
should not exceed the number from acquire_consumer
. With
debug_assertions enabled, this will panic if it occurs.