Skip to main content

ChainSpecParser

Trait ChainSpecParser 

Source
pub trait ChainSpecParser:
    Clone
    + Send
    + Sync
    + 'static {
    type ChainSpec: Debug + Send + Sync;

    const SUPPORTED_CHAINS: &'static [&'static str];

    // Required method
    fn parse(s: &str) -> Result<Arc<Self::ChainSpec>>;

    // Provided methods
    fn default_value() -> Option<&'static str> { ... }
    fn parser() -> impl TypedValueParser<Value = Arc<Self::ChainSpec>> { ... }
    fn help_message() -> String { ... }
}
Expand description

Trait for parsing chain specifications.

This trait extends [clap::builder::TypedValueParser] to provide a parser for chain specifications. Implementers of this trait must provide a list of supported chains and a function to parse a given string into a chain spec.

Required Associated Constants§

Source

const SUPPORTED_CHAINS: &'static [&'static str]

List of supported chains.

Required Associated Types§

Source

type ChainSpec: Debug + Send + Sync

The chain specification type.

Required Methods§

Source

fn parse(s: &str) -> Result<Arc<Self::ChainSpec>>

Parses the given string into a chain spec.

§Arguments
  • s - A string slice that holds the chain spec to be parsed.
§Errors

This function will return an error if the input string cannot be parsed into a valid chain spec.

Provided Methods§

Source

fn default_value() -> Option<&'static str>

The default value for the chain spec parser.

Source

fn parser() -> impl TypedValueParser<Value = Arc<Self::ChainSpec>>

Produces a [TypedValueParser] for this chain spec parser.

Source

fn help_message() -> String

Produces a help message for the chain spec argument.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§