Skip to main content

BlockListener

Trait BlockListener 

Source
pub trait BlockListener: Send + Sync {
    // Required methods
    fn chain_slug(&self) -> &str;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<RawEventStream, StreamError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_connected(&self) -> bool;
}
Expand description

Abstracts over different chain RPC backends.

Required Methods§

Source

fn chain_slug(&self) -> &str

Chain slug this listener covers.

Source

fn subscribe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RawEventStream, StreamError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Connect and start streaming raw events. Returns a pinned async stream of RawEvent items.

Source

fn is_connected(&self) -> bool

Returns true if this listener is currently connected.

Implementors§