pub enum NetworkMode {
Online,
Offline,
}Expand description
Whether HttpCache may issue outbound network requests (issue #483).
Passed to HttpCache::set_offline. Offline also overrides
CacheMode to behave as CacheMode::Enabled — see that method’s docs.
Variants§
Online
Outbound registry requests are attempted normally.
Offline
All outbound requests are blocked; only cached/warm entries are served.
Implementations§
Source§impl NetworkMode
impl NetworkMode
Sourcepub fn from_offline_flag(offline: bool) -> Self
pub fn from_offline_flag(offline: bool) -> Self
Builds a NetworkMode from a network.offline config/CLI flag (true means
Self::Offline).
The single, explicitly named conversion point from that boundary’s bool
representation (issue #1436 S1) — deliberately not a From<bool> impl, which would
let any unrelated bool (e.g. a cache.enabled flag transposed at the call site)
silently convert too, defeating the point of typing this API in the first place.
Sourcepub const fn is_online(self) -> bool
pub const fn is_online(self) -> bool
Whether outbound network requests may be attempted (self is Self::Online).
Centralizes the network == NetworkMode::Online check every call site otherwise
reimplements inline (issue #1557 code-review finding).
§Examples
use deps_core::NetworkMode;
assert!(NetworkMode::Online.is_online());
assert!(!NetworkMode::Offline.is_online());Sourcepub const fn is_offline(self) -> bool
pub const fn is_offline(self) -> bool
Whether outbound network requests are blocked (self is Self::Offline).
§Examples
use deps_core::NetworkMode;
assert!(NetworkMode::Offline.is_offline());
assert!(!NetworkMode::Online.is_offline());Trait Implementations§
Source§impl Clone for NetworkMode
impl Clone for NetworkMode
impl Copy for NetworkMode
Source§impl Debug for NetworkMode
impl Debug for NetworkMode
impl Eq for NetworkMode
Source§impl PartialEq for NetworkMode
impl PartialEq for NetworkMode
impl StructuralPartialEq for NetworkMode
Auto Trait Implementations§
impl Freeze for NetworkMode
impl RefUnwindSafe for NetworkMode
impl Send for NetworkMode
impl Sync for NetworkMode
impl Unpin for NetworkMode
impl UnsafeUnpin for NetworkMode
impl UnwindSafe for NetworkMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.