Skip to main content

HttpServer

Struct HttpServer 

Source
pub struct HttpServer { /* private fields */ }
Expand description

The HTTP server state shared by the commands and the pipeline: options, maintenance mode and the address serve is bound to.

Implementations§

Source§

impl HttpServer

Source

pub fn options(&self) -> &HttpOptions

The HTTP options.

Source

pub fn maintenance(&self) -> &MaintenanceMode

The maintenance-mode state.

Source

pub fn local_addr(&self) -> Option<SocketAddr>

The address serve listens on, while it runs.

Source

pub async fn wait_bound(&self) -> SocketAddr

Waits until serve is listening and returns its address (useful with addr = "127.0.0.1:0").

Trait Implementations§

Source§

impl Debug for HttpServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Injectable for HttpServer

Source§

fn dependencies() -> Vec<ProviderKey>

The keys construct resolves, used by the boot-time graph check. Keys resolved through Lazy are left out.
Source§

fn construct(r: Resolver) -> BoxFuture<'static, Result<Self, KernelError>>

Builds the value, resolving dependencies through r.
Source§

fn scope() -> Scope

The provider scope; singletons by default.
Source§

impl Lifecycle for HttpServer

Builds the router once at boot, so route mistakes fail the boot. Before that, a plugin’s mapping of another crate’s errors stops the boot too: only the app answers its errors.

Source§

fn on_bootstrap(&self, ctx: AppContext) -> BoxFuture<'_, Result<(), BoxError>>

Runs after every on_init succeeded.
Source§

fn on_init( &self, _ctx: AppContext, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + '_>>

Runs once all singletons exist.
Source§

fn on_shutdown( &self, _ctx: AppContext, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + '_>>

Runs during graceful shutdown, after tracked tasks have drained.

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more