pub struct Client<Z: NetworkZone> {
pub info: PeerInformation<Z::Addr>,
/* private fields */
}Expand description
This represents a connection to a peer.
It allows sending requests to the peer, but does only does minimal checks that the data returned is the data asked for, i.e. for a certain request the only thing checked will be that the response is the correct response for that request, not that the response contains the correct data.
Fields§
§info: PeerInformation<Z::Addr>Information on the connected peer.
Implementations§
Source§impl<Z: NetworkZone> Client<Z>
impl<Z: NetworkZone> Client<Z>
Sourcepub fn ready_peer_request(&mut self) -> Ready<'_, Self, PeerRequest> ⓘ
pub fn ready_peer_request(&mut self) -> Ready<'_, Self, PeerRequest> ⓘ
Waits for the client to be ready for a PeerRequest, then returns a service to handle one.
Sourcepub fn ready_broadcast(&mut self) -> Ready<'_, Self, BroadcastMessage> ⓘ
pub fn ready_broadcast(&mut self) -> Ready<'_, Self, BroadcastMessage> ⓘ
Waits for the client to be ready for a BroadcastMessage, then returns a service to handle one.
Trait Implementations§
Source§impl<N: NetworkZone> Clone for Client<N>
impl<N: NetworkZone> Clone for Client<N>
Source§impl<N: NetworkZone> Service<BroadcastMessage> for Client<N>
impl<N: NetworkZone> Service<BroadcastMessage> for Client<N>
Source§type Response = PeerResponse
type Response = PeerResponse
Responses given by the service.
Source§type Future = InfallibleOneshotReceiver<Result<<Client<N> as Service<BroadcastMessage>>::Response, <Client<N> as Service<BroadcastMessage>>::Error>>
type Future = InfallibleOneshotReceiver<Result<<Client<N> as Service<BroadcastMessage>>::Response, <Client<N> as Service<BroadcastMessage>>::Error>>
The future response value.
Source§fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
Returns
Poll::Ready(Ok(())) when the service is able to process requests. Read moreSource§fn call(&mut self, request: BroadcastMessage) -> Self::Future
fn call(&mut self, request: BroadcastMessage) -> Self::Future
Process the request and return the response asynchronously. Read more
Source§impl<Z: NetworkZone> Service<PeerRequest> for Client<Z>
impl<Z: NetworkZone> Service<PeerRequest> for Client<Z>
Source§type Response = PeerResponse
type Response = PeerResponse
Responses given by the service.
Source§type Future = InfallibleOneshotReceiver<Result<<Client<Z> as Service<PeerRequest>>::Response, <Client<Z> as Service<PeerRequest>>::Error>>
type Future = InfallibleOneshotReceiver<Result<<Client<Z> as Service<PeerRequest>>::Response, <Client<Z> as Service<PeerRequest>>::Error>>
The future response value.
Source§fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
Returns
Poll::Ready(Ok(())) when the service is able to process requests. Read moreSource§fn call(&mut self, request: PeerRequest) -> Self::Future
fn call(&mut self, request: PeerRequest) -> Self::Future
Process the request and return the response asynchronously. Read more
Auto Trait Implementations§
impl<Z> !RefUnwindSafe for Client<Z>
impl<Z> !UnwindSafe for Client<Z>
impl<Z> Freeze for Client<Z>
impl<Z> Send for Client<Z>
impl<Z> Sync for Client<Z>
impl<Z> Unpin for Client<Z>
impl<Z> UnsafeUnpin for Client<Z>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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§impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
Returns
Poll::Ready when the factory is able to create more services. Read more§fn make_service(
&mut self,
target: Target,
) -> <M as MakeService<Target, Request>>::Future
fn make_service( &mut self, target: Target, ) -> <M as MakeService<Target, Request>>::Future
Create and return a new service value asynchronously.
§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
§fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
§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_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 it with the provided 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
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.