Enum tdn::prelude::NetworkType[][src]

pub enum NetworkType {
    Connect(Peer),
    DisConnect(Peer),
    Broadcast(BroadcastVec<u8, Global>),
    NetworkState(StateRequestSender<StateResponse>),
    NetworkReboot,
}
Expand description

channel message send to chamomile network.

Variants

Connect(Peer)

Tuple Fields

0: Peer

when outside want to add a peer to bootstrap and DHT. if connected, TDN will add it to boostrap and DHT. params: peer.

DisConnect(Peer)

Tuple Fields

0: Peer

when outside donnot want to remove peer. use it to force close. params: Peer(socket).

Broadcast(BroadcastVec<u8, Global>)

Tuple Fields

1: Vec<u8, Global>

when need broadcast a data to all network, TDN support some common algorithm, use it, donnot worry. params: broadcast_type and data_bytes

NetworkState(StateRequestSender<StateResponse>)

Tuple Fields

Request for return the network current state info. params: request type, and return channel’s sender (async).

NetworkReboot

When receive ReceiveMessage::NetworkLost, want to reboot network, it can use.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more