{"id":6428,"date":"2023-01-10T16:36:48","date_gmt":"2023-01-10T08:36:48","guid":{"rendered":"https:\/\/i007.vip:15443\/wordpress\/?p=6428"},"modified":"2023-01-10T16:36:48","modified_gmt":"2023-01-10T08:36:48","slug":"rust-cargo%e4%bd%bf%e7%94%a8%e6%8c%87%e5%8d%97-%e7%ac%ac%e4%b8%80%e7%af%87-%e5%88%9d%e5%8d%b0%e8%b1%a1","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/6428","title":{"rendered":"Rust Cargo\u4f7f\u7528\u6307\u5357 | \u7b2c\u4e00\u7bc7 | \u521d\u5370\u8c61"},"content":{"rendered":"<header class=\"Post-Header\">\n<p class=\"Post-Title\"><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/470251959\">\u539f\u6587\u5730\u5740<\/a><\/p>\n<p>\u00a0<\/p>\n<div class=\"Post-Author\">\n<div class=\"AuthorInfo\">\n<div class=\"AuthorInfo\">\n<div class=\"css-1gomreu\"><a class=\"UserLink-link\" href=\"https:\/\/www.zhihu.com\/people\/iSunface\" target=\"_blank\" rel=\"noopener\" data-za-detail-view-element_name=\"User\"><img decoding=\"async\" class=\"Avatar AuthorInfo-avatar css-1y9jkzv\" src=\"https:\/\/picx.zhimg.com\/v2-e2bba12cc97004500982d3c6f1b6eaeb_l.jpg?source=172ae18b\" srcset=\"https:\/\/picx.zhimg.com\/v2-e2bba12cc97004500982d3c6f1b6eaeb_l.jpg?source=172ae18b 2x\" alt=\"\u5b59\u98de Sunface\" \/><\/a><\/div>\n<div class=\"AuthorInfo-content\">\n<div class=\"AuthorInfo-head\">\n<div class=\"css-1gomreu\"><a class=\"UserLink-link\" href=\"https:\/\/www.zhihu.com\/people\/iSunface\" target=\"_blank\" rel=\"noopener\" data-za-detail-view-element_name=\"User\">\u5b59\u98de Sunface<\/a><\/div>\n<p><span class=\"UserLink AuthorInfo-name\"><span class=\"css-2dtzk2\">\u200b<img decoding=\"async\" class=\"css-1m3x3v9\" src=\"https:\/\/picx.zhimg.com\/v2-4812630bc27d642f7cafcd6cdeca3d7a.jpg?source=88ceefae\" alt=\"\" \/><\/span><\/span><\/div>\n<div class=\"AuthorInfo-detail\">\n<div class=\"AuthorInfo-badge\">\n<div class=\"ztext AuthorInfo-badgeText css-0\">course.rs \u4f5c\u8005<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><button class=\"Button FollowButton Button--primary Button--blue\" type=\"button\">\u200b\u5173\u6ce8\u4ed6<\/button><\/div>\n<div class=\"LabelContainer-wrapper\"><\/div>\n<div tabindex=\"0\" role=\"button\"><span class=\"Voters\"><button class=\"Button Button--plain\" type=\"button\">42 \u4eba\u8d5e\u540c\u4e86\u8be5\u6587\u7ae0<\/button><\/span><\/div>\n<\/header>\n<div class=\"Post-RichTextContainer\">\n<div class=\"css-1yuhvjn\">\n<div class=\"css-376mun\">\n<div class=\"css-l44lgl\">\n<div class=\"css-1leb52y\">\n<div class=\"css-s1xz2x\">\n<div>\n<div class=\"Catalog isCatalogV2 css-17v5fjs\" data-za-detail-view-name=\"\u6b63\u6587\">\n<div class=\"css-8kjoqe\">\n<div class=\"css-wgpue5\">\n<div class=\"css-zkfaav\">\u200b<\/p>\n<div class=\"css-5287jj\">\u76ee\u5f55<\/div>\n<\/div>\n<div class=\"css-17oyyq4\">\u6536\u8d77<\/div>\n<\/div>\n<\/div>\n<div class=\"css-vm33ny\">\n<div class=\"Catalog-content css-a3sv8e\">\n<div class=\"Catalog-FirstLevelTitle Catalog-Title css-1kilzsx\">\n<div class=\"css-hvuawc\" data-catalog-target-id=\"h_470251959_0\" data-za-detail-view-id=\"9745\" data-za-detail-view-action=\"Click\" data-za-detail-view-name=\"\u6b63\u6587\">\n<div class=\"css-nj7ofv\">\u4e0a\u624b\u4f7f\u7528<\/div>\n<\/div>\n<\/div>\n<div class=\"Catalog-FirstLevelTitle Catalog-Title css-1j4gbp4\">\n<div class=\"css-hvuawc\" data-catalog-target-id=\"h_470251959_1\" data-za-detail-view-id=\"9745\" data-za-detail-view-action=\"Click\" data-za-detail-view-name=\"\u6b63\u6587\">\n<div class=\"css-nj7ofv\">\u4e3a\u4f55\u4f1a\u6709Cargo<\/div>\n<\/div>\n<\/div>\n<div class=\"Catalog-SecondLevelTitle Catalog-Title css-s9jga1\">\n<div class=\"css-lwqo8e\" data-catalog-target-id=\"h_470251959_2\" data-za-detail-view-id=\"9745\" data-za-detail-view-action=\"Click\" data-za-detail-view-name=\"\u6b63\u6587\">\n<div class=\"css-nj7ofv\">Cargo\u89e3\u51b3\u7684\u95ee\u9898<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"RichText ztext Post-RichText css-4em6pe\">\n<blockquote data-first-child=\"\" data-pid=\"MPclqVRh\"><p>\u76ee\u524d\u73b0\u5b58\u7684 Cargo Book \u4e2d\u6587\u7ffb\u8bd1\u8d28\u91cf\u666e\u904d\u4e0d\u6562\u606d\u7ef4\uff0c\u800c\u4e14\u5f80\u5f80\u90fd\u5df2\u8fc7\u65f6\u8bb8\u4e45\uff0c\u56e0\u6b64\u65b0\u5f00\u4e00\u4e2a\u5751: Cargo\u4f7f\u7528\u6307\u5357\uff0c\u76ee\u6807\u662f\u7ffb\u8bd1\u5b98\u65b9\u7684\u6587\u6863\u5e76\u5bf9\u5176\u5185\u5bb9\u8fdb\u884c\u9002\u5f53\u5220\u51cf(\u4f8b\u5982\uff0c\u5220\u51cf\u4e00\u4e9b 99% \u7684\u7528\u6237\u90fd\u7528\u4e0d\u5230\u7684\u5185\u5bb9)\u548c\u518d\u7ec4\u7ec7\u3002<\/p><\/blockquote>\n<p data-pid=\"M7NX4QzS\">Rust \u8bed\u8a00\u7684\u540d\u6c14\u4e4b\u6240\u4ee5\u8fd9\u4e48\u5927\uff0c\u4fdd\u5b88\u4f30\u8ba1\u00a0<code>Cargo<\/code>\u00a0\u7684\u8d21\u732e\u5c31\u5360\u4e86\u4e09\u5206\u4e4b\u4e00\u3002<\/p>\n<p data-pid=\"ZDdfa_D0\"><code>Cargo<\/code>\u00a0\u662f\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u4f9d\u8d56\u5305\u7684\u4e0b\u8f7d\u3001\u7f16\u8bd1\u3001\u66f4\u65b0\u3001\u5206\u53d1\u7b49\uff0c\u4e0e\u00a0<code>Cargo<\/code>\u00a0\u4e00\u6837\u6709\u540d\u7684\u8fd8\u6709\u00a0<code><\/code><a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/crates.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">crates.io<\/a>\uff0c\u5b83\u662f\u793e\u533a\u63d0\u4f9b\u7684\u5305\u6ce8\u518c\u670d\u52a1\uff1a\u7528\u6237\u53ef\u4ee5\u5c06\u81ea\u5df1\u7684\u5305\u53d1\u5e03\u5230\u00a0<code>crates.io<\/code>\uff0c\u7136\u540e\u5176\u5b83\u7528\u6237\u8fd8\u80fd\u901a\u8fc7\u00a0<code>crates.io<\/code>\u5f15\u5165\u8be5\u5305\u3002<\/p>\n<p data-pid=\"gRrnodTV\">\u4e0b\u9762\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u00a0<code>Cargo<\/code>\u00a0\u8be5\u5982\u4f55\u4e0a\u624b\u4f7f\u7528\u3002 \u4f46\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u5148\u6765\u660e\u786e\u4e00\u4e2a\u540d\u8bcd: Package\uff0c\u7531\u4e8e Crate \u88ab\u7ffb\u8bd1\u6210\u5305\uff0c\u56e0\u6b64 Package \u518d\u88ab\u7ffb\u8bd1\u6210\u5305\u5c31\u5f88\u4e0d\u5408\u9002\uff0c\u7ecf\u8fc7\u659f\u914c\uff0c\u6211\u4eec\u51b3\u5b9a\u7ffb\u8bd1\u6210\u9879\u76ee\uff0c\u4f60\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\u5de5\u7a0b\u3001\u8f6f\u4ef6\u5305\uff0c<b>\u603b\u4e4b\uff0c\u5728\u672c\u4e66\u4e2dPackage \u610f\u5473\u7740\u9879\u76ee\uff0c\u800c\u9879\u76ee\u4e5f\u610f\u5473\u7740 Package<\/b>\u00a0\u3002<\/p>\n<h2 id=\"h_470251959_0\" data-into-catalog-status=\"\">\u4e0a\u624b\u4f7f\u7528<\/h2>\n<p data-pid=\"3WwmvYBu\">Cargo \u4f1a\u5728\u5b89\u88c5 Rust \u7684\u65f6\u5019\u4e00\u5e76\u8fdb\u884c\u5b89\u88c5\uff0c\u65e0\u9700\u6211\u4eec\u624b\u52a8\u7684\u64cd\u4f5c\u6267\u884c\uff0c\u5b89\u88c5 Rust \u53c2\u89c1<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/course.rs\/first-try\/installation.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">\u8fd9\u91cc<\/a>\u3002<\/p>\n<p data-pid=\"SQet1bYT\">\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u63a5\u4e0b\u6765\u4f7f\u7528\u00a0<code>Cargo<\/code>\u00a0\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/course.rs\/basic\/crate-module\/crate.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">\u4e8c\u8fdb\u5236\u9879\u76ee<\/a>\uff0c\u4e8c\u8fdb\u5236\u610f\u5473\u7740\u8be5\u9879\u76ee\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u670d\u52a1\u8fd0\u884c\u6216\u88ab\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\u8fd0\u884c\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-rust\"><span class=\"cp\">$<\/span> <span class=\"n\">cargo<\/span> <span class=\"n\">new<\/span> <span class=\"n\">hello_world<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p data-pid=\"G9MjyIOA\">\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u00a0<code>cargo new<\/code>\u00a0\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9879\u76ee \uff0c\u4e8b\u5b9e\u4e0a\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e\u00a0<code>cargo new hello_world --bin<\/code>\uff0c<code>bin<\/code>\u00a0\u662f\u00a0<code>binary<\/code>\u00a0\u7684\u7b80\u5199\uff0c\u4ee3\u8868\u7740\u4e8c\u8fdb\u5236\u7a0b\u5e8f\uff0c\u7531\u4e8e\u00a0<code>--bin<\/code>\u00a0\u662f\u9ed8\u8ba4\u53c2\u6570\uff0c\u56e0\u6b64\u53ef\u4ee5\u5bf9\u5176\u8fdb\u884c\u7701\u7565\u3002<\/p>\n<p data-pid=\"9QUNmorA\">\u521b\u5efa\u6210\u529f\u540e\uff0c\u5148\u6765\u770b\u770b\u9879\u76ee\u7684\u57fa\u672c\u76ee\u5f55\u7ed3\u6784\u957f\u5565\u6837\uff1a<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">$ cd hello_world\r\n$ tree .\r\n.\r\n\u251c\u2500\u2500 Cargo.toml\r\n\u2514\u2500\u2500 src\r\n    \u2514\u2500\u2500 main.rs\r\n\r\n1 directory, 2 files<\/code><\/pre>\n<\/div>\n<p data-pid=\"ylEF9lpm\">\u8fd9\u91cc\u6709\u4e00\u4e2a\u5f88\u663e\u773c\u7684\u6587\u4ef6\u00a0<code>Cargo.toml<\/code>\uff0c\u4e00\u770b\u5c31\u77e5\u9053\u5b83\u662f\u00a0<code>Cargo<\/code>\u00a0\u4f7f\u7528\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u4e2a\u5173\u7cfb\u7c7b\u4f3c\u4e8e\uff1a\u00a0<code>package.json<\/code>\u00a0\u662f\u00a0<code>npm<\/code>\u00a0\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">[package]\r\nname = \"hello_world\"\r\nversion = \"0.1.0\"\r\nedition = \"2021\"\r\n\r\n[dependencies]<\/code><\/pre>\n<\/div>\n<p data-pid=\"Jp078mpl\">\u4ee5\u4e0a\u5c31\u662f\u00a0<code>Cargo.toml<\/code>\u00a0\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5b83\u88ab\u79f0\u4e4b\u4e3a\u6e05\u5355( manifest )\uff0c\u5305\u542b\u4e86\u00a0<code>Cargo<\/code>\u00a0\u7f16\u8bd1\u7a0b\u5e8f\u6240\u9700\u7684\u6240\u6709\u5143\u6570\u636e\u3002<\/p>\n<p data-pid=\"ohqd50Jb\">\u4e0b\u9762\u662f\u00a0<code>src\/main.rs<\/code>\u00a0\u7684\u5185\u5bb9 \uff1a<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-rust\"><span class=\"k\">fn<\/span> <span class=\"nf\">main<\/span><span class=\"p\">()<\/span> <span class=\"p\">{<\/span>\r\n    <span class=\"n\">println<\/span><span class=\"o\">!<\/span><span class=\"p\">(<\/span><span class=\"s\">\"Hello, world!\"<\/span><span class=\"p\">);<\/span>\r\n<span class=\"p\">}<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p data-pid=\"lxPuPyxu\">\u53ef\u4ee5\u770b\u51fa\u00a0<code>Cargo<\/code>\u00a0\u8fd8\u4e3a\u6211\u4eec\u81ea\u52a8\u751f\u6210\u4e86\u4e00\u4e2a\u00a0<code>hello world<\/code>\u00a0\u7a0b\u5e8f\uff0c\u6216\u8005\u8bf4<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/course.rs\/basic\/crate-module\/crate.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">\u4e8c\u8fdb\u5236\u5305<\/a>\uff0c\u5bf9\u7a0b\u5e8f\u8fdb\u884c\u7f16\u8bd1\u6784\u5efa\uff1a<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">$ cargo build\r\n   Compiling hello_world v0.1.0 (file:\/\/\/path\/to\/package\/hello_world)<\/code><\/pre>\n<\/div>\n<p data-pid=\"deoWivB-\">\u7136\u540e\u518d\u8fd0\u884c\u7f16\u8bd1\u51fa\u7684\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6:<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">$ .\/target\/debug\/hello_world\r\nHello, world!<\/code><\/pre>\n<\/div>\n<p data-pid=\"jtu-Mn58\">\u6ce8\u610f\u5230\u8def\u5f84\u4e2d\u7684\u00a0<code>debug<\/code>\u00a0\u4e86\u5417\uff1f\u5b83\u8bf4\u660e\u6211\u4eec\u521a\u624d\u7684\u7f16\u8bd1\u662f\u00a0<code>Debug<\/code>\u00a0\u6a21\u5f0f\uff0c\u8be5\u6a21\u5f0f\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u5982\u679c\u60f3\u8981\u8fdb\u884c\u751f\u4ea7\u7f16\u8bd1\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u00a0<code>Release<\/code>\u00a0\u6a21\u5f0f\u00a0<code>cargo build --release<\/code>\uff0c\u7136\u540e\u901a\u8fc7\u00a0<code>.\/target\/release\/hello_world<\/code>\u00a0\u8fd0\u884c\u3002<\/p>\n<p data-pid=\"UoaXXRhi\">\u9664\u4e86\u4e0a\u9762\u7684\u7f16\u8bd1 + \u8fd0\u884c\u65b9\u5f0f\u5916\uff0c\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u76f4\u63a5\u8fd0\u884c:<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">$ cargo run\r\n     Fresh hello_world v0.1.0 (file:\/\/\/path\/to\/package\/hello_world)\r\n   Running `target\/hello_world`\r\nHello, world!<\/code><\/pre>\n<\/div>\n<p data-pid=\"y5ejPBCS\"><code>cargo run<\/code>\u00a0\u4f1a\u5e2e\u6211\u4eec\u81ea\u52a8\u5b8c\u6210\u7f16\u8bd1\u3001\u8fd0\u884c\u7684\u8fc7\u7a0b\uff0c\u5f53\u7136\uff0c\u8be5\u547d\u4ee4\u4e5f\u652f\u6301\u00a0<code>Release<\/code>\u00a0\u6a21\u5f0f:\u00a0<code>cargo run --release<\/code>\u3002<\/p>\n<blockquote data-pid=\"eABmFqTb\"><p>\u5982\u679c\u4f60\u7684\u7a0b\u5e8f\u5728\u8dd1\u6027\u80fd\u6d4b\u8bd5 benchmark\uff0c\u4e00\u5b9a\u8981\u4f7f\u7528\u00a0<code>Relase<\/code>\u00a0\u6a21\u5f0f\uff0c\u56e0\u4e3a\u8be5\u6a21\u5f0f\u4e0b\uff0c\u7a0b\u5e8f\u4f1a\u505a\u5927\u91cf\u6027\u80fd\u4f18\u5316<\/p><\/blockquote>\n<h2 id=\"h_470251959_1\" data-into-catalog-status=\"\">\u4e3a\u4f55\u4f1a\u6709Cargo<\/h2>\n<p data-pid=\"81ECs2Yn\">\u6839\u636e\u4e4b\u524d\u5b66\u4e60\u7684\u77e5\u8bc6\uff0cRust \u6709\u4e24\u79cd\u7c7b\u578b\u7684\u5305: \u5e93\u5305\u548c\u4e8c\u8fdb\u5236\u5305\uff0c\u524d\u8005\u662f\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u7684\u4f9d\u8d56\u5305\uff0c\u7528\u4e8e\u88ab\u5176\u5b83\u5305\u6240\u5f15\u5165\uff0c\u800c\u540e\u8005\u662f\u4e00\u4e2a\u5e94\u7528\u670d\u52a1\uff0c\u53ef\u4ee5\u7f16\u8bd1\u6210\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\u8fdb\u884c\u8fd0\u884c\u3002<\/p>\n<p data-pid=\"5vwuuJ0X\">\u5305\u662f\u901a\u8fc7 Rust \u7f16\u8bd1\u5668\u00a0<code>rustc<\/code>\u00a0\u8fdb\u884c\u7f16\u8bd1\u7684:<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-rust\"><span class=\"cp\">$<\/span> <span class=\"n\">rustc<\/span> <span class=\"n\">hello<\/span><span class=\"p\">.<\/span><span class=\"n\">rs<\/span>\r\n<span class=\"cp\">$<\/span> <span class=\"p\">.<\/span><span class=\"o\">\/<\/span><span class=\"n\">hello<\/span>\r\n<span class=\"n\">Hello<\/span><span class=\"p\">,<\/span> <span class=\"n\">world<\/span><span class=\"o\">!<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p data-pid=\"E-s6rC5h\">\u4e0a\u9762\u6211\u4eec\u76f4\u63a5\u4f7f\u7528\u00a0<code>rustc<\/code>\u00a0\u5bf9\u4e8c\u8fdb\u5236\u5305\u00a0<code>hello.rs<\/code>\u00a0\u8fdb\u884c\u7f16\u8bd1\uff0c\u751f\u6210\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\u00a0<code>hello<\/code>\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u8fd0\u884c\u3002<\/p>\n<p data-pid=\"Dm5xPQYB\">\u8be5\u65b9\u5f0f\u867d\u7136\u7b80\u5355\uff0c\u4f46\u6709\u51e0\u4e2a\u95ee\u9898\uff1a<\/p>\n<ul>\n<li data-pid=\"xFEyB9-L\">\u5fc5\u987b\u8981\u6307\u5b9a\u6587\u4ef6\u540d\u7f16\u8bd1\uff0c\u5f53\u9879\u76ee\u590d\u6742\u540e\uff0c\u8fd9\u79cd\u7f16\u8bd1\u65b9\u5f0f\u4e5f\u968f\u4e4b\u66f4\u52a0\u590d\u6742<\/li>\n<li data-pid=\"yT1inCQm\">\u5982\u679c\u8981\u6307\u5b9a\u7f16\u8bd1\u53c2\u6570\uff0c\u60c5\u51b5\u5c06\u66f4\u52a0\u590d\u6742<\/li>\n<\/ul>\n<p data-pid=\"BjXW31cg\">\u6700\u5173\u952e\u7684\u662f\uff0c\u5916\u90e8\u4f9d\u8d56\u5e93\u7684\u5f15\u5165\u4e5f\u5c06\u662f\u4e00\u4e2a\u5927\u95ee\u9898\u3002\u5927\u90e8\u5206\u5b9e\u9645\u7684\u9879\u76ee\u90fd\u6709\u4e0d\u5c11\u4f9d\u8d56\u5305\uff0c\u800c\u8fd9\u4e9b\u4f9d\u8d56\u5305\u53c8\u95f4\u63a5\u7684\u4f9d\u8d56\u4e86\u65b0\u7684\u4f9d\u8d56\u5305\uff0c\u5728\u8fd9\u79cd\u590d\u6742\u60c5\u51b5\u4e0b\uff0c\u5982\u4f55\u7ba1\u7406\u4f9d\u8d56\u5305\u53ca\u5176\u7248\u672c\u4e5f\u6210\u4e3a\u4e00\u4e2a\u76f8\u5f53\u68d8\u624b\u7684\u95ee\u9898\u3002<\/p>\n<p data-pid=\"LqjGVJLw\">\u6b63\u662f\u56e0\u4e3a\u8fd9\u4e9b\u539f\u56e0\uff0c\u4e0e\u5176\u4f7f\u7528\u00a0<code>rustc<\/code>\u00a0\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u5f3a\u5927\u7684\u5305\u7ba1\u7406\u5de5\u5177\u6765\u89e3\u51b3\u95ee\u9898\uff1a\u6b22\u8fce\u00a0<code>Cargo<\/code>\u00a0\u95ea\u4eae\u767b\u573a\u3002<\/p>\n<h3 id=\"h_470251959_2\" data-into-catalog-status=\"\">Cargo\u89e3\u51b3\u7684\u95ee\u9898<\/h3>\n<p data-pid=\"jPKIymO0\"><code>Cargo<\/code>\u00a0\u89e3\u51b3\u4e86\u4e4b\u524d\u63cf\u8ff0\u7684\u6240\u6709\u95ee\u9898\uff0c\u540c\u65f6\u5b83\u4fdd\u8bc1\u4e86\u6bcf\u6b21\u91cd\u590d\u7684\u6784\u5efa\u90fd\u4e0d\u4f1a\u6539\u53d8\u4e0a\u4e00\u6b21\u6784\u5efa\u7684\u7ed3\u679c\uff0c\u8fd9\u80cc\u540e\u662f\u901a\u8fc7\u5b8c\u5584\u4e14\u5f3a\u5927\u7684\u4f9d\u8d56\u5305\u7248\u672c\u7ba1\u7406\u6765\u5b9e\u73b0\u7684\u3002<\/p>\n<p data-pid=\"MxRSq0B2\">\u603b\u4e4b\uff0c<code>Cargo<\/code>\u00a0\u4e3a\u4e86\u5b9e\u73b0\u76ee\u6807\uff0c\u505a\u4e86\u56db\u4ef6\u4e8b\uff1a<\/p>\n<ul>\n<li data-pid=\"eOU6KXm7\">\u5f15\u5165\u4e24\u4e2a\u5143\u6570\u636e\u6587\u4ef6\uff0c\u5305\u542b\u9879\u76ee\u7684\u65b9\u65b9\u9762\u9762\u4fe1\u606f:\u00a0<code>Cargo.toml<\/code>\u00a0\u548c\u00a0<code>Cargo.lock<\/code><\/li>\n<li data-pid=\"atdzd6LM\">\u83b7\u53d6\u548c\u6784\u5efa\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u4f8b\u5982\u00a0<code>Cargo.toml<\/code>\u00a0\u4e2d\u7684\u4f9d\u8d56\u5305\u7248\u672c\u63cf\u8ff0\uff0c\u4ee5\u53ca\u4ece\u00a0<code>crates.io<\/code>\u00a0\u4e0b\u8f7d\u5305<\/li>\n<li data-pid=\"_qjCGplY\">\u8c03\u7528\u00a0<code>rustc<\/code>\u00a0(\u6216\u5176\u5b83\u7f16\u8bd1\u5668) \u5e76\u4f7f\u7528\u7684\u6b63\u786e\u7684\u53c2\u6570\u6765\u6784\u5efa\u9879\u76ee\uff0c\u4f8b\u5982\u00a0<code>cargo build<\/code><\/li>\n<li data-pid=\"KKWaBy-Z\">\u5f15\u5165\u4e00\u4e9b\u60ef\u4f8b\uff0c\u8ba9\u9879\u76ee\u7684\u4f7f\u7528\u66f4\u52a0\u7b80\u5355<\/li>\n<\/ul>\n<p data-pid=\"bgw3aVYs\">\u6beb\u4e0d\u5938\u5f20\u7684\u8bf4\uff0c\u5f97\u76ca\u4e8e\u00a0<code>Cargo<\/code>\u00a0\u7684\u6807\u51c6\u5316\uff0c\u53ea\u8981\u4f60\u4f7f\u7528\u5b83\u6784\u5efa\u8fc7\u4e00\u4e2a\u9879\u76ee\uff0c\u90a3\u6784\u5efa\u5176\u5b83\u4f7f\u7528\u00a0<code>Cargo<\/code>\u00a0\u7684\u9879\u76ee\uff0c\u4e5f\u5c06\u4e0d\u5b58\u5728\u4efb\u4f55\u56f0\u96be\u3002<\/p>\n<p data-pid=\"hBmZ4zlB\">\u5728\u5feb\u901f\u4e86\u89e3\u00a0<code>Cargo<\/code>\u00a0\u7684\u4f7f\u7528\u65b9\u5f0f\u540e\uff0c\u4e0b\u9762\uff0c\u6211\u4eec\u5c06\u6b63\u5f0f\u8fdb\u5165 Cargo \u7684\u5b66\u4e60\u4e4b\u65c5\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">\u5f31\u5f31\u7684\u8bf4\u4e00\u58f0\uff1a\u82e5\u6587\u7ae0\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u53ef\u5426\u987a\u624b\u4e00\u8d5e\uff0c\u611f\u8c22\u611f\u8c22 :)<\/code><\/pre>\n<\/div>\n<blockquote data-pid=\"0QjUbr2L\"><p>\u672c\u6587\u7531<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/studyrs\/RustTT\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">RustTT<\/a>\u00a0\u7ffb\u8bd1\u5c0f\u7ec4\u7ffb\u8bd1\uff0c\u539f\u6587\u5730\u5740\uff1a<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/doc.rust-lang.org\/stable\/cargo\/index.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Introduction &#8211; The Cargo Book<\/a><\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ContentItem-time\" tabindex=\"0\" role=\"button\">\u7f16\u8f91\u4e8e 2022-03-22 21:25<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 \u00a0 \u5b59\u98de Sunface \u200b <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[24],"tags":[121],"class_list":["post-6428","post","type-post","status-publish","format-standard","hentry","category-value_docs","tag-05-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/6428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=6428"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/6428\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=6428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=6428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=6428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}