Skip to main content

#
clap/_cookbook/
typed_derive.rs

    1//! # Example: Custom Types (Derive API)
    2//!
    3//! **This requires enabling the [`derive` feature flag][crate::_features].**
    4//!
    5//! ## Implicit [`Arg::value_parser`][crate::Arg::value_parser]
    6//!
    7//! ```rust
    8#![doc = include_str!("../../examples/typed-derive/implicit.rs")]
    9//! ```
    10//!
    11#![doc = include_str!("../../examples/typed-derive/implicit.md")]
    12//!
    13//! ## Built-in [`TypedValueParser`][crate::builder::TypedValueParser]
    14//!
    15//! ```rust
    16#![doc = include_str!("../../examples/typed-derive/builtin.rs")]
    17//! ```
    18//!
    19#![doc = include_str!("../../examples/typed-derive/builtin.md")]
    20//!
    21//! ## Custom parser function
    22//!
    23//! ```rust
    24#![doc = include_str!("../../examples/typed-derive/fn_parser.rs")]
    25//! ```
    26//!
    27#![doc = include_str!("../../examples/typed-derive/fn_parser.md")]
    28//!
    29//! ## Custom [`TypedValueParser`][crate::builder::TypedValueParser]
    30//!
    31//! ```rust
    32#![doc = include_str!("../../examples/typed-derive/custom.rs")]
    33//! ```
    34//!
    35#![doc = include_str!("../../examples/typed-derive/custom.md")]