Skip to main content

ServeTransport

Trait ServeTransport 

Source
pub trait ServeTransport {
    // Required method
    fn start(&self, addr: &str, root: &str) -> Result<()>;
}
Expand description

Pluggable transport that drives the dev server.

Production code uses HttpTransport (a thin wrapper around http_handle::Server); tests use a test-only NoopTransport which records the call without actually binding a port. The trait exists so every line of serve_site is unit-testable.

Required Methods§

Source

fn start(&self, addr: &str, root: &str) -> Result<()>

Start serving root on addr. Implementations may block.

§Errors

Returns an error if the underlying transport fails to start.

Implementors§