Struct libp2p::request_response::handler::RequestProtocol
source · pub struct RequestProtocol<TCodec>where
TCodec: RequestResponseCodec,{ /* private fields */ }
Expand description
Request substream upgrade protocol.
Sends a request and receives a response.
Trait Implementations§
source§impl<TCodec> Debug for RequestProtocol<TCodec>where
TCodec: RequestResponseCodec,
impl<TCodec> Debug for RequestProtocol<TCodec>where TCodec: RequestResponseCodec,
source§impl<TCodec> OutboundUpgrade<Negotiated<SubstreamBox>> for RequestProtocol<TCodec>where
TCodec: RequestResponseCodec + Send + 'static,
impl<TCodec> OutboundUpgrade<Negotiated<SubstreamBox>> for RequestProtocol<TCodec>where TCodec: RequestResponseCodec + Send + 'static,
§type Output = <TCodec as RequestResponseCodec>::Response
type Output = <TCodec as RequestResponseCodec>::Response
Output after the upgrade has been successfully negotiated and the handshake performed.
§type Future = Pin<Box<dyn Future<Output = Result<<RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output, <RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error>> + Send, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output, <RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error>> + Send, Global>>
Future that performs the handshake with the remote.
source§fn upgrade_outbound(
self,
io: Negotiated<SubstreamBox>,
protocol: <RequestProtocol<TCodec> as UpgradeInfo>::Info
) -> <RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future
fn upgrade_outbound( self, io: Negotiated<SubstreamBox>, protocol: <RequestProtocol<TCodec> as UpgradeInfo>::Info ) -> <RequestProtocol<TCodec> as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future
After we have determined that the remote supports one of the protocols we support, this
method is called to start the handshake. Read more
source§impl<TCodec> UpgradeInfo for RequestProtocol<TCodec>where
TCodec: RequestResponseCodec,
impl<TCodec> UpgradeInfo for RequestProtocol<TCodec>where TCodec: RequestResponseCodec,
§type Info = <TCodec as RequestResponseCodec>::Protocol
type Info = <TCodec as RequestResponseCodec>::Protocol
Opaque type representing a negotiable protocol.
§type InfoIter = IntoIter<[<RequestProtocol<TCodec> as UpgradeInfo>::Info; 2]>
type InfoIter = IntoIter<[<RequestProtocol<TCodec> as UpgradeInfo>::Info; 2]>
Iterator returned by
protocol_info
.source§fn protocol_info(&self) -> <RequestProtocol<TCodec> as UpgradeInfo>::InfoIter
fn protocol_info(&self) -> <RequestProtocol<TCodec> as UpgradeInfo>::InfoIter
Returns the list of protocols that are supported. Used during the negotiation process.
Auto Trait Implementations§
impl<TCodec> RefUnwindSafe for RequestProtocol<TCodec>where TCodec: RefUnwindSafe, <TCodec as RequestResponseCodec>::Protocol: RefUnwindSafe, <TCodec as RequestResponseCodec>::Request: RefUnwindSafe,
impl<TCodec> Send for RequestProtocol<TCodec>where TCodec: Send,
impl<TCodec> Sync for RequestProtocol<TCodec>where TCodec: Sync, <TCodec as RequestResponseCodec>::Protocol: Sync, <TCodec as RequestResponseCodec>::Request: Sync,
impl<TCodec> Unpin for RequestProtocol<TCodec>where TCodec: Unpin, <TCodec as RequestResponseCodec>::Protocol: Unpin, <TCodec as RequestResponseCodec>::Request: Unpin,
impl<TCodec> UnwindSafe for RequestProtocol<TCodec>where TCodec: UnwindSafe, <TCodec as RequestResponseCodec>::Protocol: UnwindSafe + RefUnwindSafe, <TCodec as RequestResponseCodec>::Request: 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> 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<C, U> OutboundUpgradeExt<C> for Uwhere
U: OutboundUpgrade<C>,
impl<C, U> OutboundUpgradeExt<C> for Uwhere U: OutboundUpgrade<C>,
source§fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>where
Self: Sized,
F: FnOnce(Self::Output) -> T,
fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>where Self: Sized, F: FnOnce(Self::Output) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Output
.source§fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> T,
fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>where Self: Sized, F: FnOnce(Self::Error) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Error
.