Skip to main content

ChainEvents

Trait ChainEvents 

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

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

    // 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§

type Error: Error + Send + Sync

Required Methods§

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

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§

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§

§

impl<'a, T> ChainEvents for &'a T
where T: 'a + ChainEvents + ?Sized,

§

type Error = <T as ChainEvents>::Error

§

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

§

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

§

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

§

type Error = <T as ChainEvents>::Error

§

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

§

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

§

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

§

type Error = <T as ChainEvents>::Error

§

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

§

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

Implementors§