Expand description
A minimal static file server, so serving the example needs nothing installed.
Built on hyperβs HTTP/1 server, with async-io as the reactor and
async-executor as the runtime: hyper parses and encodes the protocol,
the server only maps a request to a file. WebGPU requires a secure
context, which http://localhost is, so the listener binds to loopback
only.
Re-exportsΒ§
use std::path::Path;πuse std::path::PathBuf;πuse async_executor::Executor;πuse async_io::Async;πuse futures_lite::future;πuse http_body_util::Full;πuse hyper::body::Bytes;πuse hyper::body::Incoming;πuse hyper::server::conn::http1;πuse hyper::service::service_fn;πuse hyper::Request;πuse hyper::Response;πuse hyper::StatusCode;πuse smol_hyper::rt::FuturesIo;πuse smol_hyper::rt::SmolTimer;π
FunctionsΒ§
- answer π
- The response for one request.
- bind π
- Bind to loopback at
preferred_portor, if taken, the ports after it. - mime π
- The response
Content-Typeforpath, by extension. - plain π
- A
text/plainresponse, for the statuses that carry no file. - resolve π
- The file
targetasks for, orNonefor a request to refuse. - serve
- Serve
diruntil stopped. - serve_
connection π - Answer every request on one connection.
- serve_
listener π - Serve
diron an already-boundlisteneruntil stopped.