pub struct PeerHandle { /* private fields */ }Expand description
Cloneable handle to one connected peer’s outbound sink.
PeerHandles are constructed by the embedder’s connection-accept logic
and surfaced to handlers via CallContext.
Implementations§
Source§impl PeerHandle
impl PeerHandle
Sourcepub fn new(peer_id: PeerId, sink: Arc<dyn PeerSink>) -> Self
pub fn new(peer_id: PeerId, sink: Arc<dyn PeerSink>) -> Self
Build a PeerHandle from a peer id and a PeerSink implementation.
Sourcepub fn send_notify(
&self,
method: &str,
body: NotifyBody,
) -> Result<(), PeerSendError>
pub fn send_notify( &self, method: &str, body: NotifyBody, ) -> Result<(), PeerSendError>
Push a notify message to this peer. See PeerSink::send_notify.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true if the peer’s transport is still open.
Trait Implementations§
Source§impl Clone for PeerHandle
impl Clone for PeerHandle
Auto Trait Implementations§
impl !RefUnwindSafe for PeerHandle
impl !UnwindSafe for PeerHandle
impl Freeze for PeerHandle
impl Send for PeerHandle
impl Sync for PeerHandle
impl Unpin for PeerHandle
impl UnsafeUnpin for PeerHandle
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