pub enum IfaceSelector {
Ipv4(Ipv4Addr),
Name(String),
}Expand description
How a user names a host interface on a command line or in an API call.
Parsed as an IPv4 literal first and taken as an operating-system interface name otherwise. The two spellings cannot collide: an interface name that parses as an IPv4 address does not exist on any platform we support.
Both spellings are needed. A Windows interface name is a GUID
({6394C55F-F630-4BC7-92D2-7AC320C73D1C}), which a user has no easy way to
obtain, so IPv4 has to work; and an interface that carries no address yet
can only be named, so the name has to work too. Before this existed
viva-camctl accepted only the address and viva-service only the name,
and a user who had discovered a camera with one tool could not stream it
with the other (#109).
Variants§
Ipv4(Ipv4Addr)
One of the interface’s own IPv4 addresses, e.g. 169.254.105.106.
Name(String)
The name the operating system gives the interface, e.g. en0.
Implementations§
Source§impl IfaceSelector
impl IfaceSelector
Sourcepub fn resolve(&self) -> Result<Iface>
pub fn resolve(&self) -> Result<Iface>
Resolve the selector against the interfaces this host reports.
Delegates to Iface::from_ipv4 or Iface::from_system; the only
thing added here is the failure message, which lists what we can
actually see. That listing is the point rather than a nicety: the
Windows GUID a user needs is not discoverable from the error it
replaces, and Iface::list is already the library’s own view of the
machine (#57).
Trait Implementations§
Source§impl Clone for IfaceSelector
impl Clone for IfaceSelector
Source§fn clone(&self) -> IfaceSelector
fn clone(&self) -> IfaceSelector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IfaceSelector
impl Debug for IfaceSelector
Source§impl Display for IfaceSelector
impl Display for IfaceSelector
Source§impl FromStr for IfaceSelector
impl FromStr for IfaceSelector
Source§impl PartialEq for IfaceSelector
impl PartialEq for IfaceSelector
Source§fn eq(&self, other: &IfaceSelector) -> bool
fn eq(&self, other: &IfaceSelector) -> bool
self and other values to be equal, and is used by ==.