Struct structopt_flags::HostV4Param
source · pub struct HostV4Param {
pub host_addr: Ipv4Addr,
}
Expand description
This struct provides the --host
and -H
cli option to get an IPv4 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::Ipv4Addr;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "ipv4_param", about = "An example using the HostV4Param option")]
struct Opt {
#[structopt(flatten)]
host_ip: structopt_flags::HostV4Param,
}
fn main() {
let opt = Opt::from_args();
let ipv4 = opt.host_ip.host_addr;
}
Fields
host_addr: Ipv4Addr
Set the host IP (Ipv4 only)
Trait Implementations
sourceimpl Clone for HostV4Param
impl Clone for HostV4Param
sourcefn clone(&self) -> HostV4Param
fn clone(&self) -> HostV4Param
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 HostV4Param
impl Debug for HostV4Param
sourceimpl StructOpt for HostV4Param
impl StructOpt for HostV4Param
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 HostV4Param
impl Send for HostV4Param
impl Sync for HostV4Param
impl Unpin for HostV4Param
impl UnwindSafe for HostV4Param
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