Struct vtubestudio::service::MakeApiService
source · [−]pub struct MakeApiService<M, R> { /* private fields */ }
Expand description
A [Service
] that yields new ApiService
s and EventStream
s.
This wraps a MakeTransport
(such as TungsteniteConnector
), describing how to connect to
a websocket sink/stream. This is used for as the inner service for the
Reconnect
middleware.
Implementations
sourceimpl<M, R> MakeApiService<M, R>where
M: MakeTransport<R, RequestEnvelope, Item = ResponseEnvelope>,
impl<M, R> MakeApiService<M, R>where
M: MakeTransport<R, RequestEnvelope, Item = ResponseEnvelope>,
sourcepub fn new(maker: M, buffer_size: usize) -> Self
pub fn new(maker: M, buffer_size: usize) -> Self
Creates a new MakeApiService
.
sourceimpl<M, R> MakeApiService<M, R>
impl<M, R> MakeApiService<M, R>
sourcepub fn into_inner(self) -> M
pub fn into_inner(self) -> M
Consumes self
, returning the inner service.
sourceimpl<R> MakeApiService<TungsteniteConnector, R>where
R: Send + IntoClientRequest + Unpin + 'static,
impl<R> MakeApiService<TungsteniteConnector, R>where
R: Send + IntoClientRequest + Unpin + 'static,
sourcepub fn new_tungstenite(buffer_size: usize) -> Self
Available on crate feature tokio-tungstenite
only.
pub fn new_tungstenite(buffer_size: usize) -> Self
tokio-tungstenite
only.Creates a new MakeApiService
using tokio_tungstenite
as the underlying transport.
Trait Implementations
sourceimpl<M: Clone, R: Clone> Clone for MakeApiService<M, R>
impl<M: Clone, R: Clone> Clone for MakeApiService<M, R>
sourcefn clone(&self) -> MakeApiService<M, R>
fn clone(&self) -> MakeApiService<M, R>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<M: Debug, R: Debug> Debug for MakeApiService<M, R>
impl<M: Debug, R: Debug> Debug for MakeApiService<M, R>
sourceimpl<M, R> Service<R> for MakeApiService<M, R>where
M: MakeTransport<R, RequestEnvelope, Item = ResponseEnvelope> + Send,
M::Future: Send + 'static,
M::Transport: Send + 'static,
M::Error: Send,
BoxError: From<M::Error> + From<M::SinkError>,
impl<M, R> Service<R> for MakeApiService<M, R>where
M: MakeTransport<R, RequestEnvelope, Item = ResponseEnvelope> + Send,
M::Future: Send + 'static,
M::Transport: Send + 'static,
M::Error: Send,
BoxError: From<M::Error> + From<M::SinkError>,
type Response = (ApiService<<M as MakeTransport<R, RequestEnvelope>>::Transport>, EventStream<<M as MakeTransport<R, RequestEnvelope>>::Transport>)
type Response = (ApiService<<M as MakeTransport<R, RequestEnvelope>>::Transport>, EventStream<<M as MakeTransport<R, RequestEnvelope>>::Transport>)
Responses given by the service.
type Error = <M as MakeTransport<R, RequestEnvelope>>::MakeError
type Error = <M as MakeTransport<R, RequestEnvelope>>::MakeError
Errors produced by the service.
type Future = Pin<Box<dyn Future<Output = Result<<MakeApiService<M, R> as Service<R>>::Response, <MakeApiService<M, R> as Service<R>>::Error>> + Send + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<MakeApiService<M, R> as Service<R>>::Response, <MakeApiService<M, R> as Service<R>>::Error>> + Send + 'static, Global>>
The future response value.
Auto Trait Implementations
impl<M, R> RefUnwindSafe for MakeApiService<M, R>where
M: RefUnwindSafe,
impl<M, R> Send for MakeApiService<M, R>where
M: Send,
impl<M, R> Sync for MakeApiService<M, R>where
M: Sync,
impl<M, R> Unpin for MakeApiService<M, R>where
M: Unpin,
impl<M, R> UnwindSafe for MakeApiService<M, R>where
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn 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.sourcefn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<Box<dyn Error + Send + Sync + 'static, Global>>,
S: Stream<Item = Request>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<Box<dyn Error + Send + Sync + 'static, Global>>,
S: Stream<Item = Request>,
sourcefn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready
method. Read moresourcefn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read moresourcefn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read moresourcefn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
Maps this service’s result type (
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read moresourcefn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: FnMut(NewRequest) -> Request,
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: FnMut(NewRequest) -> Request,
Composes a function in front of the service. Read more
sourcefn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone,
Fut: Future<Output = Result<Response, Error>>,
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone,
Fut: Future<Output = Result<Response, Error>>,
Composes an asynchronous function after this service. Read more
sourcefn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where
Self: Sized,
F: FnMut(Self::Future) -> Fut,
Error: From<Self::Error>,
Fut: Future<Output = Result<Response, Error>>,
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where
Self: Sized,
F: FnMut(Self::Future) -> Fut,
Error: From<Self::Error>,
Fut: Future<Output = Result<Response, Error>>,
Composes a function that transforms futures produced by the service. Read more