pub struct LocklessRingBuffer { /* private fields */ }Implementations§
Source§impl LocklessRingBuffer
impl LocklessRingBuffer
pub const PAGE_HEADER_SIZE: usize = 16
Sourcepub fn new(
size_bytes: usize,
overwrite: bool,
write_event_async_id: Id,
) -> Result<Self, Errno>
pub fn new( size_bytes: usize, overwrite: bool, write_event_async_id: Id, ) -> Result<Self, Errno>
Creates a new LocklessRingBuffer. size_bytes: Size of the ring buffer. Must be at least PAGE_SIZE * 3 and will be rounded up to a multiple of PAGE_SIZE. overwrite: If true, old pages will be dropped when the ring is full. If false, writes will fail until the data is read. write_event_async_id: The async trace event ID for write events.
Source§impl LocklessRingBuffer
impl LocklessRingBuffer
pub fn reserve( &self, size: usize, ) -> Result<(Reservation<'_>, BootInstant, Duration<BootTimeline>), Errno>
pub fn commit(&self, reservation: Reservation<'_>)
pub fn read(&self, buf: &mut dyn OutputBuffer) -> Result<usize, Errno>
pub fn size_bytes(&self) -> usize
pub fn is_enabled(&self) -> bool
pub fn disable(&self) -> Result<u64, Errno>
Sourcepub fn enable(&self) -> Result<BootInstant, Errno>
pub fn enable(&self) -> Result<BootInstant, Errno>
If the ring is disabled, resets it to empty, enables it, and returns the time of the reset.
If the ring is already enabled, does nothing, so in-flight writers and readers, and the
tail_page generation, are unaffected. In that case it returns the time of the last reset,
by new() or by an earlier enable().
Trait Implementations§
Source§impl Drop for LocklessRingBuffer
impl Drop for LocklessRingBuffer
impl RcuDroppable for LocklessRingBufferwhere
Vmo: RcuDroppable,
SharedBuffer: RcuDroppable,
Vec<Node>: RcuDroppable,
AtomicUsize: RcuDroppable,
AtomicTailVal: RcuDroppable,
bool: RcuDroppable,
AtomicU64: RcuDroppable,
Id: RcuDroppable,
AtomicBool: RcuDroppable,
LockDepMutex<BootInstant, PerfRingBufferStateLock>: RcuDroppable,
Auto Trait Implementations§
impl !Freeze for LocklessRingBuffer
impl !RefUnwindSafe for LocklessRingBuffer
impl Send for LocklessRingBuffer
impl Sync for LocklessRingBuffer
impl Unpin for LocklessRingBuffer
impl UnsafeUnpin for LocklessRingBuffer
impl UnwindSafe for LocklessRingBuffer
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more