Struct HttpServer
pub struct HttpServer<B> { /* private fields */ }http-backend and http and std only.Expand description
A builder for configuring and listening over HTTP using a Service.
Supported protocols: HTTP/1, H2, Auto (HTTP/1 + H2), and with the quic feature H3 over QUIC.
Implementations§
§impl HttpServer<Builder>
impl HttpServer<Builder>
pub fn new_http1(scope: impl Into<WeakScope>) -> HttpServer<Builder>
pub fn new_http1(scope: impl Into<WeakScope>) -> HttpServer<Builder>
Create a new http/1.1 Builder with default settings.
§impl HttpServer<Builder>
impl HttpServer<Builder>
§impl HttpServer<Builder>
impl HttpServer<Builder>
pub fn new_h2(scope: impl Into<WeakScope>) -> HttpServer<Builder>
pub fn new_h2(scope: impl Into<WeakScope>) -> HttpServer<Builder>
Create a new h2 Builder with default settings.
§impl HttpServer<Builder>
impl HttpServer<Builder>
§impl HttpServer<Builder>
impl HttpServer<Builder>
pub fn auto(scope: impl Into<WeakScope>) -> HttpServer<Builder>
pub fn auto(scope: impl Into<WeakScope>) -> HttpServer<Builder>
Create a new dual http/1.1 + h2 Builder with default settings.
§impl HttpServer<Builder>
impl HttpServer<Builder>
§impl<B> HttpServer<B>where
B: HttpCoreConnServer,
impl<B> HttpServer<B>where
B: HttpCoreConnServer,
pub fn service<S>(self, service: S) -> HttpService<B, S>where
S: Clone,
pub fn service<S>(self, service: S) -> HttpService<B, S>where
S: Clone,
Turn this HttpServer into a Service that can be used to serve
IO Byte streams (e.g. a TCP Stream) as HTTP.
pub async fn serve<S, Response, IO>(
&self,
stream: IO,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>where
S: Service<Request, Output = Response, Error = !> + Clone,
Response: IntoResponse + Send + 'static,
IO: Io + ExtensionsRef,
pub async fn serve<S, Response, IO>(
&self,
stream: IO,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>where
S: Service<Request, Output = Response, Error = !> + Clone,
Response: IntoResponse + Send + 'static,
IO: Io + ExtensionsRef,
Serve a single IO Byte Stream (e.g. a TCP Stream) as HTTP.
pub async fn listen<S, Response, A>(
self,
address: A,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>
pub async fn listen<S, Response, A>( self, address: A, service: S, ) -> Result<(), Box<dyn Error + Sync + Send>>
Listen for connections on the given SocketAddress, serving HTTP connections.
It’s a shortcut in case you don’t need to operate on the transport layer directly.
pub async fn listen_unix<S, Response, P>(
self,
path: P,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>
Available on target_family=unix only.
pub async fn listen_unix<S, Response, P>( self, path: P, service: S, ) -> Result<(), Box<dyn Error + Sync + Send>>
target_family=unix only.Listen for connections on the given Path, using a unix (domain) socket, serving HTTP connections.
It’s a shortcut in case you don’t need to operate on the unix transport layer directly.
§impl HttpServer<Config>
impl HttpServer<Config>
pub fn new_http3(scope: impl Into<WeakScope>) -> HttpServer<Config>
Available on crate feature quic only.
pub fn new_http3(scope: impl Into<WeakScope>) -> HttpServer<Config>
quic only.Create an HTTP/3 server for QUIC connections negotiated with the h3 ALPN.
pub fn http3_mut(&mut self) -> &mut Config
Available on crate feature quic only.
pub fn http3_mut(&mut self) -> &mut Config
quic only.Mutable HTTP/3 connection limits.
pub fn service<S>(self, service: S) -> HttpService<Config, S>where
S: Clone,
Available on crate feature quic only.
pub fn service<S>(self, service: S) -> HttpService<Config, S>where
S: Clone,
quic only.Turn this server into a service for accepted QUIC connections.
pub async fn serve<C, S, Response>(
&self,
connection: C,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>where
C: Connection,
S: Service<Request, Output = Response, Error = !> + Clone,
Response: IntoResponse + Send + 'static,
Available on crate feature quic only.
pub async fn serve<C, S, Response>(
&self,
connection: C,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>where
C: Connection,
S: Service<Request, Output = Response, Error = !> + Clone,
Response: IntoResponse + Send + 'static,
quic only.Serve a QUIC connection through the ordinary Rama HTTP service interface.
Trait Implementations§
§impl<B> Clone for HttpServer<B>where
B: Clone,
impl<B> Clone for HttpServer<B>where
B: Clone,
§fn clone(&self) -> HttpServer<B>
fn clone(&self) -> HttpServer<B>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<B> Debug for HttpServer<B>where
B: Debug,
impl<B> Debug for HttpServer<B>where
B: Debug,
§impl Default for HttpServer<Builder>
impl Default for HttpServer<Builder>
§fn default() -> HttpServer<Builder>
fn default() -> HttpServer<Builder>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for HttpServer<B>
impl<B> !UnwindSafe for HttpServer<B>
impl<B> Forget for HttpServer<B>
impl<B> Freeze for HttpServer<B>where
B: Freeze,
impl<B> Send for HttpServer<B>where
B: Send,
impl<B> Sync for HttpServer<B>where
B: Sync,
impl<B> Unpin for HttpServer<B>where
B: Unpin,
impl<B> UnsafeUnpin for HttpServer<B>where
B: UnsafeUnpin,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more