pub struct SCNetworkReachability(_);
Expand description
A network address or host for which the connectivity can be determined.
See SCNetworkReachability
for details.
Implementations§
source§impl SCNetworkReachability
impl SCNetworkReachability
sourcepub fn from_addr_pair(
local: SocketAddr,
remote: SocketAddr
) -> SCNetworkReachability
pub fn from_addr_pair( local: SocketAddr, remote: SocketAddr ) -> SCNetworkReachability
Construct a SCNetworkReachability struct with a local and a remote socket address.
See SCNetworkReachabilityCreateWithAddressPair
for details.
sourcepub fn from_host(host: &CStr) -> Option<Self>
pub fn from_host(host: &CStr) -> Option<Self>
Construct a Reachability from either a hostname or a network node
See SCNetworkReachabilityCreateWithName
for details.
sourcepub fn reachability(&self) -> Result<ReachabilityFlags, ReachabilityError>
pub fn reachability(&self) -> Result<ReachabilityFlags, ReachabilityError>
Return a flag indicating whether the specified network address is reachable.
See SCNetworkReachabilityGetFlags
for details.
sourcepub fn schedule_with_runloop(
&self,
run_loop: &CFRunLoop,
run_loop_mode: CFStringRef
) -> Result<(), SchedulingError>
pub fn schedule_with_runloop( &self, run_loop: &CFRunLoop, run_loop_mode: CFStringRef ) -> Result<(), SchedulingError>
Schedule callback with runloop.
See SCNetworkReachabilityScheduleFromRunLoop
for details.
sourcepub fn unschedule_from_runloop(
&self,
run_loop: &CFRunLoop,
run_loop_mode: CFStringRef
) -> Result<(), UnschedulingError>
pub fn unschedule_from_runloop( &self, run_loop: &CFRunLoop, run_loop_mode: CFStringRef ) -> Result<(), UnschedulingError>
Unschedule from run loop.
See SCNetworkReachabilityUnscheduleFromRunLoop
for details.
sourcepub fn set_callback<F: Fn(ReachabilityFlags) + Sync + Send>(
&mut self,
callback: F
) -> Result<(), SetCallbackError>
pub fn set_callback<F: Fn(ReachabilityFlags) + Sync + Send>( &mut self, callback: F ) -> Result<(), SetCallbackError>
Sets callback that is run whenever network connectivity changes. For the callback to be
invoked, the SCNetworkReachability
has to be registered on a run loop. Calling this
function multiple times will clear the subsequently set callback.
See SCNetworkReachabilityContext
for details.
Trait Implementations§
source§impl Clone for SCNetworkReachability
impl Clone for SCNetworkReachability
source§fn clone(&self) -> SCNetworkReachability
fn clone(&self) -> SCNetworkReachability
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Drop for SCNetworkReachability
impl Drop for SCNetworkReachability
source§impl From<SocketAddr> for SCNetworkReachability
impl From<SocketAddr> for SCNetworkReachability
source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
source§impl PartialEq<SCNetworkReachability> for SCNetworkReachability
impl PartialEq<SCNetworkReachability> for SCNetworkReachability
source§fn eq(&self, other: &SCNetworkReachability) -> bool
fn eq(&self, other: &SCNetworkReachability) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TCFType for SCNetworkReachability
impl TCFType for SCNetworkReachability
source§fn as_concrete_TypeRef(&self) -> SCNetworkReachabilityRef
fn as_concrete_TypeRef(&self) -> SCNetworkReachabilityRef
source§unsafe fn wrap_under_get_rule(reference: SCNetworkReachabilityRef) -> Self
unsafe fn wrap_under_get_rule(reference: SCNetworkReachabilityRef) -> Self
CFTypeRef
subclass. Use this
when following Core Foundation’s “Get Rule”. The reference count is bumped.source§fn as_CFTypeRef(&self) -> CFTypeRef
fn as_CFTypeRef(&self) -> CFTypeRef
CFTypeRef
. The reference count is not adjusted.source§unsafe fn wrap_under_create_rule(reference: SCNetworkReachabilityRef) -> Self
unsafe fn wrap_under_create_rule(reference: SCNetworkReachabilityRef) -> Self
CFTypeRef
subclass. Use this
when following Core Foundation’s “Create Rule”. The reference count is not bumped.source§fn as_CFType(&self) -> CFType
fn as_CFType(&self) -> CFType
CFType
. The reference count is incremented by one.source§fn into_CFType(self) -> CFTypewhere
Self: Sized,
fn into_CFType(self) -> CFTypewhere Self: Sized,
CFType
. Consumes self and avoids changing the reference
count.