pub struct HttpBuilder<F>{ /* private fields */ }Expand description
Build an HTTP server.
Implementations§
Source§impl<F> HttpBuilder<F>
impl<F> HttpBuilder<F>
Sourcepub fn new(
config: HttpConfig,
runtime: Option<&RuntimeConfig>,
app_builder: F,
) -> Self
pub fn new( config: HttpConfig, runtime: Option<&RuntimeConfig>, app_builder: F, ) -> Self
Start building a new HTTP server instance.
Sourcepub fn default_cors<C: Into<Option<CorsConfig>>>(self, default_cors: C) -> Self
pub fn default_cors<C: Into<Option<CorsConfig>>>(self, default_cors: C) -> Self
Set a default CORS config without overriding the existing one.
Sourcepub fn on_connect<O>(self, on_connect: O) -> Self
pub fn on_connect<O>(self, on_connect: O) -> Self
Set an “on connect” handler.
Sourcepub fn tls_auth_config<I: Into<TlsAuthConfig>>(self, tls_auth_config: I) -> Self
pub fn tls_auth_config<I: Into<TlsAuthConfig>>(self, tls_auth_config: I) -> Self
Set the TLS mode.
Sourcepub fn start(self, startup: &mut dyn Startup) -> Result<()>
pub fn start(self, startup: &mut dyn Startup) -> Result<()>
Start the server on the provided startup context.
Sourcepub fn run(self) -> Result<BoxFuture<'static, Result<(), Error>>, Error>
pub fn run(self) -> Result<BoxFuture<'static, Result<(), Error>>, Error>
Run the server.
NOTE: This only returns a future, which was to be scheduled on some executor. Possibly
using crate::app::Startup.
In most cases you want to use Self::start instead.
Auto Trait Implementations§
impl<F> Freeze for HttpBuilder<F>
impl<F> !RefUnwindSafe for HttpBuilder<F>
impl<F> Send for HttpBuilder<F>
impl<F> Sync for HttpBuilder<F>where
F: Sync,
impl<F> Unpin for HttpBuilder<F>
impl<F> !UnwindSafe for HttpBuilder<F>
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