pub struct Server {}Implementations§
Source§impl Server
impl Server
pub fn process_request( stream: impl Read + Write + Unpin, peer_addr: SocketAddr, ) -> Vec<u8> ⓘ
pub fn bad_request_response(message: String) -> Vec<u8> ⓘ
pub fn process( stream: impl Read + Write + Unpin, connection: ConnectionInfo, app: impl Application, ) -> Result<(), String>
Sourcepub fn setup() -> Result<(TcpListener, ThreadPool), String>
pub fn setup() -> Result<(TcpListener, ThreadPool), String>
Reads configuration (IP, port, thread count, TLS paths) from the layered config system
and returns a bound TcpListener and a sized ThreadPool. Call once at startup.
Sourcepub fn run(
listener: TcpListener,
pool: ThreadPool,
app: impl Application + New + Send + 'static + Copy,
)
pub fn run( listener: TcpListener, pool: ThreadPool, app: impl Application + New + Send + 'static + Copy, )
Accepts TCP connections in a loop and dispatches each to the thread pool.
Blocks forever (plain HTTP/1.1). For TLS/HTTP2/HTTP3 use Server::run_tls.
Source§impl Server
impl Server
pub async fn run_tls( listener: TcpListener, pool: ThreadPool, app: impl Application + New + Send + 'static + Copy, )
Sourcepub async fn run_redirect()
pub async fn run_redirect()
Binds a plain-HTTP listener on the port in RWS_CONFIG_HTTP_REDIRECT_PORT and sends
301 Moved Permanently to the HTTPS equivalent of every incoming URL.
Returns immediately if TLS is not configured or the redirect port is not set.
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more