Struct isahc::config::NetworkInterface
source · pub struct NetworkInterface { /* private fields */ }
Expand description
Used to configure which local addresses or interfaces should be used to send network traffic from.
Note that this type is “lazy” in the sense that errors are not returned if the given interfaces are not checked for validity until you actually attempt to use it in a network request.
Implementations
sourceimpl NetworkInterface
impl NetworkInterface
sourcepub fn any() -> Self
pub fn any() -> Self
Bind to whatever the networking stack finds suitable. This is the default behavior.
sourcepub fn name(name: impl AsRef<str>) -> Self
Available on Unix only.
pub fn name(name: impl AsRef<str>) -> Self
Bind to the interface with the given name (such as eth0
). This method
is not available on Windows as it does not really have names for network
devices.
Examples
let loopback = NetworkInterface::name("lo");
let wifi = NetworkInterface::name("wlan0");
Trait Implementations
sourceimpl Clone for NetworkInterface
impl Clone for NetworkInterface
sourcefn clone(&self) -> NetworkInterface
fn clone(&self) -> NetworkInterface
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for NetworkInterface
impl Debug for NetworkInterface
sourceimpl Default for NetworkInterface
impl Default for NetworkInterface
Auto Trait Implementations
impl RefUnwindSafe for NetworkInterface
impl Send for NetworkInterface
impl Sync for NetworkInterface
impl Unpin for NetworkInterface
impl UnwindSafe for NetworkInterface
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more