pub struct Port { /* private fields */ }
Expand description

Easily add a --port flag to clap.

Usage

#[derive(Debug, clap::Parser)]
struct Cli {
  #[clap(flatten)]
  port: clap_port_flag::Port,
}

Implementations

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. (This only applies if the “fd” feature is enabled)

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

Append to Command so it can instantiate Self. Read more
Append to Command so it can update self. Read more
Report the ArgGroup::id for this set of arguments
Formats the value using the given formatter. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Assign values from ArgMatches to self.
Assign values from ArgMatches to self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.