Struct jormungandr::network::p2p::comm::CommHandle
source · pub struct CommHandle<T> {
state: SubscriptionState<T>,
direction: SubscriptionDirection,
}
Expand description
Handle used by the per-peer communication tasks to produce an outbound subscription stream towards the peer.
Fields§
§state: SubscriptionState<T>
§direction: SubscriptionDirection
Implementations§
source§impl<T> CommHandle<T>
impl<T> CommHandle<T>
sourcepub fn client_pending(item: T) -> Self
pub fn client_pending(item: T) -> Self
Creates a handle with the Client
direction and an item waiting to be sent,
in expectation for a subscription to be established.
pub fn direction(&self) -> SubscriptionDirection
pub fn is_client(&self) -> bool
pub fn clear_pending(&mut self)
sourcepub fn update(&mut self, newer: CommHandle<T>)
pub fn update(&mut self, newer: CommHandle<T>)
Updates this handle with the subscription state from another handle. This happens when another connection is established to the same peer. This method is used instead of replacing the handle to send a potential pending item over the new subscription.
sourcepub fn subscribe(&mut self) -> OutboundSubscription<T>
pub fn subscribe(&mut self) -> OutboundSubscription<T>
Returns a stream to use as an outbound half of the subscription stream.
If this method is called again on the same handle, the previous subscription is closed and its stream is terminated.
pub fn is_subscribed(&self) -> bool
pub fn try_send(&mut self, item: T) -> Result<(), PropagateError<T>>
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for CommHandle<T>
impl<T> Send for CommHandle<T>where T: Send,
impl<T> Sync for CommHandle<T>where T: Send + Sync,
impl<T> Unpin for CommHandle<T>where T: Unpin,
impl<T> !UnwindSafe for CommHandle<T>
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request