[][src]Module sp_consensus::import_queue::buffered_link

Provides the buffered_link utility.

The buffered link is a channel that allows buffering the method calls on Link.

Example

use sp_consensus::import_queue::Link;
let (mut tx, mut rx) = buffered_link::<Block>();
tx.blocks_processed(0, 0, vec![]);

// Calls `my_link.blocks_processed(0, 0, vec![])` when polled.
let _fut = futures::future::poll_fn(move |cx| {
	rx.poll_actions(cx, &mut my_link);
	std::task::Poll::Pending::<()>
});

Structs

BufferedLinkReceiver

See buffered_link.

BufferedLinkSender

See buffered_link.

Functions

buffered_link

Wraps around an unbounded channel from the futures crate. The sender implements Link and can be used to buffer commands, and the receiver can be used to poll said commands and transfer them to another link.