pub struct MeshHandle {
pub id: PeerId,
/* private fields */
}Expand description
Shared handle returned by LocalMesh::join. Keeps the channel alive and
lets the peer publish back into the mesh.
Fields§
§id: PeerIdPeer id.
Implementations§
Source§impl MeshHandle
impl MeshHandle
Sourcepub async fn publish(&self, msg: PeerMessage) -> Result<()>
pub async fn publish(&self, msg: PeerMessage) -> Result<()>
Publish a message to whichever peers it is destined for.
Routing rules:
PeerMessage::Hello/PeerMessage::Resultgo to every peer except the sender.PeerMessage::Directgoes totoonly.PeerMessage::Broadcastgoes to every peer subscribed to the topic (empty subscription list = all topics).PeerMessage::Taskgoes to every peer except the sender — first to claim it wins, by convention.
Trait Implementations§
Source§impl Clone for MeshHandle
impl Clone for MeshHandle
Source§fn clone(&self) -> MeshHandle
fn clone(&self) -> MeshHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MeshHandle
impl !RefUnwindSafe for MeshHandle
impl Send for MeshHandle
impl Sync for MeshHandle
impl Unpin for MeshHandle
impl UnsafeUnpin for MeshHandle
impl !UnwindSafe for MeshHandle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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