pub struct SolarSail<S, H> { /* private fields */ }
Implementations§
source§impl<S, H> SolarSail<S, H>
impl<S, H> SolarSail<S, H>
pub fn new(state: S, handler: H) -> Self
pub async fn run<F>( self, addr: &SocketAddr ) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn run_in<F, L, B>(
self,
addr: &SocketAddr,
layer: L
) -> Result<(), Box<dyn Error + Send + Sync>>where
S: Clone + Send + Sync + 'static,
H: Fn(S, Request) -> F + Clone + Send + Sync + 'static,
F: Future<Output = Response> + Send + 'static,
L: Layer<Self>,
L::Service: Service<Request<Incoming>, Response = Response<B>> + Clone + Send + Sync + 'static,
<L::Service as Service<Request<Incoming>>>::Future: Send,
<L::Service as Service<Request<Incoming>>>::Error: Error + Send + Sync,
B: Body + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>> + Send + Sync,
Trait Implementations§
source§impl<S, H, F> Service<Request<Incoming>> for SolarSail<S, H>
impl<S, H, F> Service<Request<Incoming>> for SolarSail<S, H>
source§impl<S, H, F> Service<Request<Incoming>> for SolarSail<S, H>
impl<S, H, F> Service<Request<Incoming>> for SolarSail<S, H>
§type Error = Infallible
type Error = Infallible
Errors produced by the service.
§type Future = Pin<Box<dyn Future<Output = Result<<SolarSail<S, H> as Service<Request<Incoming>>>::Response, <SolarSail<S, H> as Service<Request<Incoming>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<SolarSail<S, H> as Service<Request<Incoming>>>::Response, <SolarSail<S, H> as Service<Request<Incoming>>>::Error>> + Send>>
The future response value.
Auto Trait Implementations§
impl<S, H> RefUnwindSafe for SolarSail<S, H>where
H: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, H> Send for SolarSail<S, H>
impl<S, H> Sync for SolarSail<S, H>
impl<S, H> Unpin for SolarSail<S, H>
impl<S, H> UnwindSafe for SolarSail<S, H>where
H: UnwindSafe,
S: UnwindSafe,
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
source§impl<T, B1, B2> HttpService<B1> for T
impl<T, B1, B2> HttpService<B1> for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
👎Deprecated since 0.4.6: please use the
ServiceExt::ready
method insteadYields a mutable reference to the service when it is ready to accept a request.
§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Yields the service when it is ready to accept a request.
§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Consume this
Service
, calling with the providing request once it is ready.§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready
method. Read more§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read more§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read more§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Maps this service’s result type (
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Composes a function in front of the service. Read more
§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Composes an asynchronous function after this service. Read more
§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Composes a function that transforms futures produced by the service. Read more