{"id":8047,"date":"2022-03-27T16:45:13","date_gmt":"2022-03-27T07:45:13","guid":{"rendered":"https:\/\/taki-lab.site\/bocci\/?p=8047"},"modified":"2022-03-27T16:45:17","modified_gmt":"2022-03-27T07:45:17","slug":"rust%e5%8b%89%e5%bc%b7%e4%b8%ad%e3%80%813-27%e3%81%ae%e7%a9%8d%e3%81%bf%e4%b8%8a%e3%81%92","status":"publish","type":"post","link":"https:\/\/taki-lab.site\/bocci\/?p=8047","title":{"rendered":"Rust\u52c9\u5f37\u4e2d\u30013\/27\u306e\u7a4d\u307f\u4e0a\u3052"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u3053\u306e\u672c\u3092\u4f7f\u7528\u3057\u3066\u52c9\u5f37\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<iframe sandbox=\"allow-popups allow-scripts allow-modals allow-forms allow-same-origin\" style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=taki0416-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B08PF27TRZ&#038;linkId=24eaf719e6bb3816340a4841e6f12202\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u65e5\u306f\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u5f15\u6570\u3092\u53d6\u5f97\u3059\u308b\u51e6\u7406\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clap\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u305f\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u304c\u53e4\u3044\u306e\u3067\u305d\u306e\u307e\u307e\u4f7f\u3048\u305a\u3001\u7d50\u5c40\u516c\u5f0f\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u898b\u308b\u30cf\u30e1\u306b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.rs\/clap\/latest\/clap\/\">https:\/\/docs.rs\/clap\/latest\/clap\/<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;dependencies]\r\nclap = { version = \"3.1.6\", features = &#91;\"derive\"] }\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>use clap::Parser;\r\n\r\n#&#91;derive(Parser, Debug)]\r\n#&#91;clap(\r\n    name = \"My RPM program\",\r\n    version = \"1.0.0\",\r\n    author = \"Your name\",\r\n    about = \"Super awesome sample RPM calculator\"\r\n)]\r\nstruct Opts {\r\n    #&#91;clap(short, long)]\r\n    verbose: bool,\r\n\r\n    #&#91;clap(name = \"FILE\")]\r\n    formula_file: Option&lt;String>,\r\n}\r\n\r\nfn main() {\r\n    let opts = Opts::parse();\r\n    match opts.formula_file {\r\n        Some(file) => println!(\"File specified: {}\", file),\r\n        None => println!(\"No file specified.\"),\r\n    }\r\n    println!(\"Is verbosity specified?: {}\", opts.verbose);\r\n}\r\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Clap\u3092\u9069\u7528\u3059\u308b\u306b\u306f\u3001Cargo.toml\u306e[dependencies]\u306b\u4e00\u6587\u3092\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067OK\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001\u30c6\u30ad\u30b9\u30c8\u3067\u306fclap::Clap\u3068\u66f8\u304b\u308c\u3066\u3044\u305f\u304c\u3001\u6700\u65b0\u7248\u3067\u306fclap::Parser\u304c\u6b63\u89e3\u3089\u3057\u3044\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f6e\u304d\u63db\u3048\u305f\u306e\u306f\u305d\u308c\u304f\u3089\u3044\u304b\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/rust\/samplecli$ cargo run\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli`\r\nNo file specified.\r\nIs verbosity specified?: false\r\n\n~\/rust\/samplecli$ cargo run -- input.txt\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli input.txt`\r\nFile specified: input.txt\r\nIs verbosity specified?: false\r\n\n~\/rust\/samplecli$ cargo run -- -v input.txt\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli -v input.txt`\r\nFile specified: input.txt\r\nIs verbosity specified?: true\r\n\n~\/rust\/samplecli$ cargo run -- -h\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli -h`\r\nMy RPM program 1.0.0\r\nYour name\r\nSuper awesome sample RPM calculator\r\n\r\nUSAGE:\r\n    samplecli &#91;OPTIONS] &#91;FILE]\r\n\r\nARGS:\r\n    &lt;FILE>    \r\n\r\nOPTIONS:\r\n    -h, --help       Print help information\r\n    -v, --verbose    \r\n    -V, --version    Print version information\r\n\n~\/rust\/samplecli$ cargo run -- -d\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli -d`\r\nerror: Found argument '-d' which wasn't expected, or isn't valid in this context\r\n\r\n        If you tried to supply `-d` as a value rather than a flag, use `-- -d`\r\n\r\nUSAGE:\r\n    samplecli &#91;OPTIONS] &#91;FILE]\r\n\r\nFor more information try --help\r\n\n~\/rust\/samplecli$ cargo run -- input.txt input2.txt\r\n    Finished dev &#91;unoptimized + debuginfo] target(s) in 0.01s\r\n     Running `target\/debug\/samplecli input.txt input2.txt`\r\nerror: Found argument 'input2.txt' which wasn't expected, or isn't valid in this context\r\n\r\nUSAGE:\r\n    samplecli &#91;OPTIONS] &#91;FILE]\r\n\r\nFor more information try --help\r\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u672c\u3092\u4f7f\u7528\u3057\u3066\u52c9\u5f37\u3057\u3066\u3044\u307e\u3059\u3002 \u672c\u65e5\u306f\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u5f15\u6570\u3092\u53d6\u5f97\u3059\u308b\u51e6\u7406\u3002 Clap\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u305f\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u304c\u53e4\u3044\u306e\u3067\u305d\u306e\u307e\u307e\u4f7f\u3048\u305a\u3001\u7d50\u5c40\u516c\u5f0f\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u898b\u308b\u30cf\u30e1\u306b\u3002 https:\/\/docs &hellip; <a href=\"https:\/\/taki-lab.site\/bocci\/?p=8047\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Rust\u52c9\u5f37\u4e2d\u30013\/27\u306e\u7a4d\u307f\u4e0a\u3052<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2542,3],"tags":[],"class_list":["post-8047","post","type-post","status-publish","format-standard","hentry","category-rust","category-3"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8SDbY-25N","jetpack-related-posts":[{"id":8084,"url":"https:\/\/taki-lab.site\/bocci\/?p=8084","url_meta":{"origin":8047,"position":0},"title":"RUST\u52c9\u5f37\u4e2d\u30014\/3\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e744\u67083\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=8047 \u524d\u56de\u306e\u7d9a\u304d\u3002 \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u2026","rel":"","context":"Rust","block_context":{"text":"Rust","link":"https:\/\/taki-lab.site\/bocci\/?cat=2542"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8476,"url":"https:\/\/taki-lab.site\/bocci\/?p=8476","url_meta":{"origin":8047,"position":1},"title":"RUST\u52c9\u5f37\u4e2d\u30016\/4\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e746\u67085\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=8454 \u524d\u56de\u306e\u7d9a\u304d\u3002 anyhow\u30af\u2026","rel":"","context":"Rust","block_context":{"text":"Rust","link":"https:\/\/taki-lab.site\/bocci\/?cat=2542"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8208,"url":"https:\/\/taki-lab.site\/bocci\/?p=8208","url_meta":{"origin":8047,"position":2},"title":"RUST\u52c9\u5f37\u4e2d\u30014\/23\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e744\u670826\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=8084 \u524d\u56de\u306e\u7d9a\u304d\u3002 \u9006\u30dd\u30fc\u30e9\u30f3\u30c9\u8a18\u2026","rel":"","context":"\u51fa\u6765\u4e8b","block_context":{"text":"\u51fa\u6765\u4e8b","link":"https:\/\/taki-lab.site\/bocci\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8638,"url":"https:\/\/taki-lab.site\/bocci\/?p=8638","url_meta":{"origin":8047,"position":3},"title":"RUST\u52c9\u5f37\u4e2d\u30016\/26\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e746\u670828\u65e5","format":false,"excerpt":"\u524d\u56de\u306e\u7d9a\u304d https:\/\/taki-lab.site\/bocci\/?p=8476 \u4eca\u56de\u306fthise\u2026","rel":"","context":"Rust","block_context":{"text":"Rust","link":"https:\/\/taki-lab.site\/bocci\/?cat=2542"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8662,"url":"https:\/\/taki-lab.site\/bocci\/?p=8662","url_meta":{"origin":8047,"position":4},"title":"RUST\u52c9\u5f37\u4e2d\u30017\/3\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e747\u67084\u65e5","format":false,"excerpt":"\u9006\u30dd\u30fc\u30e9\u30f3\u30c9\u8a18\u6cd5\u8a08\u7b97\u6a5f\u306banyhow\u30af\u30ec\u30fc\u30c8\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002 https:\/\/taki-lab.\u2026","rel":"","context":"Rust","block_context":{"text":"Rust","link":"https:\/\/taki-lab.site\/bocci\/?cat=2542"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8785,"url":"https:\/\/taki-lab.site\/bocci\/?p=8785","url_meta":{"origin":8047,"position":5},"title":"RUST\u52c9\u5f37\u4e2d\u30017\/17\u306e\u7a4d\u307f\u4e0a\u3052","author":"taki","date":"2022\u5e747\u670821\u65e5","format":false,"excerpt":"\u4eca\u9031\u304b\u3089Web\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002 \u307e\u305a\u306f\u304a\u99b4\u67d3\u307f\u306eHello wor\u2026","rel":"","context":"Rust","block_context":{"text":"Rust","link":"https:\/\/taki-lab.site\/bocci\/?cat=2542"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2022\/07\/Screenshot-2022-07-17-131513.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2022\/07\/Screenshot-2022-07-17-131513.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2022\/07\/Screenshot-2022-07-17-131513.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/8047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8047"}],"version-history":[{"count":1,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/8047\/revisions"}],"predecessor-version":[{"id":8049,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/8047\/revisions\/8049"}],"wp:attachment":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}