Skip to main content

FdlArgsTrait

Trait FdlArgsTrait 

Source
pub trait FdlArgsTrait: Sized {
    // Required methods
    fn try_parse_from(args: &[String]) -> Result<Self, String>;
    fn schema() -> Schema;
    fn render_help() -> String;

    // Provided method
    fn parse() -> Self { ... }
}
Expand description

Trait implemented by #[derive(FdlArgs)]. Carries the metadata needed to parse argv into a concrete type and to emit the --fdl-schema JSON.

The name is FdlArgsTrait to avoid colliding with the re-exported derive macro FdlArgs (which lives in the derive-macro namespace). Users never refer to this trait directly — the derive implements it.

Required Methods§

Source

fn try_parse_from(args: &[String]) -> Result<Self, String>

Parse from an explicit argv slice. First element is the program name (ignored), following elements are flags/values/positionals.

Source

fn schema() -> Schema

Return the JSON schema for this CLI shape.

Source

fn render_help() -> String

Render --help to a string.

Provided Methods§

Source

fn parse() -> Self

Parse argv into Self. Uses std::env::args() by default.

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§