reth_cli

Trait RethCli

Source
pub trait RethCli: Sized {
    type ChainSpecParser: ChainSpecParser;

    // Required methods
    fn name(&self) -> Cow<'static, str>;
    fn version(&self) -> Cow<'static, str>;
    fn client_version() -> ClientVersion;

    // Provided methods
    fn parse_args() -> Result<Self, Error>
       where Self: Parser { ... }
    fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
       where Self: Parser,
             I: IntoIterator<Item = T>,
             T: Into<OsString> + Clone { ... }
    fn with_runner<F, R>(self, f: F) -> R
       where F: FnOnce(Self, CliRunner) -> R { ... }
    fn execute<F, R>(f: F) -> Result<R, Error>
       where Self: Parser,
             F: FnOnce(Self, CliRunner) -> R { ... }
}
Expand description

Reth based node cli.

This trait is supposed to be implemented by the main struct of the CLI.

It provides commonly used functionality for running commands and information about the CL, such as the name and version.

Required Associated Types§

Source

type ChainSpecParser: ChainSpecParser

The associated ChainSpecParser type

Required Methods§

Source

fn name(&self) -> Cow<'static, str>

The name of the implementation, eg. reth, op-reth, etc.

Source

fn version(&self) -> Cow<'static, str>

The version of the node, such as reth/v1.0.0

Source

fn client_version() -> ClientVersion

The client version of the node.

Provided Methods§

Source

fn parse_args() -> Result<Self, Error>
where Self: Parser,

Parse args from iterator from std::env::args_os().

Source

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where Self: Parser, I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse args from the given iterator.

Source

fn with_runner<F, R>(self, f: F) -> R
where F: FnOnce(Self, CliRunner) -> R,

Executes a command.

Source

fn execute<F, R>(f: F) -> Result<R, Error>
where Self: Parser, F: FnOnce(Self, CliRunner) -> R,

Parses and executes a command.

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§