[][src]Struct dropshot::HttpServer

pub struct HttpServer { /* fields omitted */ }

A thin wrapper around a Hyper Server object that exposes some interfaces that we find useful (e.g., close()). TODO-cleanup: this mechanism should probably do better with types. In particular, once you call run(), you shouldn't be able to call it again (i.e., it should consume self). But you should be able to close() it. Once you've called close(), you shouldn't be able to call it again.

Implementations

impl HttpServer[src]

pub fn local_addr(&self) -> SocketAddr[src]

pub fn close(self)[src]

pub fn run(&mut self) -> JoinHandle<Result<(), Error>>[src]

pub async fn wait_for_shutdown<'_>(
    &'_ mut self,
    join_handle: JoinHandle<Result<(), Error>>
) -> Result<(), String>
[src]

pub fn new(
    config: &ConfigDropshot,
    api: ApiDescription,
    private: Arc<dyn Any + Send + Sync + 'static>,
    log: &Logger
) -> Result<HttpServer, Error>
[src]

Set up an HTTP server bound on the specified address that runs registered handlers. You must invoke run() on the returned instance of HttpServer (and await the result) to actually start the server. You can call close() to begin a graceful shutdown of the server, which will be complete when the run() Future is resolved. TODO-cleanup We should be able to take a reference to the ApiDescription. We currently can't because we need to hang onto the router.

pub fn app_private(&self) -> Arc<dyn Any + Send + Sync + 'static>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,