pub enum ProviderCall<Params, Resp, Output = Resp, Map = fn(Resp) -> Output>{
RpcCall(RpcCall<Params, Resp, Output, Map>),
Waiter(Waiter<Resp, Output, Map>),
BoxedFuture(BoxedFut<Output>),
Ready(Option<TransportResult<Output>>),
}Expand description
Variants§
RpcCall(RpcCall<Params, Resp, Output, Map>)
An underlying call to an RPC server.
Waiter(Waiter<Resp, Output, Map>)
A waiter for a batched call to a remote RPC server.
BoxedFuture(BoxedFut<Output>)
A boxed future.
Ready(Option<TransportResult<Output>>)
The output, produces synchronously.
Implementations§
Source§impl<Params, Resp, Output, Map> ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> ProviderCall<Params, Resp, Output, Map>
Sourcepub const fn ready(output: TransportResult<Output>) -> Self
pub const fn ready(output: TransportResult<Output>) -> Self
Instantiate a new ProviderCall from the output.
Sourcepub const fn is_rpc_call(&self) -> bool
pub const fn is_rpc_call(&self) -> bool
True if this is an RPC call.
Sourcepub const fn as_rpc_call(&self) -> Option<&RpcCall<Params, Resp, Output, Map>>
pub const fn as_rpc_call(&self) -> Option<&RpcCall<Params, Resp, Output, Map>>
Fallible cast to RpcCall
Sourcepub const fn as_mut_rpc_call(
&mut self,
) -> Option<&mut RpcCall<Params, Resp, Output, Map>>
pub const fn as_mut_rpc_call( &mut self, ) -> Option<&mut RpcCall<Params, Resp, Output, Map>>
Fallible cast to mutable RpcCall
Sourcepub const fn as_mut_waiter(&mut self) -> Option<&mut Waiter<Resp, Output, Map>>
pub const fn as_mut_waiter(&mut self) -> Option<&mut Waiter<Resp, Output, Map>>
Fallible cast to mutable Waiter
Sourcepub const fn is_boxed_future(&self) -> bool
pub const fn is_boxed_future(&self) -> bool
True if this is a boxed future.
Sourcepub const fn as_boxed_future(&self) -> Option<&BoxedFut<Output>>
pub const fn as_boxed_future(&self) -> Option<&BoxedFut<Output>>
Fallible cast to a boxed future.
Sourcepub const fn as_ready(&self) -> Option<&TransportResult<Output>>
pub const fn as_ready(&self) -> Option<&TransportResult<Output>>
Sourcepub fn map_resp<NewOutput, NewMap>(
self,
map: NewMap,
) -> Result<ProviderCall<Params, Resp, NewOutput, NewMap>, Self>
pub fn map_resp<NewOutput, NewMap>( self, map: NewMap, ) -> Result<ProviderCall<Params, Resp, NewOutput, NewMap>, Self>
Set a function to map the response into a different type. This is
useful for transforming the response into a more usable type, e.g.
changing U64 to u64.
This function fails if the inner future is not an RpcCall or
Waiter.
§Note
Carefully review the rust documentation on fn pointers before passing
them to this function. Unless the pointer is specifically coerced to a
fn(_) -> _, the NewMap will be inferred as that function’s unique
type. This can lead to confusing error messages.
Source§impl<Params, Resp, Output, Map> ProviderCall<&Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> ProviderCall<&Params, Resp, Output, Map>
Sourcepub fn into_owned_params(self) -> ProviderCall<Params::Owned, Resp, Output, Map> ⓘ
pub fn into_owned_params(self) -> ProviderCall<Params::Owned, Resp, Output, Map> ⓘ
Convert this call into one with owned params, by cloning the params.
§Panics
Panics if called after the request has been polled.
Trait Implementations§
Source§impl<Params, Resp> Debug for ProviderCall<Params, Resp>
impl<Params, Resp> Debug for ProviderCall<Params, Resp>
Source§impl<Params, Resp, Output, Map> From<Pin<Box<dyn Future<Output = Result<Output, RpcError<TransportErrorKind>>> + Send>>> for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> From<Pin<Box<dyn Future<Output = Result<Output, RpcError<TransportErrorKind>>> + Send>>> for ProviderCall<Params, Resp, Output, Map>
Source§impl<Params, Resp> From<Receiver<Result<Box<RawValue>, RpcError<TransportErrorKind>>>> for ProviderCall<Params, Resp>
impl<Params, Resp> From<Receiver<Result<Box<RawValue>, RpcError<TransportErrorKind>>>> for ProviderCall<Params, Resp>
Source§impl<Params, Resp, Output, Map> From<RpcCall<Params, Resp, Output, Map>> for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> From<RpcCall<Params, Resp, Output, Map>> for ProviderCall<Params, Resp, Output, Map>
Source§impl<Params, Resp, Output, Map> Future for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> Future for ProviderCall<Params, Resp, Output, Map>
impl<'pin, Params, Resp, Output, Map> Unpin for ProviderCall<Params, Resp, Output, Map>
Auto Trait Implementations§
impl<Params, Resp, Output, Map> Freeze for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output = Resp, Map = fn(_: Resp) -> Output> !RefUnwindSafe for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output, Map> Send for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output = Resp, Map = fn(_: Resp) -> Output> !Sync for ProviderCall<Params, Resp, Output, Map>
impl<Params, Resp, Output = Resp, Map = fn(_: Resp) -> Output> !UnwindSafe for ProviderCall<Params, Resp, Output, Map>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll will never again be called once it has
completed. This method can be used to turn any Future into a
FusedFuture. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
() on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = ()>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = Never>.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
CancellationToken::run_until_cancelled,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken to complete. Read moreSource§fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
CancellationToken::run_until_cancelled_owned,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken to complete. Read moreSource§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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more