Skip to main content

ServeTransport

Trait ServeTransport 

Source
pub trait ServeTransport {
    // Required method
    fn start(&self, addr: &str, root: &str) -> Result<(), SsgError>;
}
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<(), SsgError>

Start serving root on addr. Implementations may block.

§Errors

Returns an error if the underlying transport fails to start.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§