Skip to main content

HttpServer

Struct HttpServer 

Source
pub struct HttpServer<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> { /* private fields */ }
Expand description

Simple HTTP server implementation

Note: This server only supports HTTP connections, not HTTPS/TLS. For secure connections, consider using a reverse proxy or load balancer that handles TLS termination.

Implementationsยง

Sourceยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

Source

pub fn new(port: u16) -> Self

Create a new HTTP server with default timeouts

Source

pub fn with_timeouts(port: u16, timeouts: ServerTimeouts) -> Self

Create a new HTTP server with custom timeouts

Source

pub async fn serve<H>(&mut self, stack: Stack<'_>, handler: H) -> !
where H: HttpHandler,

Start the HTTP server and handle incoming connections

Important: This server only accepts plain HTTP connections. HTTPS/TLS is not supported by the server (only by the client).

Auto Trait Implementationsยง

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> Freeze for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> RefUnwindSafe for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> Send for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> Sync for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> Unpin for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

ยง

impl<const RX_SIZE: usize, const TX_SIZE: usize, const REQ_SIZE: usize, const MAX_RESPONSE_SIZE: usize> UnwindSafe for HttpServer<RX_SIZE, TX_SIZE, REQ_SIZE, MAX_RESPONSE_SIZE>

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.