Config

Struct Config 

Source
pub struct Config {
    pub ip_address: IpAddr,
    pub port: u16,
    pub directory: PathBuf,
    pub receive_directory: PathBuf,
    pub send_directory: PathBuf,
    pub single_port: bool,
    pub read_only: bool,
    pub overwrite: bool,
    pub opt_local: OptionsPrivate,
}
Expand description

Configuration struct used for parsing TFTP options from user input.

This struct is meant to be created by Config::new(). See its documentation for more.

§Example

// Create TFTP configuration from user arguments.
use std::env;
use tftpd::Config;

let config = Config::new(env::args()).unwrap();

Fields§

§ip_address: IpAddr

Local IP address of the TFTP Server. (default: 127.0.0.1)

§port: u16

Local Port number of the TFTP Server. (default: 69)

§directory: PathBuf

Default directory of the TFTP Server. (default: current working directory)

§receive_directory: PathBuf

Upload directory of the TFTP Server. (default: directory)

§send_directory: PathBuf

Download directory of the TFTP Server. (default: directory)

§single_port: bool

Use a single port for both sending and receiving. (default: false)

§read_only: bool

Refuse all write requests, making the server read-only. (default: false)

§overwrite: bool

Overwrite existing files. (default: false)

§opt_local: OptionsPrivate

Local options for server

Implementations§

Source§

impl Config

Source

pub fn new<T: Iterator<Item = String>>( args: T, ) -> Result<Config, Box<dyn Error>>

Creates a new configuration by parsing the supplied arguments. It is intended for use with env::args().

Trait Implementations§

Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.