pub struct LowPowerBatcher<T> { /* private fields */ }Expand description
Low-power operation batcher
Batches operations to reduce CPU wake-ups and save power. Particularly useful on battery-powered ARM devices.
Implementations§
Source§impl<T> LowPowerBatcher<T>
impl<T> LowPowerBatcher<T>
Sourcepub fn new(profile: PowerProfile) -> Self
pub fn new(profile: PowerProfile) -> Self
Create a new batcher with the given power profile
Sourcepub fn push(&self, item: T) -> Option<Vec<T>>
pub fn push(&self, item: T) -> Option<Vec<T>>
Add an item to the batch
Returns the current batch if it’s ready to be processed
Sourcepub fn profile(&self) -> PowerProfile
pub fn profile(&self) -> PowerProfile
Get the current power profile
Auto Trait Implementations§
impl<T> Freeze for LowPowerBatcher<T>
impl<T> RefUnwindSafe for LowPowerBatcher<T>
impl<T> Send for LowPowerBatcher<T>where
T: Send,
impl<T> Sync for LowPowerBatcher<T>where
T: Send,
impl<T> Unpin for LowPowerBatcher<T>
impl<T> UnwindSafe for LowPowerBatcher<T>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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