pub struct BackgroundModeManager { /* private fields */ }Expand description
Background mode manager
Implementations§
Source§impl BackgroundModeManager
impl BackgroundModeManager
Sourcepub fn new(config: BackgroundModeConfig) -> Self
pub fn new(config: BackgroundModeConfig) -> Self
Create a new background mode manager
Sourcepub fn state(&self) -> BackgroundState
pub fn state(&self) -> BackgroundState
Get current background state
Sourcepub fn pause(&self) -> Result<(), BackgroundModeError>
pub fn pause(&self) -> Result<(), BackgroundModeError>
Pause network operations (enter background mode)
Sourcepub fn resume(&self) -> Result<(), BackgroundModeError>
pub fn resume(&self) -> Result<(), BackgroundModeError>
Resume network operations (enter foreground mode)
Sourcepub fn should_allow_dht_query(&self) -> bool
pub fn should_allow_dht_query(&self) -> bool
Check if a DHT query should be allowed in current state
Sourcepub fn should_allow_provider_announcements(&self) -> bool
pub fn should_allow_provider_announcements(&self) -> bool
Check if provider announcements should be allowed in current state
Sourcepub fn config(&self) -> &BackgroundModeConfig
pub fn config(&self) -> &BackgroundModeConfig
Get configuration
Sourcepub fn stats(&self) -> BackgroundModeStats
pub fn stats(&self) -> BackgroundModeStats
Get statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Sourcepub fn record_dht_query_skipped(&self)
pub fn record_dht_query_skipped(&self)
Increment DHT queries skipped counter
Sourcepub fn record_connections_closed(&self, count: usize)
pub fn record_connections_closed(&self, count: usize)
Record connections closed on pause
Auto Trait Implementations§
impl Freeze for BackgroundModeManager
impl !RefUnwindSafe for BackgroundModeManager
impl Send for BackgroundModeManager
impl Sync for BackgroundModeManager
impl Unpin for BackgroundModeManager
impl !UnwindSafe for BackgroundModeManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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