pub trait BlockingProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn protocol(&self) -> Protocol;
fn get_ip(
&self,
version: IpVersion,
timeout: Duration,
) -> Result<IpAddr, ProviderError>;
fn clone_box(&self) -> BoxedBlockingProvider;
// Provided methods
fn supports_v4(&self) -> bool { ... }
fn supports_v6(&self) -> bool { ... }
fn supports_version(&self, version: IpVersion) -> bool { ... }
}Expand description
Trait for synchronous IP detection providers
Required Methods§
Sourcefn get_ip(
&self,
version: IpVersion,
timeout: Duration,
) -> Result<IpAddr, ProviderError>
fn get_ip( &self, version: IpVersion, timeout: Duration, ) -> Result<IpAddr, ProviderError>
Get the public IP address synchronously with the given timeout.
Implementations should honor timeout for their own I/O. The blocking
resolver also enforces the caller-visible deadline, but Rust cannot
forcibly cancel an OS thread that is already executing provider code;
work from a non-cooperative custom provider may continue in the
background after the resolver returns a timeout.
Sourcefn clone_box(&self) -> BoxedBlockingProvider
fn clone_box(&self) -> BoxedBlockingProvider
Clone this provider into a boxed trait object
Provided Methods§
Sourcefn supports_v4(&self) -> bool
fn supports_v4(&self) -> bool
Whether this provider supports IPv4
Sourcefn supports_v6(&self) -> bool
fn supports_v6(&self) -> bool
Whether this provider supports IPv6
Sourcefn supports_version(&self, version: IpVersion) -> bool
fn supports_version(&self, version: IpVersion) -> bool
Check if provider supports the given IP version
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".