Skip to content

Instantly share code, notes, and snippets.

View CreepySkeleton's full-sized avatar
☠️
Listerning to the voices in my head

CreepySkeleton

☠️
Listerning to the voices in my head
View GitHub Profile
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std;
use structopt::StructOpt;
pub struct A {
#[structopt(flatten)]
pub b: B,
}
@CreepySkeleton
CreepySkeleton / sketch.rs
Created February 3, 2020 09:25
"Multiple traits" approach for clap_derive
/// This trait is just a convenience on top of FromArgMatches + IntoApp
///
/// All the methods are provided.
trait Clap: FromArgMatches + IntoApp + Sized {
/// Parse from `std::env::args()`, exit on error
fn parse() -> Self {
let matches = <Self as IntoApp>::into_app().get_matches();
<Self as FromArgMatches>::from_argmatches(matches)
<html>
<head>
<title>Cargo Build Timings — clap 3.0.0-beta.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
<html>
<head>
<title>Cargo Build Timings — clap 3.0.0-beta.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
<html>
<head>
<title>Cargo Build Timings — clap 3.0.0-beta.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}