ChainEvents

Trait ChainEvents 

Source
pub trait ChainEvents {
    type Error: Error + Send + Sync;

    // Required method
    fn subscribe_with_state_sync<I: IntoIterator<Item = StateSyncOptions>>(
        &self,
        options: I,
    ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>;

    // Provided method
    fn subscribe(
        &self,
    ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error> { ... }
}
Expand description

Allows subscribing to on-chain events.

Required Associated Types§

Required Methods§

Source

fn subscribe_with_state_sync<I: IntoIterator<Item = StateSyncOptions>>( &self, options: I, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Subscribe to on-chain events.

The options specify which parts of the current state should be streamed in the form on ChainEvents before any future events are streamed.

When an empty iterator (or simply None) is specified, only all future events are streamed from this point.

Provided Methods§

Source

fn subscribe( &self, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Convenience method for subscribing to on-chain events without specifying any state sync options.

See ChainEvents::subscribe_with_state_sync.

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<'a, T: 'a + ChainEvents + ?Sized> ChainEvents for &'a T

Source§

type Error = <T as ChainEvents>::Error

Source§

fn subscribe( &self, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Source§

fn subscribe_with_state_sync<I: IntoIterator<Item = StateSyncOptions>>( &self, options: I, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Source§

impl<T: ChainEvents + ?Sized> ChainEvents for Box<T>

Source§

type Error = <T as ChainEvents>::Error

Source§

fn subscribe( &self, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Source§

fn subscribe_with_state_sync<I: IntoIterator<Item = StateSyncOptions>>( &self, options: I, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Source§

impl<T: ChainEvents + ?Sized> ChainEvents for Arc<T>

Source§

type Error = <T as ChainEvents>::Error

Source§

fn subscribe( &self, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Source§

fn subscribe_with_state_sync<I: IntoIterator<Item = StateSyncOptions>>( &self, options: I, ) -> Result<impl Stream<Item = ChainEvent> + Send + 'static, Self::Error>

Implementors§