[][src]Struct qair::Qair

pub struct Qair { /* fields omitted */ }

Implementations

impl Qair[src]

pub fn new() -> Self[src]

Construct with defaults.

Defaults are:

  • port: 1234
  • receiving: disabled
  • file to send: none
  • always index: no
  • ip autodetection: only autodetect

pub fn start(&self) -> Result<Listening, HttpError>[src]

Start listening to HTTP requests.

On success, dropping the returned value blocks and does not stop the HTTP server.

Besides stopping the application, there is currently no way to stop the HTTP server, see https://docs.rs/iron/0.6.1/iron/struct.Listening.html#method.close

Note: you probably want to call set_is_receiving_enabled or set_file_to_send first, otherwise sending and receiving remain disabled.

pub fn url(&self) -> Result<String, FormatUrlError>[src]

URL the HTTP server can be reached on after calling start.

Note that in case of IP autodetection, the IP can change between calling url and calling start, so it is not guaranteed that the HTTP server is reachable on the returned URL.

Calling this function twice can give a different result.

See also always_index.

pub fn set_port(&mut self, port: u16)[src]

Set on which port the HTTP server will listen.

pub fn set_is_receiving_enabled(&mut self, is_receiving_enabled: bool)[src]

Set whether the HTTP server allows clients to upload files

pub fn set_file_to_send(&mut self, file_to_send: &Option<PathBuf>)[src]

Set which file will the HTTP server send to clients.

None meants the HTTP server will refuse to send files.

pub fn set_ip_autodetection_config(&mut self, config: IpAutodetectionConfig)[src]

Configure IP autodetection and/or custom host name

pub fn set_always_index(&mut self, always_index: bool)[src]

Set whether deeplinking is disabled in the URL.

If true, then when only sending a single file, the URL returned by url will go directly to that file, e.g. http://192.168.1.2/file.png. If false, this never happens and the URL will always be like http://192.168.1.2/. The page on that URL can then contain a link to a file (if sending files is enabled).

Auto Trait Implementations

impl RefUnwindSafe for Qair

impl Send for Qair

impl Sync for Qair

impl Unpin for Qair

impl UnwindSafe for Qair

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any