Trait Extension

Source
pub trait Extension:
    Serialize
    + DeserializeOwned
    + Clone {
    type Forks: IsForks;

    // Required methods
    fn get<T: 'static>(&self) -> Option<&T>;
    fn get_any(&self, t: TypeId) -> &dyn Any;
    fn get_any_mut(&mut self, t: TypeId) -> &mut dyn Any;

    // Provided method
    fn forks<BlockNumber, T>(&self) -> Option<Forks<BlockNumber, T>>
       where BlockNumber: Ord + Clone + 'static,
             T: Group + 'static,
             <Self::Forks as IsForks>::Extension: Extension,
             <<Self::Forks as IsForks>::Extension as Group>::Fork: Extension { ... }
}
Expand description

A collection of ChainSpec extensions.

This type can be passed around and allows the core modules to request a strongly-typed, but optional configuration.

Required Associated Types§

Source

type Forks: IsForks

Required Methods§

Source

fn get<T: 'static>(&self) -> Option<&T>

Get an extension of specific type.

Source

fn get_any(&self, t: TypeId) -> &dyn Any

Get an extension of specific type as reference to Any.

Source

fn get_any_mut(&mut self, t: TypeId) -> &mut dyn Any

Get an extension of specific type as mutable reference to Any.

Provided Methods§

Source

fn forks<BlockNumber, T>(&self) -> Option<Forks<BlockNumber, T>>
where BlockNumber: Ord + Clone + 'static, T: Group + 'static, <Self::Forks as IsForks>::Extension: Extension, <<Self::Forks as IsForks>::Extension as Group>::Fork: Extension,

Get forkable extensions of specific type.

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.

Implementors§

Source§

impl Extension for NoExtension

Source§

impl<B, E> Extension for Forks<B, E>
where B: Serialize + DeserializeOwned + Ord + Clone + 'static, E: Extension + Group + 'static,

Source§

type Forks = Forks<B, E>