pub trait Dialer: Stream<Item = (NodeId, Result<Self::Connection>)> + Unpin {
type Connection: Clone + 'static;
// Required methods
fn queue_dial(&mut self, node_id: NodeId);
fn pending_count(&self) -> usize;
fn is_pending(&self, node: NodeId) -> bool;
fn node_id(&self) -> NodeId;
}
Available on crate feature
downloader
only.Expand description
Trait modeling a dialer. This allows for IO-less testing.
Required Associated Types§
Sourcetype Connection: Clone + 'static
type Connection: Clone + 'static
Type of connections returned by the Dialer.
Required Methods§
Sourcefn queue_dial(&mut self, node_id: NodeId)
fn queue_dial(&mut self, node_id: NodeId)
Dial a node.
Sourcefn pending_count(&self) -> usize
fn pending_count(&self) -> usize
Get the number of dialing nodes.
Sourcefn is_pending(&self, node: NodeId) -> bool
fn is_pending(&self, node: NodeId) -> bool
Check if a node is being dialed.