pub enum Command<M: Message> {
Connect(Target),
Disconnect(PeerId),
Message(PeerId, M),
}Expand description
Command variants for the reactor to process.
Variants§
Connect(Target)
Connect to a remote host.
Disconnect(PeerId)
Disconnect from a peer.
Message(PeerId, M)
Send a message to a peer.
Implementations§
Source§impl<M: Message> Command<M>
impl<M: Message> Command<M>
Sourcepub fn connect(target: impl Into<Target>) -> Self
pub fn connect(target: impl Into<Target>) -> Self
Convenience function that converts a compatible argument into a connect Target.
Works on types such as:
SocketAddrSocketAddrV4SocketAddrV6(Ipv4Addr, u16)– (address, port)(Ipv6Addr, u16)– (address, port)- [
(String, u16)] – (domain, port) - [
(&str, u16)] – (domain, port)
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for Command<M>where
M: Freeze,
impl<M> RefUnwindSafe for Command<M>where
M: RefUnwindSafe,
impl<M> Send for Command<M>
impl<M> Sync for Command<M>
impl<M> Unpin for Command<M>where
M: Unpin,
impl<M> UnwindSafe for Command<M>where
M: 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