Struct structopt_flags::HostParam
source · pub struct HostParam {
pub host_addr: IpAddr,
}Expand description
This struct provides the --host and -H cli option to get ageneric IP address
No default is provided and the parameter is mandatory This option is not global
ⓘ
extern crate structopt_flags;
#[macro_use]
extern crate structopt;
use std::net::{IpAddr,Ipv6Addr};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "ip_param", about = "An example using the HostParam option")]
struct Opt {
#[structopt(flatten)]
host_ip: structopt_flags::HostParam,
}
fn main() {
let opt = Opt::from_args();
let ip = opt.host_ip.host_addr;
}Fields
host_addr: IpAddrSet the host IP (both IpV4 and IpV6 are supported)
Trait Implementations
sourceimpl StructOpt for HostParam
impl StructOpt for HostParam
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Creates the struct from
clap::ArgMatches. It cannot fail
with a parameter generated by clap by construction. Read moresourcefn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
Gets the struct from the command line arguments. Print the
error message and quit the program in case of failure. Read more
sourcefn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Gets the struct from any iterator such as a
Vec of your making.
Print the error message and quit the program in case of failure. Read moresourcefn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Gets the struct from any iterator such as a
Vec of your making. Read moreAuto Trait Implementations
impl RefUnwindSafe for HostParam
impl Send for HostParam
impl Sync for HostParam
impl Unpin for HostParam
impl UnwindSafe for HostParam
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