pub struct NetworkStateHandle {
state: Arc<RwLock<NetworkState>>,
}Expand description
Shared, mutable view of the current network transport.
Cheap to clone; the frontend updates it via set_network_state whenever
Android reports a network change.
Fields§
§state: Arc<RwLock<NetworkState>>Implementations§
Source§impl NetworkStateHandle
impl NetworkStateHandle
pub fn new() -> Self
pub async fn get(&self) -> NetworkState
pub async fn set(&self, new_state: NetworkState)
Sourcepub async fn allows_download(&self, wifi_only: bool) -> bool
pub async fn allows_download(&self, wifi_only: bool) -> bool
Whether downloads may run right now given the wifi-only preference.
Trait Implementations§
Source§impl Clone for NetworkStateHandle
impl Clone for NetworkStateHandle
Source§fn clone(&self) -> NetworkStateHandle
fn clone(&self) -> NetworkStateHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for NetworkStateHandle
impl Default for NetworkStateHandle
Source§fn default() -> NetworkStateHandle
fn default() -> NetworkStateHandle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NetworkStateHandle
impl !RefUnwindSafe for NetworkStateHandle
impl Send for NetworkStateHandle
impl Sync for NetworkStateHandle
impl Unpin for NetworkStateHandle
impl UnsafeUnpin for NetworkStateHandle
impl !UnwindSafe for NetworkStateHandle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.