Trait NotificationsExt

Source
pub trait NotificationsExt {
    // Required method
    fn wait_for<T>(
        &mut self,
        f: impl FnMut(Notification) -> Option<T>,
    ) -> impl Future<Output = Result<T>>;

    // Provided methods
    fn wait_for_events(
        &mut self,
        expected_height: impl Into<Option<BlockHeight>>,
    ) -> impl Future<Output = Result<BTreeSet<StreamId>>> { ... }
    fn wait_for_block(
        &mut self,
        expected_height: impl Into<Option<BlockHeight>>,
    ) -> impl Future<Output = Result<CryptoHash>> { ... }
    fn wait_for_bundle(
        &mut self,
        expected_origin: ChainId,
        expected_height: impl Into<Option<BlockHeight>>,
    ) -> impl Future<Output = Result<()>> { ... }
}

Required Methods§

Source

fn wait_for<T>( &mut self, f: impl FnMut(Notification) -> Option<T>, ) -> impl Future<Output = Result<T>>

Waits for a notification for which f returns Some(t), and returns t.

Provided Methods§

Source

fn wait_for_events( &mut self, expected_height: impl Into<Option<BlockHeight>>, ) -> impl Future<Output = Result<BTreeSet<StreamId>>>

Waits for a NewEvents notification for the given block height. If no height is specified, any height is accepted.

Source

fn wait_for_block( &mut self, expected_height: impl Into<Option<BlockHeight>>, ) -> impl Future<Output = Result<CryptoHash>>

Waits for a NewBlock notification for the given block height. If no height is specified, any height is accepted.

Source

fn wait_for_bundle( &mut self, expected_origin: ChainId, expected_height: impl Into<Option<BlockHeight>>, ) -> impl Future<Output = Result<()>>

Waits for a NewIncomingBundle notification for the given sender chain and sender block height. If no height is specified, any height is accepted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S: Stream<Item = Result<Notification>>> NotificationsExt for Pin<Box<S>>

Source§

async fn wait_for<T>( &mut self, f: impl FnMut(Notification) -> Option<T>, ) -> Result<T>

Implementors§