{"id":23093,"date":"2025-04-19T06:56:43","date_gmt":"2025-04-18T22:56:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/23093.html"},"modified":"2025-04-19T06:56:43","modified_gmt":"2025-04-18T22:56:43","slug":"rust%e9%85%8d%e7%bd%ae%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/23093.html","title":{"rendered":"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218"},"content":{"rendered":"<p>https:\/\/www.cnblogs.com\/skzxc\/p\/12129353.html<\/p>\n<li>\n<p>\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5\u597dMSVC\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b98\u7f51https:\/\/www.rust-lang.org\/zh-CN\/learn\/get-started\u5b89\u88c5Rust\u5b89\u88c5\u5668&#xff0c;\u9009\u62e9winodwsx64\u7248\u672c<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u884c\u5b89\u88c5&#xff0c;\u5c06\u6587\u4ef6\u5939\u79fb\u52a8\u5230D\u76d8&#xff0c;\u5b89\u88c5\u540e&#xff0c;\u6587\u4ef6\u5939\u5728C:\\\\Users\\\\xxx\u4e0b\u6709.cargo\u548c.rustup\u4e24\u4e2a\u6587\u4ef6\u5939<\/p>\n<\/li>\n<li>\n<p>\u65b0\u5efa\u73af\u5883\u53d8\u91cf<\/p>\n<p> CARGO_HOME<br \/>\nD:\\\\Users\\\\xxx\\\\.cargo<\/p>\n<p>RUSTUP_HOME<br \/>\nD:\\\\Users\\\\xxx\\\\.rustup<\/p>\n<p>path<br \/>\n%CARGO_HOME%\\\\bin\n <\/li>\n<li>\n<p>\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f&#xff0c;\u8f93\u5165\u547d\u4ee4<\/p>\n<p> cargo &#8211;version<br \/>\nrustup &#8211;version\n <\/li>\n<li>\n<p>\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u52a0\u901f\u5b89\u88c5\u5730\u5740<\/p>\n<p> RUSTUP_DIST_SERVER<br \/>\nhttps:\/\/mirrors.tuna.tsinghua.edu.cn\/rustup<br \/>\nRUSTUP_UPDATE_ROOT<br \/>\nhttps:\/\/mirrors.tuna.tsinghua.edu.cn\/rustup\/rustup\n <\/li>\n<li>\n<p>\u914d\u7f6e\u5e93\u955c\u50cf&#xff0c;\u5728C:\\\\Users\\\\xxx\\\\.cargo\u4e0b\u521b\u5efaconfig.toml\u6587\u4ef6&#xff0c;\u65e0\u540e\u7f00&#xff0c;\u590d\u5236\u7c98\u8d34<\/p>\n<p> [source.crates-io]<br \/>\nregistry &#061; &#034;https:\/\/github.com\/rust-lang\/crates.io-index&#034;<br \/>\nreplace-with &#061; &#034;tuna&#034;<br \/>\n[source.tuna]<br \/>\nregistry &#061; &#034;https:\/\/mirrors.tuna.tsinghua.edu.cn\/git\/crates.io-index.git&#034;\n <\/li>\n<li>\n<p>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b89\u88c5VSCode\u63d2\u4ef6<\/p>\n<ul>\n<li>Rust Analyzer<\/li>\n<li>Even Better TOML<\/li>\n<li>CodeLLDB<\/li>\n<\/ul>\n<\/li>\n<h4>\u5f00\u53d1\u793a\u4f8b<\/h4>\n<p>\u4e0b\u9762\u5305\u542b\u7ed9\u51fa\u4e00\u4e2aRust\u670d\u52a1\u5668\u7684\u5f00\u53d1\u793a\u4f8b<\/p>\n<p>\u7ed9\u51fa\u9700\u6c42&#xff1a;<\/p>\n<li>\u63a5\u6536\u4e24\u4e2a\u53ef\u9009\u53c2\u6570&#xff1a;\n<li>html_path&#xff1a;\u9ed8\u8ba4\u4e3aindex.html&#xff0c;\u5e26\u6709\u8def\u5f84\u68c0\u67e5<\/li>\n<li>port&#xff1a;\u9ed8\u8ba4\u4e3a8787<\/li>\n<\/li>\n<li>\u4fdd\u5b58\u53d8\u91cfhtml_path&#xff0c;\u6bcf\u6b21\u6d4f\u89c8\u5668\u7aef\u5237\u65b0\u65f6&#xff0c;\u90fd\u5b9e\u65f6\u8bfb\u53d6html_path\u8fd4\u56de\u7ed9\u670d\u52a1\u5668\u6e32\u67d3\u3002\u8fd9\u662f\u4e3a\u4e86\u65b9\u4fbf\u5f00\u53d1\u548c\u8c03\u8bd5\u3002<\/li>\n<li>\u5f00\u653e\u9759\u6001\u8d44\u6e90\u7ed9\u524d\u7aef\u3002<\/li>\n<li>\u5141\u8bb8\u524d\u7aef\u901a\u8fc7\/write?filepath&#061;xxx&#xff0c;\u4ee5\u53cabody\u7684\u6570\u636e&#xff0c;\u5199\u5165\u5230\u670d\u52a1\u5668\u7aef\u3002<\/li>\n<p>\u5f00\u53d1\u6b65\u9aa4&#xff1a;<\/p>\n<li>\n<p>\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee&#xff0c;\u547d\u4ee4\u884c\u8f93\u5165cargo new myproject<\/p>\n<\/li>\n<li>\n<p>\u6d4b\u8bd5\u73af\u5883\u914d\u7f6e&#xff0c;\u7f16\u8bd1cargo build<\/p>\n<\/li>\n<li>\n<p>\u6d4b\u8bd5\u73af\u5883\u914d\u7f6e&#xff0c;\u8fd0\u884ccargo run<\/p>\n<\/li>\n<li>\n<p>cargo.toml\u4e2d&#xff0c;\u590d\u5236\u7c98\u8d34<\/p>\n<p> [package]<br \/>\nname &#061; &#034;mini_server&#034;<br \/>\nversion &#061; &#034;0.1.0&#034;<br \/>\nedition &#061; &#034;2024&#034;<\/p>\n<p>[dependencies]<br \/>\nhyper &#061; { version &#061; &#034;0.14&#034;, features &#061; [&#039;full&#039;]}<br \/>\ntokio &#061; { version &#061; &#034;1&#034;, features &#061; [&#034;full&#034;] }<br \/>\nurl &#061; &#039;2.3&#039;<br \/>\nmime_guess &#061; &#034;2.0&#034;\n <\/li>\n<li>\n<p>src\/main.rs\u4e2d&#xff0c;\u590d\u5236\u7c98\u8d34<\/p>\n<p> use hyper::service::{make_service_fn, service_fn};<br \/>\nuse hyper::{Body, Method, Request, Response, Server, StatusCode};<br \/>\nuse std::fs;<br \/>\nuse std::net::SocketAddr;<br \/>\nuse std::path::Path;<br \/>\nuse std::sync::Arc;<br \/>\nuse tokio::signal;<br \/>\nuse hyper::body::to_bytes;<br \/>\nuse url::form_urlencoded;<br \/>\nuse mime_guess::from_path;<\/p>\n<p>#[tokio::main]<br \/>\nasync fn main() {<br \/>\n    \/\/ \u4ece\u547d\u4ee4\u884c\u53c2\u6570\u83b7\u53d6HTML\u6587\u4ef6\u8def\u5f84\u548c\u7aef\u53e3\u53f7<br \/>\n    let args: Vec&lt;String&gt; &#061; std::env::args().collect();<br \/>\n    let html_file_path &#061; args.get(1).map(|s| s.as_str()).unwrap_or(&#034;index.html&#034;);<br \/>\n    let port &#061; args.get(2).and_then(|s| s.parse::&lt;u16&gt;().ok()).unwrap_or(8787);<\/p>\n<p>    \/\/ \u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728<br \/>\n    if !Path::new(html_file_path).exists() {<br \/>\n        eprintln!(&#034;File not found: {}&#034;, html_file_path);<br \/>\n        return;<br \/>\n    }<\/p>\n<p>    \/\/ \u5c06HTML\u6587\u4ef6\u8def\u5f84\u5b58\u50a8\u5728Arc\u4e2d\u4ee5\u4fbf\u5728\u591a\u4e2a\u8bf7\u6c42\u4e4b\u95f4\u5171\u4eab<br \/>\n    let html_file_path &#061; Arc::new(html_file_path.to_string());<\/p>\n<p>    \/\/ \u5b9a\u4e49\u670d\u52a1\u5904\u7406\u51fd\u6570<br \/>\n    let make_svc &#061; make_service_fn(move |_conn| {<br \/>\n        let html_file_path &#061; Arc::clone(&amp;html_file_path);<br \/>\n        async move {<br \/>\n            Ok::&lt;_, hyper::Error&gt;(service_fn(move |req| {<br \/>\n                let html_file_path &#061; Arc::clone(&amp;html_file_path);<br \/>\n                async move {<br \/>\n                    handle_request(req, html_file_path).await<br \/>\n                }<br \/>\n            }))<br \/>\n        }<br \/>\n    });<\/p>\n<p>    \/\/ \u5b9a\u4e49\u670d\u52a1\u5668\u5730\u5740<br \/>\n    let addr &#061; SocketAddr::from(([127, 0, 0, 1], port));<\/p>\n<p>    \/\/ \u542f\u52a8\u670d\u52a1\u5668<br \/>\n    let server &#061; Server::bind(&amp;addr).serve(make_svc);<\/p>\n<p>    \/\/ \u5904\u7406\u670d\u52a1\u5668\u5173\u95ed\u4fe1\u53f7<br \/>\n    let graceful &#061; server.with_graceful_shutdown(shutdown_signal());<\/p>\n<p>    println!(&#034;Server running at http:\/\/{}&#034;, addr);<\/p>\n<p>    \/\/ \u8fd0\u884c\u670d\u52a1\u5668<br \/>\n    if let Err(e) &#061; graceful.await {<br \/>\n        eprintln!(&#034;Server error: {}&#034;, e);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u5904\u7406HTTP\u8bf7\u6c42<br \/>\nasync fn handle_request(<br \/>\n    req: Request&lt;Body&gt;,<br \/>\n    html_file_path: Arc&lt;String&gt;,<br \/>\n) -&gt; Result&lt;Response&lt;Body&gt;, hyper::Error&gt; {<br \/>\n    match (req.method(), req.uri().path()) {<br \/>\n        \/\/ \u8fd4\u56deHTML\u5185\u5bb9<br \/>\n        (&amp;Method::GET, &#034;\/&#034;) &#061;&gt; {<br \/>\n            match read_file_to_string(&amp;html_file_path) {<br \/>\n                Ok(content) &#061;&gt; Ok(Response::new(Body::from(content))),<br \/>\n                Err(e) &#061;&gt; {<br \/>\n                    let response &#061; Response::builder()<br \/>\n                        .status(StatusCode::INTERNAL_SERVER_ERROR)<br \/>\n                        .body(Body::from(format!(&#034;Failed to read HTML file: {}&#034;, e)))<br \/>\n                        .unwrap(); \/\/ This unwrap is safe because we know the builder is correctly configured<br \/>\n                    Ok(response)<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        \/\/ \u5904\u7406\u6587\u4ef6\u5199\u5165\u8bf7\u6c42<br \/>\n        (&amp;Method::POST, &#034;\/write&#034;) &#061;&gt; {<br \/>\n            \/\/ \u89e3\u6790\u67e5\u8be2\u53c2\u6570<br \/>\n            let query &#061; req.uri().query().unwrap_or_default();<br \/>\n            let params: Vec&lt;(String, String)&gt; &#061; form_urlencoded::parse(query.as_bytes())<br \/>\n                .into_owned()<br \/>\n                .collect();<\/p>\n<p>            \/\/ \u83b7\u53d6\u6587\u4ef6\u8def\u5f84\u53c2\u6570<br \/>\n            let file_path &#061; params<br \/>\n                .iter()<br \/>\n                .find(|(key, _)| key &#061;&#061; &#034;filepath&#034;)<br \/>\n                .map(|(_, value)| value.to_string())<br \/>\n                .unwrap_or_else(|| &#034;example.txt&#034;.to_string());<\/p>\n<p>            \/\/ \u8bfb\u53d6\u8bf7\u6c42\u4f53\u5185\u5bb9<br \/>\n            let body_bytes &#061; to_bytes(req.into_body()).await?;<br \/>\n            let body_content &#061; String::from_utf8(body_bytes.to_vec()).unwrap_or_default();<\/p>\n<p>            \/\/ \u5199\u5165\u6587\u4ef6<br \/>\n            match write_string_to_file(&amp;file_path, &amp;body_content) {<br \/>\n                Ok(_) &#061;&gt; Ok(Response::new(Body::from(&#034;File written successfully&#034;))),<br \/>\n                Err(e) &#061;&gt; {<br \/>\n                    let response &#061; Response::builder()<br \/>\n                        .status(StatusCode::INTERNAL_SERVER_ERROR)<br \/>\n                        .body(Body::from(format!(&#034;Failed to write file: {}&#034;, e)))<br \/>\n                        .unwrap(); \/\/ This unwrap is safe because we know the builder is correctly configured<br \/>\n                    Ok(response)<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        (&amp;Method::GET, path) &#061;&gt; {<br \/>\n            \/\/ \u6784\u5efa\u6587\u4ef6\u8def\u5f84<br \/>\n            let file_path &#061; format!(&#034;.{}&#034;, path);<br \/>\n            match read_file_to_bytes(&amp;file_path) {<br \/>\n                Ok(content) &#061;&gt; {<br \/>\n                    \/\/ \u6839\u636e\u6587\u4ef6\u6269\u5c55\u540d\u731c\u6d4bMIME\u7c7b\u578b<br \/>\n                    let mime_type &#061; from_path(&amp;file_path).first_or_octet_stream();<br \/>\n                    let response &#061; Response::builder()<br \/>\n                        .header(&#034;Content-Type&#034;, mime_type.as_ref())<br \/>\n                        .body(Body::from(content))<br \/>\n                        .unwrap(); \/\/ This unwrap is safe because we know the builder is correctly configured<br \/>\n                    Ok(response)<br \/>\n                }<br \/>\n                Err(_) &#061;&gt; {<br \/>\n                    \/\/ \u6587\u4ef6\u4e0d\u5b58\u5728&#xff0c;\u8fd4\u56de404 Not Found<br \/>\n                    let response &#061; Response::builder()<br \/>\n                        .status(StatusCode::NOT_FOUND)<br \/>\n                        .body(Body::from(&#034;Not Found&#034;))<br \/>\n                        .unwrap(); \/\/ This unwrap is safe because we know the builder is correctly configured<br \/>\n                    Ok(response)<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        \/\/ \u8fd4\u56de404 Not Found<br \/>\n        _ &#061;&gt; {<br \/>\n            let response &#061; Response::builder()<br \/>\n                .status(StatusCode::NOT_FOUND)<br \/>\n                .body(Body::from(&#034;Not Found&#034;))<br \/>\n                .unwrap(); \/\/ This unwrap is safe because we know the builder is correctly configured<br \/>\n            Ok(response)<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u5904\u7406\u670d\u52a1\u5668\u5173\u95ed\u4fe1\u53f7<br \/>\nasync fn shutdown_signal() {<br \/>\n    \/\/ \u7b49\u5f85Ctrl&#043;C\u4fe1\u53f7<br \/>\n    signal::ctrl_c()<br \/>\n        .await<br \/>\n        .expect(&#034;Failed to install CTRL&#043;C signal handler&#034;);<br \/>\n    println!(&#034;Shutting down server&#8230;&#034;);<br \/>\n}<\/p>\n<p>\/\/ \u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u4e3a\u5b57\u7b26\u4e32<br \/>\nfn read_file_to_string(file_path: &amp;str) -&gt; Result&lt;String, std::io::Error&gt; {<br \/>\n    fs::read_to_string(file_path)<br \/>\n}<\/p>\n<p>\/\/ \u5c06\u5b57\u7b26\u4e32\u5199\u5165\u6587\u4ef6<br \/>\nfn write_string_to_file(file_path: &amp;str, content: &amp;str) -&gt; Result&lt;(), std::io::Error&gt; {<br \/>\n    fs::write(file_path, content)<br \/>\n}<\/p>\n<p>\/\/ \u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u4e3a\u5b57\u8282\u6570\u7ec4<br \/>\nfn read_file_to_bytes(file_path: &amp;str) -&gt; Result&lt;Vec&lt;u8&gt;, std::io::Error&gt; {<br \/>\n    fs::read(file_path)<br \/>\n}\n <\/li>\n<li>\n<p>cargo build\u3002\u8ba9\u5927\u6a21\u578b\u751f\u6210\u4e00\u4e2aindex.html\u6587\u4ef6&#xff0c;\u4e0e\u751f\u6210\u7684exe\u653e\u8fdb\u6587\u4ef6\u5939&#xff0c;\u70b9\u51fb\u8fd0\u884c\u5373\u53ef\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5\u597d\u3002\u5b98\u7f51\u5b89\u88c5Rust\u5b89\u88c5\u5668\uff0c\u9009\u62e9winodwsx64\u7248\u672c\u8fd0\u884c\u5b89\u88c5\uff0c\u5c06\u6587\u4ef6\u5939\u79fb\u52a8\u5230D\u76d8\uff0c\u5b89\u88c5\u540e\uff0c\u6587\u4ef6\u5939\u5728\u4e0b\u6709.cargo\u548c.rustup\u4e24\u4e2a\u6587\u4ef6\u5939\u65b0\u5efa\u73af\u5883\u53d8\u91cf\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f\uff0c\u8f93\u5165\u547d\u4ee4\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u52a0\u901f\u5b89\u88c5\u5730\u5740\u914d\u7f6e\u5e93\u955c\u50cf\uff0c\u5728\u4e0b\u521b\u5efa\u6587\u4ef6\uff0c\u65e0\u540e\u7f00\uff0c\u590d\u5236\u7c98\u8d34\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5VSCode\u63d2\u4ef6\u3002_rust\u670d\u52a1\u5668<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[206],"topic":[],"class_list":["post-23093","post","type-post","status-publish","format-standard","hentry","category-server","tag-rust"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/23093.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5\u597d\u3002\u5b98\u7f51\u5b89\u88c5Rust\u5b89\u88c5\u5668\uff0c\u9009\u62e9winodwsx64\u7248\u672c\u8fd0\u884c\u5b89\u88c5\uff0c\u5c06\u6587\u4ef6\u5939\u79fb\u52a8\u5230D\u76d8\uff0c\u5b89\u88c5\u540e\uff0c\u6587\u4ef6\u5939\u5728\u4e0b\u6709.cargo\u548c.rustup\u4e24\u4e2a\u6587\u4ef6\u5939\u65b0\u5efa\u73af\u5883\u53d8\u91cf\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f\uff0c\u8f93\u5165\u547d\u4ee4\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u52a0\u901f\u5b89\u88c5\u5730\u5740\u914d\u7f6e\u5e93\u955c\u50cf\uff0c\u5728\u4e0b\u521b\u5efa\u6587\u4ef6\uff0c\u65e0\u540e\u7f00\uff0c\u590d\u5236\u7c98\u8d34\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5VSCode\u63d2\u4ef6\u3002_rust\u670d\u52a1\u5668\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/23093.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T22:56:43+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23093.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/23093.html\",\"name\":\"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T22:56:43+00:00\",\"dateModified\":\"2025-04-18T22:56:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/23093.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/23093.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23093.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/23093.html","og_locale":"zh_CN","og_type":"article","og_title":"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5\u597d\u3002\u5b98\u7f51\u5b89\u88c5Rust\u5b89\u88c5\u5668\uff0c\u9009\u62e9winodwsx64\u7248\u672c\u8fd0\u884c\u5b89\u88c5\uff0c\u5c06\u6587\u4ef6\u5939\u79fb\u52a8\u5230D\u76d8\uff0c\u5b89\u88c5\u540e\uff0c\u6587\u4ef6\u5939\u5728\u4e0b\u6709.cargo\u548c.rustup\u4e24\u4e2a\u6587\u4ef6\u5939\u65b0\u5efa\u73af\u5883\u53d8\u91cf\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f\uff0c\u8f93\u5165\u547d\u4ee4\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u52a0\u901f\u5b89\u88c5\u5730\u5740\u914d\u7f6e\u5e93\u955c\u50cf\uff0c\u5728\u4e0b\u521b\u5efa\u6587\u4ef6\uff0c\u65e0\u540e\u7f00\uff0c\u590d\u5236\u7c98\u8d34\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5VSCode\u63d2\u4ef6\u3002_rust\u670d\u52a1\u5668","og_url":"https:\/\/www.wsisp.com\/helps\/23093.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T22:56:43+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/23093.html","url":"https:\/\/www.wsisp.com\/helps\/23093.html","name":"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T22:56:43+00:00","dateModified":"2025-04-18T22:56:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/23093.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/23093.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/23093.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Rust\u914d\u7f6e\u5f00\u53d1\u73af\u5883+\u670d\u52a1\u5668\u5b9e\u6218"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=23093"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23093\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=23093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=23093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=23093"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=23093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}