pub trait CanonStateSubscriptions: Send + Sync {
type Primitives: NodePrimitives;
// Required method
fn subscribe_to_canonical_state(
&self,
) -> CanonStateNotifications<Self::Primitives>;
// Provided method
fn canonical_state_stream(
&self,
) -> CanonStateNotificationStream<Self::Primitives> { ... }
}Expand description
A type that allows to register chain related event subscriptions.
Required Associated Types§
Sourcetype Primitives: NodePrimitives
type Primitives: NodePrimitives
The node primitive types.
Required Methods§
Sourcefn subscribe_to_canonical_state(
&self,
) -> CanonStateNotifications<Self::Primitives>
fn subscribe_to_canonical_state( &self, ) -> CanonStateNotifications<Self::Primitives>
Get notified when a new canonical chain was imported.
A canonical chain be one or more blocks, a reorg or a revert.
Provided Methods§
Sourcefn canonical_state_stream(
&self,
) -> CanonStateNotificationStream<Self::Primitives>
fn canonical_state_stream( &self, ) -> CanonStateNotificationStream<Self::Primitives>
Convenience method to get a stream of CanonStateNotification.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: CanonStateSubscriptions> CanonStateSubscriptions for &T
impl<T: CanonStateSubscriptions> CanonStateSubscriptions for &T
type Primitives = <T as CanonStateSubscriptions>::Primitives
fn subscribe_to_canonical_state( &self, ) -> CanonStateNotifications<Self::Primitives>
fn canonical_state_stream( &self, ) -> CanonStateNotificationStream<Self::Primitives>
Implementors§
Source§impl CanonStateSubscriptions for TestCanonStateSubscriptions
Available on crate features test-utils only.
impl CanonStateSubscriptions for TestCanonStateSubscriptions
Available on crate features
test-utils only.