Crate shrimple_localhost
source ·Expand description
Zero-dependency simple synchronous localhost server. The 2 ways to use the library are:
serve_current_dir,serve,serve_current_dir_at,serve_atfunctions, the simpler approach.Serverstruct, the more complex approach. If inspecting incoming connections & requests is needed (e.g. for logging), the 2nd approach will be better, otherwise the 1st one will be easier.
Structs§
- Data associated with a successful request.
- Server for serving files locally
Enums§
- The result of a request. This doesn’t report IO errors, since in a case of such error no request is registered.
- Error returned by
Server::try_serve_with_callbackthat differentiates between an IO error from within the server and an error propagated from a callback.
Functions§
- Serve files from
rootat portServer::DEFAULT_PORT - Serve files from
rootataddr - Serve files from the current directory at port
Server::DEFAULT_PORT - Serve files from
rootat portServer::DEFAULT_PORT