pub trait ClapClingExt: Sized {
// Required method
fn into_cling(self) -> Cling<Self, Ready>;
}Expand description
Enables clap structs to be executed with cling.
This extension trait allows clap users to parse their clap structs as usual, then run them with cling without constructing a Cling instance explicitly.
Example:
use cling::prelude::*;
#[derive(Run, Parser, Debug, Clone)]
#[cling(run = "run")]
pub struct App {
/// Turn debugging information on
#[arg(short, long, action = ArgAction::Count)]
pub debug: u8,
}
pub async fn run() {
println!("Hello, world!");
}
#[tokio::main]
async fn main() {
let app = App::parse();
let app = app.into_cling();
app.run_and_exit().await;
}Required Methods§
fn into_cling(self) -> Cling<Self, Ready>
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.