Struct clap_port_flag::Port[][src]

pub struct Port { /* fields omitted */ }

Easily add a --port flag to Structopt.

Usage

extern crate clap_port_flag;
#[macro_use] extern crate structopt;

use structopt::StructOpt;
use clap_port_flag::Port;

#[derive(Debug, StructOpt)]
struct Cli {
  #[structopt(flatten)]
  port: Port,
}

Methods

impl Port
[src]

Create a TCP socket.

Panics

If a file descriptor was passed directly, we call the unsafe TcpListener::from_raw_fd() method, which may panic if a non-existent file descriptor was passed.

Create a TCP socket from the passed in port or file descriptor.

Create a TCP socket by calling to .bind(). If it fails, create a socket on port.

Useful to create a default socket to listen to if none was passed.

Trait Implementations

impl StructOpt for Port
[src]

Returns the corresponding clap::App.

Creates the struct from clap::ArgMatches. It cannot fail with a parameter generated by clap by construction. Read more

Gets the struct from the command line arguments. Print the error message and quit the program in case of failure. Read more

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 more

Gets the struct from any iterator such as a Vec of your making. Read more

impl Debug for Port
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Port

impl Sync for Port