{"id":365911,"date":"2024-05-21T02:48:11","date_gmt":"2024-05-21T02:48:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=365911"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=365911","title":{"rendered":"<span>\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u043f\u043e Rust. 2\/2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fj\/yi\/qn\/fjyiqnduv3l-rdgxnbu_t_qpgxk.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fj\/yi\/qn\/fjyiqnduv3l-rdgxnbu_t_qpgxk.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>Hello world!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438 \u043f\u043e <a href=\"https:\/\/www.rust-lang.org\/ru\/\">Rust<\/a>.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/785096\/\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/my-js.org\/docs\/cheatsheet\/rust\/\">\u0414\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u044e\u0442 \u043b\u044e\u0431\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u043d\u0435 \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0442\u044c ?<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/doc.rust-lang.ru\/book\/\">\u0423\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u043e Rust<\/a> (\u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435).<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h4 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<ul>\n<li><a href=\"#%D0%BE%D1%80%D0%B3%D0%B0%D0%BD%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F-%D0%BA%D0%BE%D0%B4%D0%B0\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430<\/a><br \/> \n<ul>\n<li><a href=\"#%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B8\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8-modules\">\u041c\u043e\u0434\u0443\u043b\u0438 (modules)<\/a><\/li>\n<li><a href=\"#%D0%BA%D1%80%D0%B5%D0%B9%D1%82%D1%8B-crates\">\u041a\u0440\u0435\u0439\u0442\u044b (crates)<\/a><\/li>\n<li><a href=\"#%D1%80%D0%B0%D0%B1%D0%BE%D1%87%D0%B8%D0%B5-%D0%BF%D1%80%D0%BE%D1%81%D1%82%D1%80%D0%B0%D0%BD%D1%81%D1%82%D0%B2%D0%B0-workspaces\">\u0420\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (workspaces)<\/a><\/li>\n<li><a href=\"#use\">Use<\/a><\/li>\n<li><a href=\"#std-%D0%BF%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2%D1%8B-%D0%B8-%D0%BF%D1%80%D0%B5%D0%BB%D1%8E%D0%B4%D0%B8%D0%B8\">Std, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0438 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#%D0%BE%D0%B1%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B0-%D0%BE%D1%88%D0%B8%D0%B1%D0%BE%D0%BA\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/a><br \/> \n<ul>\n<li><a href=\"#%D1%83%D0%BC%D0%BD%D1%8B%D0%B9-%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%82%D0%BE%D1%80\">\u0423\u043c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/a><\/li>\n<li><a href=\"#%D0%BF%D0%B0%D0%BD%D0%B8%D0%BA%D0%B0\">\u041f\u0430\u043d\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#option-%D0%B8-result\">Option \u0438 Result<\/a><\/li>\n<li><a href=\"#unwrap-%D0%B8-expect\">unwrap() \u0438 expect()<\/a><\/li>\n<li><a href=\"#%D1%80%D0%B0%D1%81%D0%BF%D1%80%D0%BE%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5-%D0%BE%D1%88%D0%B8%D0%B1%D0%BA%D0%B8-%D0%B8-none\">\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 None<\/a><\/li>\n<li><a href=\"#%D0%BA%D0%BE%D0%BC%D0%B1%D0%B8%D0%BD%D0%B0%D1%82%D0%BE%D1%80%D1%8B-combinators\">\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b (combinators)<\/a><\/li>\n<li><a href=\"#%D0%BA%D0%B0%D1%81%D1%82%D0%BE%D0%BC%D0%BD%D1%8B%D0%B5-%D1%82%D0%B8%D0%BF%D1%8B-%D0%BE%D1%88%D0%B8%D0%B1%D0%BA%D0%B8\">\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0448\u0438\u0431\u043a\u0438<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"organizaciya-koda\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430<\/h1>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. <code>Rust<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438.<\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u0438 (modules)<br \/> \n<ul>\n<li>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/li>\n<li>\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a \u0444\u0430\u0439\u043b\u0443<\/li>\n<li>\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439<\/li>\n<\/ul>\n<\/li>\n<li>\u041a\u0440\u0435\u0439\u0442\u044b (crates)<br \/> \n<ul>\n<li>\u0444\u0430\u0439\u043b <code>lib.rs<\/code> \u0432 \u0442\u043e\u043c \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u043c \u043a\u0440\u0435\u0439\u0442\u0435<\/li>\n<li>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u043a\u0440\u0435\u0439\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>Cargo.toml<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<\/li>\n<li>\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438<\/li>\n<li>\u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <code>Git<\/code><\/li>\n<li>\u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 <code>crates.io<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\u0420\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (workspaces) \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438 \u043a\u0430\u043a \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"funkcii\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {   greet(); \/\/ \u0434\u0435\u043b\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0432\u0435\u0449\u044c   ask_location(); \/\/ \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u0435\u0449\u044c }  fn greet() {   println!(\"Hello!\"); }  fn ask_location() {   println!(\"Where are you from?\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b (unit tests):<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     greet(); }  fn greet() -> String {     \"Hello, world!\".to_string() }  #[test] \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 `test` \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f fn test_greet() {     assert_eq!(\"Hello, world!\", greet()) }  \/\/ \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 `#[cfg(test)]`. \/\/ \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u043e\u0432. \u041c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435.<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/doc.rust-lang.org\/reference\/attributes.html\">\u0410\u0442\u0440\u0438\u0431\u0443\u0442<\/a> \u2014 \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435, \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u043c, \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u044f\u0437\u044b\u043a\u0430 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"moduli-modules\">\u041c\u043e\u0434\u0443\u043b\u0438 (modules)<\/h2>\n<p>  <\/p>\n<h4 id=\"v-tom-zhe-fayle\">\u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435<\/h4>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {    greetings::hello(); }  mod greetings {   \/\/ \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u0435, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c (\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c)   pub fn hello() { \/\/ \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e `pub` \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 (\u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439), \u0442.\u0435. \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u043a\u043e\u0434\u0443     println!(\"Hello, world!\");   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {   phrases::greetings::hello(); }  mod phrases {   pub mod greetings {     pub fn hello() {       println!(\"Hello, world!\");     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u043b\u0438 \u0438\u0437 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0412\u044b\u0437\u043e\u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f fn main() {   phrases::greet(); }  mod phrases {   \/\/ \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f   pub fn greet() {     hello(); \/\/ \u0438\u043b\u0438 `self::hello();`   }    \/\/ \u041f\u0440\u0438\u0432\u0430\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f   fn hello() {     println!(\"Hello, world!\");   } }  \/\/ \u0412\u044b\u0437\u043e\u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f fn main() {   phrases::greetings::hello(); }  mod phrases {   fn private_fn() {     println!(\"Hello, world!\");   }    pub mod greetings {     pub fn hello() {       super::private_fn();     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>self<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>super<\/code> \u2014 \u0434\u043b\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. <code>super<\/code> \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f\/\u043a\u043e\u0440\u043d\u0435\u0432\u044b\u043c (root) \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {   greetings::hello(); }  fn hello() {   println!(\"Hello, world!\"); }  mod greetings {   pub fn hello() {     super::hello();   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <code>tests<\/code> \u2014 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn greet() -> String {     \"Hello, world!\".to_string() }  #[cfg(test)] \/\/ \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 mod tests {     use super::greet; \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e `greet()`      #[test]     fn test_greet() {         assert_eq!(\"Hello, world!\", greet());     } }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"v-drugom-fayle-no-v-toy-zhe-direktorii\">\u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u043d\u043e \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438<\/h4>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod greetings; \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c `greetings`  fn main() {   greetings::hello(); }  \/\/ greetings.rs \/\/ \u041a\u043e\u0434 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0432 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 `mod`, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u0444\u0430\u0439\u043b pub fn hello() { \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u0437\u0432\u043d\u0435   println!(\"Hello, world!\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0431\u0435\u0440\u043d\u0435\u043c \u043a\u043e\u0434 \u0432 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 <code>mod<\/code>, \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod phrases;  fn main() {   phrases::greetings::hello(); }  \/\/ phrases.rs pub mod greetings { \/\/ \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0437\u0432\u043d\u0435   pub fn hello() {     println!(\"Hello, world!\");   } }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"v-drugom-fayle-i-drugoy-direktorii\">\u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438<\/h4>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <code>mod.rs<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 (entrypoint) \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0443\u0431\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 (submodules) \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod greetings;  fn main() {   greetings::hello(); }  \/\/ greetings\/mod.rs pub fn hello() {   println!(\"Hello, world!\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0431\u0435\u0440\u043d\u0435\u043c \u043a\u043e\u0434 \u0432 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 <code>mod<\/code>, \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod phrases;  fn main() {   phrases::greetings::hello(); }  \/\/ phrases\/mod.rs pub mod greetings {   pub fn hello() {     println!(\"Hello, world!\");   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0443\u0431\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 <code>mod.rs<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod phrases;  fn main() {   phrases::hello() }  \/\/ phrases\/mod.rs mod greetings;  pub fn hello() {   greetings::hello() }  \/\/ phrases\/greetings.rs pub fn hello() {   println!(\"Hello, world!\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 <code>phrases\/greetings.rs<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod phrases;  fn main() {     phrases::greetings::hello(); }  \/\/ phrases\/mod.rs pub mod greetings;  \/\/ `pub mod` \u0432\u043c\u0435\u0441\u0442\u043e `mod`  \/\/ phrases\/greetings.rs pub fn hello() {   println!(\"Hello, world!\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 \u0432 <code>main.rs<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>mod phrases::greetings;<\/code> \u0432 <code>main.rs<\/code>. \u041d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>hello()<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c (re-export) \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>phrases\/mod.rs<\/code> \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a <code>phrases::hello()<\/code> \u0432 <code>main.rs<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ phrases\/greetings.rs pub fn hello() {   println!(\"Hello, world!\"); }  \/\/ phrases\/mod.rs pub mod greetings;  pub use self::greetings::hello; \/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 `greetings::hello()`  \/\/ main.rs mod phrases;  fn main() {     phrases::hello(); \/\/ `hello()` \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 `phrases` }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u0434\u0430. \u041c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>use<\/code> \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"kreyty-crates\">\u041a\u0440\u0435\u0439\u0442\u044b (crates)<\/h2>\n<p>  <\/p>\n<p>\u041a\u0440\u0435\u0439\u0442\u044b \u2014 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043f\u0430\u043a\u0435\u0442\u044b (packages) \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u041a\u0440\u0435\u0439\u0442\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0443 \u043a\u0440\u0435\u0439\u0442\u0430 \u0435\u0441\u0442\u044c \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043e\u043d\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043a\u0440\u0435\u0439\u0442\u043e\u043c \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0435\u0439\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c (\u0434\u0432\u043e\u0438\u0447\u043d\u044b\u043c) (binary) \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u043c (library). <code>src\/main.rs<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u0440\u0435\u043d\u044c \u043a\u0440\u0435\u0439\u0442\u0430\/\u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430, <code>src\/lib.rs<\/code> \u2014 \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<h4 id=\"librs-v-binarnom-kreyte\">lib.rs \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u043a\u0440\u0435\u0439\u0442\u0435<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u0444\u0430\u0439\u043b <code>src\/lib.rs<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 <code>src\/main.rs<\/code>. \u042d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b cargo new greetings touch greetings\/src\/lib.rs  \/\/ \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 greetings  \u251c\u2500\u2500 Cargo.toml  \u2514\u2500\u2500 src     \u251c\u2500\u2500 lib.rs     \u2514\u2500\u2500 main.rs  \/\/ greetings\/src\/lib.rs pub fn hello() {     println!(\"Hello, world!\"); }  \/\/ greetings\/src\/main.rs extern crate greetings; \/\/ \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Rust 2018, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e `extern crate` \u0441\u0442\u0430\u043b\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0438 \u043a\u0440\u0435\u0439\u0442\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 Cargo.toml. \/\/ \u0417\u0434\u0435\u0441\u044c \u0432\u043c\u0435\u0441\u0442\u043e `extern crate` \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c `use`  fn main() {     greetings::hello(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ greetings\/src\/lib.rs pub fn hello() -> String {   \/\/! \u042d\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 String `Hello, world!`   (\"Hello, world!\").to_string() }  \/\/ \u0422\u0435\u0441\u0442 \u0434\u043b\u044f `hello()` #[test] \/\/ \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fn test_hello() {   assert_eq!(hello(), \"Hello, world!\"); }  \/\/ \u0422\u0435\u0441\u0442\u044b \u0434\u043b\u044f `hello()`, \u0438\u0434\u0438\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 #[cfg(test)] \/\/ \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 mod tests { \/\/ \u0442\u0435\u0441\u0442\u044b \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u0442 \u043a\u043e\u0434\u0430   use super::hello; \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e `hello()`      #[test]     fn test_hello() {         assert_eq!(hello(), \"Hello, world!\");     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 <code>lib.rs<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b cargo new phrases touch phrases\/src\/lib.rs touch phrases\/src\/greetings.rs  \/\/ \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 phrases  \u251c\u2500\u2500 Cargo.toml  \u2514\u2500\u2500 src     \u251c\u2500\u2500 greetings.rs     \u251c\u2500\u2500 lib.rs     \u2514\u2500\u2500 main.rs  \/\/ phrases\/src\/greetings.rs pub fn hello() {     println!(\"Hello, world!\"); }  \/\/ phrases\/src\/lib.rs pub mod greetings; \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c `greetings` \u043a\u0430\u043a \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439  \/\/ phrases\/src\/main.rs use phrases;  fn main() {     phrases::greetings::hello(); }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"zavisimyy-kreyt-v-cargotoml\">\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 \u0432 Cargo.toml<\/h4>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>lib.rs<\/code> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430. \u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u043d\u0435\u0435, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438, \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <code>Git<\/code> \u0438\u043b\u0438 <code>crates.io<\/code>.<\/p>\n<p>  <\/p>\n<p><em>\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b cargo new phrases cargo new phrases\/greetings --lib  \/\/ \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 phrases  \u251c\u2500\u2500 Cargo.toml  \u251c\u2500\u2500 greetings  \u2502  \u251c\u2500\u2500 Cargo.toml  \u2502  \u2514\u2500\u2500 src  \u2502     \u2514\u2500\u2500 lib.rs  \u2514\u2500\u2500 src     \u2514\u2500\u2500 main.rs  \/\/ phrases\/Cargo.toml [package] name = \"phrases\" version = \"0.1.0\" authors = [\"Dumindu Madunuwan\"]  [dependencies] \/\/ \u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u043c\u0443 \u043a\u0440\u0435\u0439\u0442\u0443 greetings = { path = \"greetings\" }  \/\/ phrases\/greetings\/src\/lib.rs pub fn hello() {     println!(\"Hello, world!\"); }  \/\/ phrases\/src\/main.rs use greetings;  fn main() {     greetings::hello(); }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ Cargo.toml [dependencies]  \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0432 \u043c\u0430\u0441\u0442\u0435\u0440 \u0432\u0435\u0442\u043a\u0443 rocket = { git = \"https:\/\/github.com\/SergioBenitez\/Rocket\" }  \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 rocket = { git = \"https:\/\/github.com\/SergioBenitez\/Rocket\", branch = \"v0.3\" }  \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u0433 rocket = { git = \"https:\/\/github.com\/SergioBenitez\/Rocket\", tag = \"v0.3.2\" }  \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0440\u0435\u0432\u0438\u0437\u0438\u044f rocket = { git = \"https:\/\/github.com\/SergioBenitez\/Rocket\", rev = \"8183f636305cef4adaa9525506c33cbea72d1745\" }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"cratesio\">crates.io<\/h4>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u0440\u0435\u0439\u0442 &#171;Hello world&#187; \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0435\u0433\u043e \u043d\u0430 <a href=\"http:\/\/crates.io\/\">crates.io<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b cargo new test_crate_hello_world --lib  \/\/ \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 test_crate_hello_world  \u251c\u2500\u2500 Cargo.toml  \u2514\u2500\u2500 src     \u2514\u2500\u2500 lib.rs  \/\/ test_crate_hello_world\/Cargo.toml [package] name = \"test_crate_hello_world\" version = \"0.1.0\" authors = [\"Dumindu Madunuwan\"]  description = \"A Simple Hello World Crate\" repository = \"https:\/\/github.com\/dumindu\/test_crate_hello_world\" keywords = [\"hello\", \"world\"] license = \"Apache-2.0\"  [dependencies]  \/\/ test_crate_hello_world\/src\/lib.rs \/\/! A Simple Hello World Crate  \/\/\/ \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435; `Hello, world!` pub fn hello() -> String {     (\"Hello, world!\").to_string() }  #[cfg(test)] mod tests {     use super::hello;      #[test]     fn test_hello() {         assert_eq!(hello(), \"Hello, world!\");     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u043a-\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 <code>\/\/!<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043a\u0440\u0435\u0439\u0442\u0430 \u0438 \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>\/\/\/<\/code> \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0431\u043b\u043e\u043a\u0430. \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043a\u0440\u0435\u0439\u0442\u0430 \u043d\u0430 <code>crates.io<\/code>, <code>cargo<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u043e\u043a-\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442 \u0435\u0435 \u043d\u0430 <a href=\"https:\/\/docs.rs\/\">docs.rs<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u044f <code>description<\/code> \u0438 <code>license<\/code> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430 \u043d\u0430 <code>crates.io<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043d\u0430 <code>crates.io<\/code> \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d API.<\/li>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>cargo login &lt;token><\/code> \u0441 \u044d\u0442\u0438\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0438 \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>cargo publish<\/code>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>cargo publish<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u0434\u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>cargo package<\/code> \u0434\u043b\u044f \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u043a\u0440\u0435\u0439\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 <code>crates.io<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u043a\u0440\u0435\u0439\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>test_crate_hello_world<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/crates.io\/crates\/test_crate_hello_world\">https:\/\/crates.io\/crates\/test_crate_hello_world<\/a> \u0438 <a href=\"https:\/\/docs.rs\/test_crate_hello_world\">https:\/\/docs.rs\/test_crate_hello_world<\/a>.<\/p>\n<p>  <\/p>\n<p><code>crates.io<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u044b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c (<code>readme<\/code>). \u0421\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 <code>Cargo.toml<\/code>: <code>readme=\"README.md\"<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0448 \u043a\u0440\u0435\u0439\u0442 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u0440\u0435\u0439\u0442\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 cargo new greetings  \/\/ \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 greetings  \u251c\u2500\u2500 Cargo.toml  \u2514\u2500\u2500 src     \u2514\u2500\u2500 main.rs  \/\/ greetings\/Cargo.toml [package] name = \"greetings\" version = \"0.1.0\" authors = [\"Dumindu Madunuwan\"]  [dependencies] \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u0440\u0435\u0439\u0442 test_crate_hello_world = \"0.1.0\"  \/\/ greetings\/src\/main.rs use test_crate_hello_world;  fn main() {     println!(\"{}\", test_crate_hello_world::hello()); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>cargo<\/code> \u0438\u0449\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 <code>crates.io<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 <code>Cargo.toml<\/code> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u0440\u0435\u0439\u0442\u0430 \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u0441\u0438\u044e. \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>cargo build<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"rabochie-prostranstva-workspaces\">\u0420\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (workspaces)<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <code>Rust<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c (<code>cargo check<\/code>), \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u0440\u0435\u0439\u0442\u043e\u0432 \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 <code>cargo<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438 \u0432\u0435\u043b\u0438\u043a\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043e\u0431\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0412\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 <code>Rust<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0431\u0449\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441\u0431\u043e\u0440\u043a\u0438 (shared build directory) \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 <code>cargo build<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">mkdir greetings touch greetings\/Cargo.toml cargo new greetings\/lib --lib cargo new greetings\/examples\/hello<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">greetings  \u251c\u2500\u2500 Cargo.toml  \u251c\u2500\u2500 examples  \u2502  \u2514\u2500\u2500 hello  \u2502     \u251c\u2500\u2500 Cargo.toml  \u2502     \u2514\u2500\u2500 src  \u2502        \u2514\u2500\u2500 main.rs  \u2514\u2500\u2500 lib     \u251c\u2500\u2500 Cargo.toml     \u2514\u2500\u2500 src        \u2514\u2500\u2500 lib.rs<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ greetings\/Cargo.toml - \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438 \u0435\u0433\u043e \u0447\u043b\u0435\u043d\u043e\u0432 [workspace] members = [     \"lib\",     \"examples\/hello\" ]  \/\/ greetings\/lib\/Cargo.toml - \u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0430 `greetings` [package] name = \"greetings\" version = \"0.1.0\" authors = [\"Dumindu Madunuwan\"]  [dependencies]  \/\/ greetings\/lib\/src\/lib.rs - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e pub fn hello() {     println!(\"Hello, world!\"); }  \/\/ greetings\/examples\/hello\/Cargo.toml - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 `greetings` \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c [package] name = \"hello\" version = \"0.1.0\" authors = [\"Dumindu Madunuwan\"]  [dependencies] greetings = { path = \"..\/..\/lib\" }  \/\/ greetings\/examples\/hello\/src\/main.rs - \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 `greetings` \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e use greetings;  fn main() {     greetings::hello(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e <code>Rust<\/code> \u2014 <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\">rust-lang\/rust<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"use\">Use<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>use<\/code>.<\/p>\n<p>  <\/p>\n<h4 id=\"privyazka-polnogo-puti-k-novomu-nazvaniyu\">\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c <code>use<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 (bind) \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">mod phrases {   pub mod greetings {     pub fn hello() {       println!(\"Hello, world!\");     }   } }  fn main() {   phrases::greetings::hello(); \/\/ \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0438\u043d\u043e\u043d\u0438\u043c (alias) \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f use phrases::greetings; fn main() {   greetings::hello(); }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0438\u043d\u043e\u043d\u0438\u043c \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u044f use phrases::greetings::hello; fn main() {   hello(); }  \/\/ \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 `as` use phrases::greetings::hello as greet; fn main() {   greet(); }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"import-elementov-v-oblast-vidimosti\">\u0418\u043c\u043f\u043e\u0440\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0438\u043d\u043e\u043d\u0438\u043c\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn hello() -> String {   \"Hello, world!\".to_string() }  #[cfg(test)] mod tests {   use super::hello; \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e `hello()` \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438    #[test]   fn test_hello() {     assert_eq!(\"Hello, world!\", hello()); \/\/ \u0431\u0435\u0437 `use` \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 `super::hello()`   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f <code>use<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438, \u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 <code>self<\/code> \u0438 <code>super<\/code> \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u0443\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c <code>use<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u0440\u0435\u0439\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <code>std<\/code> \u2014 <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\/libstd\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/a> <code>Rust<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0418\u043c\u043f\u043e\u0440\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 use std::fs::File;  fn main() {     File::create(\"empty.txt\").expect(\"Can not create the file!\"); }  \/\/ \u0418\u043c\u043f\u043e\u0440\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 use std::fs::{self, File}; \/\/ `use std::fs; use std::fs::File;`  fn main() {     fs::create_dir(\"some_dir\").expect(\"Can not create the directory!\");     File::create(\"some_dir\/empty.txt\").expect(\"Cannot create the file!\"); }  \/\/ \u0418\u043c\u043f\u043e\u0440\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 use std::fs::File; use std::io::{BufReader, BufRead}; \/\/ `use std::io::BufReader; use std::io::BufRead;`  fn main() {     let file = File::open(\"src\/hello.txt\").expect(\"File not found\");     let buf_reader = BufReader::new(file);      for line in buf_reader.lines() {         println!(\"{}\", line.unwrap());     } }<\/code><\/pre>\n<p>  <\/p>\n<p><code>use<\/code> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u0430 \u043d\u0435 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u043b\u0438 \u043a\u0440\u0435\u0439\u0442\u0430. \u042d\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"povtornyy-eksport\">\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442<\/h4>\n<p>  <\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u2014 <code>pub use<\/code>. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u043e\u043c (re-export).<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ main.rs mod phrases;  fn main() {     phrases::hello(); \/\/ \u043d\u0435\u043f\u0440\u044f\u043c\u0430\u044f \u0441\u0432\u044f\u0437\u044c }  \/\/ phrases\/mod.rs pub mod greetings;  pub use self::greetings::hello; \/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 `greetings::hello()`  \/\/ phrases\/greetings.rs pub fn hello() {   println!(\"Hello, world!\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445. \u041e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043a\u0440\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"std-primitivy-i-prelyudii\">Std, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0438 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412 <code>Rust<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0437\u044b\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0435\u0439\u0442\u043e\u043c <code>std<\/code> (\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439), \u043d\u043e \u0438 \u0441\u0430\u043c\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/doc.rust-lang.org\/std\/#primitives\">\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b<\/a> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f <code>std<\/code> \u043d\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u0445<\/li>\n<li><a href=\"https:\/\/doc.rust-lang.org\/std\/#macros\">\u043c\u0430\u043a\u0440\u043e\u0441\u044b<\/a> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u0442\u0430\u043a \u0438 <code>std<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p><code>std<\/code> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 <a href=\"https:\/\/doc.rust-lang.org\/std\/#modules\">\u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/a> \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0444\u0435\u0440\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u0445 \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 <code>std<\/code>. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c <code>char<\/code>, <code>str<\/code> \u0438 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u0445, \u0442\u0430\u043a \u0438 \u0432 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 <code>std<\/code>.<\/p>\n<p>  <\/p>\n<h4 id=\"primitivy\">\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b<\/h4>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f `std` bool, char, slice, str  i8, i16, i32, i64, i128, isize u8, u16, u32, u64, u128, usize  f32, f64  array, tuple  pointer, fn, reference<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"makrosy-standartnye\">\u041c\u0430\u043a\u0440\u043e\u0441\u044b (\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435)<\/h4>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u0442\u0430\u043a \u0438 `std` print, println, eprint, eprintln format, format_args write, writeln  concat, concat_idents, stringify \/\/ concat_idents - \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 API (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u043e\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 (nightly) Rust)  include, include_bytes, include_str  assert, assert_eq, assert_ne debug_assert, debug_assert_eq, debug_assert_ne  try, panic, compile_error, unreachable, unimplemented  file, line, column, module_path env, option_env cfg  select, thread_local \/\/ select - \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 API  vec<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"moduli-std\">\u041c\u043e\u0434\u0443\u043b\u0438 <code>std<\/code><\/h4>\n<p>  <\/p>\n<pre><code class=\"rust\">char, str  i8, i16, i32, i64, i128, isize u8, u16, u32 ,u64, u128, usize f32, f64 num  vec, slice, hash, heap, collections \/\/ heap - \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 API  string, ascii, fmt  default  marker, clone, convert, cmp, iter  ops, ffi  option, result, panic, error  io fs, path mem, thread, sync process, env net time os  ptr, boxed, borrow, cell, any, rc  prelude  intrinsics \/\/ \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 API raw \/\/ \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 API<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 <a href=\"https:\/\/github.com\/rust-lang\/rust\"><code>\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 Rust<\/code><\/a>, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\">src<\/a> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c (workspace). \u0425\u043e\u0442\u044f \u043e\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u043a\u0440\u0435\u0439\u0442\u043e\u0432, \u0438\u0437\u0443\u0447\u0438\u0432 <a href=\"https:\/\/github.com\/rust-lang\/rust\/blob\/master\/src\/Cargo.toml\">Cargo.toml<\/a>, \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\/rustc\">rustc<\/a> (\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440) \u0438 <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\/libstd\">libstd<\/a> (<code>std<\/code>). \u0412 <code>libstd\/lib.rs<\/code> \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>pub use<\/code>, \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <code>std<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/rust-lang\/rust\/tree\/master\/src\/libcore\">src\/libcore<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <code>std<\/code>:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>std::io<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0432\u043e\u0434\u043e\u043c\/\u0432\u044b\u0432\u043e\u0434\u043e\u043c<\/li>\n<li><code>std::fs<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439<\/li>\n<li><code>std::path<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438<\/li>\n<li><code>std::env<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/li>\n<li><code>std::mem<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/li>\n<li><code>std::net<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <code>TCP<\/code>\/<code>UDP<\/code><\/li>\n<li><code>std::os<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439<\/li>\n<li><code>std::thread<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438<\/li>\n<li><code>std::collections<\/code> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 (<code>HasMap<\/code>, <code>HashSet<\/code> \u0438 \u0434\u0440.)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 <code>std<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/doc.rust-lang.org\/std\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<h4 id=\"prelyudii\">\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u0438<\/h4>\n<p>  <\/p>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 <code>std<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <code>Rust<\/code>, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0447\u0430\u0441\u0442\u044c. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/doc.rust-lang.org\/std\/prelude\/\">\u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0435\u0439<\/a> (prelude). \u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 pub use marker::{Copy, Send, Sized, Sync}; pub use ops::{Drop, Fn, FnMut, FnOnce};  \/\/ \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 pub use mem::drop;  \/\/ \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0442\u0440\u0435\u0439\u0442\u043e\u0432 pub use boxed::Box; pub use borrow::ToOwned; pub use clone::Clone; pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; pub use convert::{AsRef, AsMut, Into, From}; pub use default::Default; pub use iter::{Iterator, Extend, IntoIterator}; pub use iter::{DoubleEndedIterator, ExactSizeIterator}; pub use option::Option::{self, Some, None}; pub use result::Result::{self, Ok, Err}; pub use slice::SliceConcatExt; pub use string::{String, ToString}; pub use vec::Vec;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/rust-lang\/rust\/blob\/master\/src\/libstd\/prelude\/v1.rs\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 <code>Rust<\/code> \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442<\/p>\n<p>  <\/p>\n<ul>\n<li><code>extern crate std<\/code> \u2014 \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0440\u0435\u0439\u0442\u0430<\/li>\n<li><code>use std::prelude::*<\/code> \u2014 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <code>Rust<\/code>. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 <code>std<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>std::io<\/code>) \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>diesel<\/code>) \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043c\u043e\u0434\u0443\u043b\u0438 <code>prelude<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432\u0441\u0435\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041e\u043d\u0438 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0422\u043e\u043b\u044c\u043a\u043e <code>std::prelude<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b <code>Rust<\/code>.<\/p>\n<p>  <\/p>\n<h1 id=\"obrabotka-oshibok\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/h1>\n<p>  <\/p>\n<h2 id=\"umnyy-kompilyator\">\u0423\u043c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/h2>\n<p>  <\/p>\n<h4 id=\"pochemu-kompilyator\">\u041f\u043e\u0447\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440?<\/h4>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044e \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 <code>Rust<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440. \u041e\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438\u043b\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">#[allow(unused_variables)] \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043b\u0438\u043d\u0442\u0438\u043d\u0433\u0430 (lint attribute), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f (supress) \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (`b`) fn main() {     let a = vec![1, 2, 3];     let b = a;      println!(\"{:?}\", a); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (compile-time error) error[E0382]: use of moved value: `a`  --> src\/main.rs:6:22   | 3 |     let b = a;   |         - value moved here 4 | 5 |     println!(\"{:?}\", a);   |                      ^ value used here after move   |   = note: move occurs because `a` has type `std::vec::Vec&lt;i32>`, which does not implement the `Copy` trait  error: aborting due to previous error For more information about this error, try `rustc --explain E0382`.  \/\/ \u0412\u043c\u0435\u0441\u0442\u043e `#[allow(unused_variables)]`, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c `let _b = a;` \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 4. \/\/ \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c `let _ =` \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0436\u0438\u0437\u043d\u0438 \u0438\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043d\u043e \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">struct Color {     r: u8,     g: u8,     b: u8, }  fn main() {     let yellow = Color {         r: 255,         g: 255,         \/\/ \u0422\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442         d: 0,     };      println!(\"Yellow = rgb({},{},{})\", yellow.r, yellow.g, yellow.b); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 error[E0560]: struct `Color` has no field named `d`   --> src\/main.rs:11:9    | 11 |         d: 0,    |         ^ field does not exist - did you mean `b`?  error: aborting due to previous error For more information about this error, try `rustc --explain E0560`.<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"opisanie-oshibki\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/h4>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u0415\u0441\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>rustc --explain &lt;\u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438><\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>rustc --explain E0571<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f `break` \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 `loop` A `break` statement with an argument appeared in a non-`loop` loop.  \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 Example of erroneous code: \uff40\uff40\uff40 let result = while true {     if satisfied(i) {         break 2*i; \/\/ error: `break` with value from a `while` loop     }     i += 1; }; \uff40\uff40\uff40  \/\/ \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e `break` \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0446\u0438\u043a\u043b\u0435, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e `loop` The `break` statement can take an argument (which will be the value of the loop expression if the `break` statement is executed) in `loop` loops, but not `for`, `while`, or `while let` loops.  Make sure `break value;` statements only occur in `loop` loops: \uff40\uff40\uff40 let result = loop { \/\/ ok!     if satisfied(i) {         break 2*i;     }     i += 1; }; \uff40\uff40\uff40<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/doc.rust-lang.org\/error_codes\/error-index.html\"><code>\u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 Rust<\/code><\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 <code>E0571<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/doc.rust-lang.org\/error-index.html#E0571\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"panika\">\u041f\u0430\u043d\u0438\u043a\u0430<\/h2>\n<p>  <\/p>\n<h4 id=\"panic\">panic!()<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438). \u0422\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u043c\u0438 (unrecoverable errors)<\/li>\n<li>\u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 &#171;\u043b\u043e\u0433\u0438&#187; (logs), \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043a\u043e\u0434, \u0432\u044b\u0439\u0434\u044f \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043a\u043e\u0434\u0430, \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0430\u043a\u0440\u043e\u0441 <code>panic!()<\/code>.<\/p>\n<p>  <\/p>\n<p><code>panic!()<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a\u0435. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0430\u043d\u0438\u043a\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><em>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ ...      \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435     panic!(); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'explicit panic', src\/main.rs:5:5<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">#[allow(unused_mut)] \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043b\u0438\u043d\u0442\u0438\u043d\u0433\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f `username` \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0439 fn main() {     let mut username = String::new();      \/\/ \u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f      if username.is_empty() {         panic!(\"Username is empty!\");     }      println!(\"{}\", username); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'Username is empty!', src\/main.rs:8:9<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">#[derive(Debug)] \/\/ \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 (derive) \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 `std::fmt::Debug` \u043d\u0430 `Color` struct Color {     r: u8,     g: u8,     b: u8, }  #[allow(unreachable_code)] \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043b\u0438\u043d\u0442\u0438\u043d\u0433\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u043e\u043c \u043a\u043e\u0434\u0435 (\u043a\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d) fn main() {     let some_color: Color;      \/\/ \u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440     some_color = Color { r: 255, g: 255, b: 0 };      \/\/ \u0415\u0441\u043b\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0443     panic!(\"{:?}\", some_color);      println!(         \"The color = rgb({},{},{})\",         some_color.r, some_color.g, some_color.b     ); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'Color { r: 255, g: 255, b: 0 }', src\/main.rs:16:5<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, <code>panic!()<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0438\u043b\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>println!()<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0433\u0434\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  <\/p>\n<h4 id=\"unimplemented\">unimplemented!()<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044b, \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0430\u043a\u0440\u043e\u0441 <code>unimplemented!()<\/code>. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 <code>not yet implemented<\/code> \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ panic!() thread 'main' panicked at 'explicit panic', src\/main.rs:6:5 thread 'main' panicked at 'Username is empty!', src\/main.rs:9:9 thread 'main' panicked at 'Color { r: 255, g: 255, b: 0 }', src\/main.rs:17:5  \/\/ unimplemented!() thread 'main' panicked at 'not yet implemented', src\/main.rs:6:5 thread 'main' panicked at 'not yet implemented: Username is empty!', src\/main.rs:9:9 thread 'main' panicked at 'not yet implemented: Color { r: 255, g: 255, b: 0 }', src\/main.rs:17:5<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"unreachable\">unreachable!()<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0430\u043a\u0440\u043e\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u043e\u0432 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u041f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0431\u043b\u043e\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 <code>internal error: entered unreachable code<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let level = 22;     let stage = match level {         1..=5 => \"beginner\",         6..=10 => \"intermediate\",         11..=20 => \"expert\",         _ => unreachable!(),     };      println!(\"{}\", stage); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'internal error: entered unreachable code', src\/main.rs:7:20<\/code><\/pre>\n<p>  <\/p>\n<p><code>unreachable!()<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0421 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c _ => unreachable!(\"Custom message\"), \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'internal error: entered unreachable code: Custom message', src\/main.rs:7:20  \/\/ \u0421 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 _ => unreachable!(\"level is {}\", level), \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'internal error: entered unreachable code: level is 22', src\/main.rs:7:14<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"assert-assert_eq-assert_ne\">assert!(), assert_eq!(), assert_ne!()<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>assert!()<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c. \u0415\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c, <code>assert!()<\/code> \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let f = false;      assert!(f) }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'assertion failed: f', src\/main.rs:4:5<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>assert_eq!()<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c\u0438, <code>assert_eq!()<\/code> \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let a = 10;     let b = 20;      assert_eq!(a, b); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'assertion failed: `(left == right)` \/\/   left: `10`, \/\/  right: `20`', src\/main.rs:5:5<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>assert_ne!()<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u041d\u0415 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c\u0438, <code>assert_ne!()<\/code> \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let a = 10;     let b = 10;      assert_ne!(a, b); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'assertion failed: `(left != right)` \/\/   left: `10`, \/\/  right: `10`', src\/main.rs:5:5<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0421 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c fn main() {     let a = 10;     let b = 20;      assert_eq!(a, b, \"a and b should be equal\"); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'assertion failed: `(left == right)` \/\/   left: `10`, \/\/  right: `20`: a and b should be equal', src\/main.rs:5:5<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u0421 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 fn main() {     let a = 10;     let b = 20;      let c = 40;      assert_eq!(a + b, c, \"a = {} ; b = {}\", a, b); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'assertion failed: `(left == right)` \/\/   left: `30`, \/\/  right: `40`: a = 10 ; b = 20', src\/main.rs:7:5<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"debug_assert-debug_assert_eq-debug_assert_ne\">debug_assert!(), debug_assert_eq!(), debug_assert_ne!()<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435. \u041d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0430\u0445 (\u0441\u0431\u043e\u0440\u043a\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438). \u0418\u0437 \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u043e\u043d\u0438 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0444\u043b\u0430\u0433 <code>-C debug-assertions<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"option-i-result\">Option \u0438 Result<\/h2>\n<p>  <\/p>\n<p>\u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u044b <code>null<\/code> \\ <code>nil<\/code> \\ <code>undefined<\/code>, \u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u2014 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (exceptions). \u0412 <code>Rust<\/code> \u043d\u0435\u0442 \u043d\u0438 \u0442\u043e\u0433\u043e, \u043d\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u042d\u0442\u043e, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u0430\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f (null pointer exceptions), \u0443\u0442\u0435\u0447\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0434\u0440. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e <code>Rust<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 2 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u0449\u0438\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u2014 <code>Option<\/code> \u0438 <code>Result<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435,<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<code>Option<\/code>) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c (<code>Some<\/code>), \u043b\u0438\u0431\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c (<code>None<\/code>)<\/li>\n<li>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (<code>Result<\/code>) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0443\u0441\u043f\u0435\u0445\u043e\u043c (<code>Ok<\/code>), \u043b\u0438\u0431\u043e \u043e\u0448\u0438\u0431\u043a\u043e\u0439 (<code>Err<\/code>)<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">enum Option&lt;T> { \/\/ `T` - \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     Some(T),     None, }  enum Result&lt;T, E> { \/\/ `T` \u0438 `E` - \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438. `T` - \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, `E` - \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438     Ok(T),     Err(E), }<\/code><\/pre>\n<p>  <\/p>\n<p><code>Option<\/code> \u0438 <code>Result<\/code> \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<p>  <\/p>\n<h4 id=\"option\">Option<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c<\/li>\n<li>\u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (non-void), \u0438 \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c<\/li>\n<li>\u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Option<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>&amp;str<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439, \u0442\u0438\u043f\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c <code>Option&lt;&amp;str><\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn get_an_optional_value() -> Option&lt;&amp;str> {     \/\/ \u0415\u0441\u043b\u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0435     return Some(\"Some value\");      \/\/ \u0438\u043d\u0430\u0447\u0435     None }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>middle_name<\/code> \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <code>Name<\/code>, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u0432 <code>Option<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">struct Name {   first_name: String,   middle_name: Option&lt;String>, \/\/ `middle_name` \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c   last_name: String, }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (<code>Some<\/code>\/<code>None<\/code>) \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <code>match<\/code>. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 <code>std::env<\/code> \u2014 <a href=\"https:\/\/doc.rust-lang.org\/std\/env\/fn.home_dir.html\">home_dir()<\/a>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u043a\u0430\u043a <code>Linux<\/code>, \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 <code>home_dir()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <a href=\"https:\/\/doc.rust-lang.org\/std\/path\/struct.PathBuf.html\">Option:<\/a>  <\/p>\n<pre><code class=\"rust\">use std::env;  fn main() {     let home_path = env::home_dir();     match home_path {         Some(p) => println!(\"{:?}\", p), \/\/ \u0432 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435 Rust \u044d\u0442\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 `\/root`         None => println!(\"Cannot find the home directory!\"),     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>None<\/code> \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn get_full_name(fname: &amp;str, lname: &amp;str, mname: Option&lt;&amp;str>) -> String { \/\/ `mname` \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c   match mname {     Some(n) => format!(\"{} {} {}\", fname, n, lname),     None => format!(\"{} {}\", fname, lname),   } }  fn main() {   println!(\"{}\", get_full_name(\"Galileo\", \"Galilei\", None));   println!(\"{}\", get_full_name(\"Leonardo\", \"Vinci\", Some(\"Da\"))); }  \/\/ \u041b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 `Person` \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 `fname`, `lname`, `mname` \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 `full_name()` \u043d\u0430 \u043d\u0435\u0439<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, <code>Option<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <code>Rust<\/code> \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>null<\/code>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 <code>Rust<\/code> \u043d\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439, \u0442\u0438\u043f\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>null<\/code>, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Option&lt;Box&lt;T>><\/code>.<\/p>\n<p>  <\/p>\n<h4 id=\"result\">Result<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Result<\/code>, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 (valid output) \u0438 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0442\u0438\u043f \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u2014 <code>u64<\/code>, \u0430 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 <code>String<\/code>, \u0442\u0438\u043f\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>Result&lt;u64, String><\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn function_with_error() -> Result&lt;u64, String> {     \/\/ \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430     return Err(\"The error message\".to_string());      \/\/ \u0438\u043d\u0430\u0447\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434     Ok(255) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (<code>Ok<\/code>\/<code>Err<\/code>) \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <code>match<\/code>. \u0412 <code>std::env<\/code> \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u2014 <a href=\"https:\/\/doc.rust-lang.org\/std\/env\/fn.var.html\">var()<\/a>. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 <code>var()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <a href=\"https:\/\/doc.rust-lang.org\/std\/env\/enum.VarError.html\">Result&lt;String, VarError><\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::env;  fn main() {     let key = \"HOME\";     match env::var(key) {         Ok(v) => println!(\"{}\", v), \/\/ \u0432 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435 Rust \u044d\u0442\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 `\/root`         Err(e) => println!(\"{}\", e), \/\/ \u044d\u0442\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 `environment variable not found`, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f     } }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"is_some-is_none-is_ok-is_err\">is_some(), is_none(), is_ok(), is_err()<\/h4>\n<p>  <\/p>\n<p><code>Rust<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b <code>match<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>is_some()<\/code>, <code>is_none()<\/code>, <code>is_ok()<\/code> \u0438 <code>is_err()<\/code> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let x: Option&lt;&amp;str> = Some(\"Hello, world!\");     assert_eq!(x.is_some(), true);     assert_eq!(x.is_none(), false);      let y: Result&lt;i8, &amp;str> = Ok(10);     assert_eq!(y.is_ok(), true);     assert_eq!(y.is_err(), false); }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"ok-err\">ok(), err()<\/h4>\n<p>  <\/p>\n<p>\u0414\u043b\u044f <code>Result<\/code> \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>ok()<\/code> \u0438 <code>err()<\/code>. \u041e\u043d\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442 <code>Ok&lt;T><\/code> \u0438 <code>Err&lt;E><\/code> \u0432 <code>Some(T)<\/code> \u0438 <code>None<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let o: Result&lt;i8, &amp;str> = Ok(8);     let e: Result&lt;i8, &amp;str> = Err(\"message\");      assert_eq!(o.ok(), Some(8)); \/\/ Ok(v) ok = Some(v)     assert_eq!(e.ok(), None);    \/\/ Err(v) ok = None      assert_eq!(o.err(), None);            \/\/ Ok(v) err = None     assert_eq!(e.err(), Some(\"message\")); \/\/ Err(v) err = Some(v) }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"unwrap-i-expect\">unwrap() \u0438 expect()<\/h2>\n<p>  <\/p>\n<h4 id=\"unwrap\">unwrap()<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 <code>Option<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code> \u0438\u043b\u0438 <code>Result<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Ok<\/code>, \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433<\/li>\n<li>\u0435\u0441\u043b\u0438 <code>Option<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code> \u0438\u043b\u0438 <code>Result<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Err<\/code>, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <code>Err<\/code>, \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>match<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let x;     match get_an_optional_value() {         Some(v) => x = v, \/\/ \u0435\u0441\u043b\u0438 `Some(\"abc\")`, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c `x` \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \"abc\"         None => panic!(), \/\/ \u0435\u0441\u043b\u0438 `None`, \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u043c \u0431\u0435\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f     }      println!(\"{}\", x); \/\/ \"abc\" ; \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c `false` \u043d\u0430 `true` \u0432 `get_an_optional_value()` }  fn get_an_optional_value() -> Option&lt;&amp;'static str> {     \/\/ \u0415\u0441\u043b\u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c     if false {         return Some(\"abc\");     }      \/\/ \u0438\u043d\u0430\u0447\u0435     None }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'explicit panic', src\/main.rs:5:17<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let x;     match function_with_error() {         Ok(v) => x = v, \/\/ \u0435\u0441\u043b\u0438 `Ok(255)`, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c `x` \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 255         Err(e) => panic!(e), \/\/ \u0435\u0441\u043b\u0438 `Err(\"some message\")`, \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u043c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \"some message\"     }      println!(\"{}\", x); \/\/ 255; \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c `true` \u043d\u0430 `false` \u0432 `function_with_error()` }  fn function_with_error() -> Result&lt;u64, String> {     \/\/ \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430     if true {         return Err(\"some message\".to_string());     }      \/\/ \u0438\u043d\u0430\u0447\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434     Ok(255) }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'some message', src\/main.rs:5:19<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434, \u043d\u043e \u0441 <code>unwrap()<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let x = get_an_optional_value().unwrap();      println!(\"{}\", x); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore\/option.rs:345:21  fn main() {     let x = function_with_error().unwrap();      println!(\"{}\", x); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: \"some message\"', libcore\/result.rs:945:5<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>unwrap()<\/code> \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043f\u0430\u043d\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<h4 id=\"expect\">expect()<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>unwrap()<\/code>, \u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0430\u043d\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let n: Option&lt;i8> = None;      n.expect(\"empty value returned\"); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'empty value returned', libcore\/option.rs:989:5  fn main() {     let e: Result&lt;i8, &amp;str> = Err(\"some message\");      e.expect(\"expect error message\"); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'expect error message: \"some message\"', libcore\/result.rs:945:5<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"unwrap_err-i-expect_err\">unwrap_err() \u0438 expect_err()<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f <code>Result<\/code>, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e <code>unwrap()<\/code> \u0438 <code>expect()<\/code>, \u0442.\u0435. \u043f\u0430\u043d\u0438\u043a\u0443\u044e\u0442 \u043f\u0440\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 <code>Ok<\/code> (\u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445). \u041f\u0435\u0447\u0430\u0442\u0430\u044e\u0442 \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Ok<\/code>, \u0442\u0430\u043a \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let o: Result&lt;i8, &amp;str> = Ok(8);      o.unwrap_err(); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'called `Result::unwrap_err()` on an `Ok` value: 8', libcore\/result.rs:945:5  fn main() {     let o: Result&lt;i8, &amp;str> = Ok(8);      o.expect_err(\"Should not get Ok value\"); }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \/\/ thread 'main' panicked at 'Should not get Ok value: 8', libcore\/result.rs:945:5<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"unwrap_or-unwrap_or_default-i-unwrap_or_else\">unwrap_or(), unwrap_or_default() \u0438 unwrap_or_else()<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 <code>unwrap()<\/code> \u0432 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <code>Some<\/code> \u0438 <code>Ok<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043d\u0435\u0433\u043e \u0432 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <code>None<\/code> \u0438 <code>Err<\/code>.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>unwrap_or()<\/code> \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <code>None<\/code> \u0438 <code>Err<\/code>, \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let v1 = 8;     let v2 = 16;      let s_v1 = Some(8);     let n = None;      assert_eq!(s_v1.unwrap_or(v2), v1); \/\/ Some(v1) unwrap_or v2 = v1     assert_eq!(n.unwrap_or(v2), v2);    \/\/ None unwrap_or v2 = v2      let o_v1: Result&lt;i8, &amp;str> = Ok(8);     let e: Result&lt;i8, &amp;str> = Err(\"error\");      assert_eq!(o_v1.unwrap_or(v2), v1); \/\/ Ok(v1) unwrap_or v2 = v1     assert_eq!(e.unwrap_or(v2), v2);    \/\/ Err unwrap_or v2 = v2 }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>unwrap_or_default()<\/code> \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <code>None<\/code> \u0438 <code>Err<\/code>, \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e <code>Some<\/code>\/<code>Ok<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let v = 8;     let v_default = 0;      let s_v: Option&lt;i8> = Some(8);     let n: Option&lt;i8> = None;      assert_eq!(s_v.unwrap_or_default(), v);       \/\/ Some(v) unwrap_or_default = v     assert_eq!(n.unwrap_or_default(), v_default); \/\/ None unwrap_or_default = \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 v      let o_v: Result&lt;i8, &amp;str> = Ok(8);     let e: Result&lt;i8, &amp;str> = Err(\"error\");      assert_eq!(o_v.unwrap_or_default(), v);       \/\/ Ok(v) unwrap_or_default = v     assert_eq!(e.unwrap_or_default(), v_default); \/\/ Err unwrap_or_default = \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 v }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>unwrap_or_else()<\/code> \u2014 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 <code>unwrap_or()<\/code>. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 <code>Some<\/code>\/<code>Ok<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let v1 = 8;     let v2 = 16;      let s_v1 = Some(8);     let n = None;     let fn_v2_for_option = || 16;      assert_eq!(s_v1.unwrap_or_else(fn_v2_for_option), v1); \/\/ Some(v1) unwrap_or_else fn_v2 = v1     assert_eq!(n.unwrap_or_else(fn_v2_for_option), v2);    \/\/ None unwrap_or_else fn_v2 = v2      let o_v1: Result&lt;i8, &amp;str> = Ok(8);     let e: Result&lt;i8, &amp;str> = Err(\"error\");     let fn_v2_for_result = |_| 16;      assert_eq!(o_v1.unwrap_or_else(fn_v2_for_result), v1); \/\/ Ok(v1) unwrap_or_else fn_v2 = v1     assert_eq!(e.unwrap_or_else(fn_v2_for_result), v2);    \/\/ Err unwrap_or_else fn_v2 = v2 }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"rasprostranenie-oshibki-i-none\">\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 None<\/h2>\n<p>  <\/p>\n<p><code>panic!()<\/code>, <code>unwrap()<\/code> \u0438 <code>expect()<\/code> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0443\u0447\u0448\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 <code>None<\/code> \u0438\u043b\u0438 <code>Err<\/code><\/p>\n<p>  <\/p>\n<ul>\n<li>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<li>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <code>None<\/code> \u0438\u043b\u0438 <code>Err<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 (caller) \u0434\u043b\u044f \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 error propagation)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0438\u043f\u044b <code>None<\/code> \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u041e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"operator-\">\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 ?<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 <code>Option<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code> \u0438\u043b\u0438 <code>Result<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Ok<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433<\/li>\n<li>\u0435\u0441\u043b\u0438 <code>Option<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code> \u0438\u043b\u0438 <code>Result<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Err<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     if complex_function().is_none() {         println!(\"X not exists!\");     } }  fn complex_function() -> Option&lt;&amp;'static str> {     let x = get_an_optional_value()?; \/\/ \u0435\u0441\u043b\u0438 `None`, \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f; \u0435\u0441\u043b\u0438 `Some(\"abc\")`, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c `x` \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \"abc\"      println!(\"{}\", x); \/\/ \"abc\" ; \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c `false` \u043d\u0430 `true` \u0432 `get_an_optional_value()`      Some(\"\") }  fn get_an_optional_value() -> Option&lt;&amp;'static str> {     \/\/ \u0415\u0441\u043b\u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c     if false {         return Some(\"abc\");     }      \/\/ \u0438\u043d\u0430\u0447\u0435     None }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f `main` - \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `complex_function()`,     \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 `complex_function()` \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 `main()`     if complex_function().is_err() {         println!(\"Can not calculate X!\");     } }  fn complex_function() -> Result&lt;u64, String> {     let x = function_with_error()?; \/\/ \u0435\u0441\u043b\u0438 `Err`, \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f; \u0435\u0441\u043b\u0438 `Ok(255)`, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c `x` \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 255      println!(\"{}\", x); \/\/ 255; \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c `true` \u043d\u0430 `false` \u0432 `function_with_error()`      Ok(0) }  fn function_with_error() -> Result&lt;u64, String> {     \/\/ \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430     if true {         return Err(\"some message\".to_string());     }      \/\/ \u0438\u043d\u0430\u0447\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434     Ok(255) }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"try\">try!()<\/h4>\n<p>  <\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>?<\/code> \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 <code>Rust<\/code> \u0432\u0435\u0440\u0441\u0438\u0438 1.13. \u041c\u0430\u043a\u0440\u043e\u0441 <code>try!()<\/code> \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0421\u0435\u0439\u0447\u0430\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">\/\/ \u042d\u0442\u043e let x = function_with_error()?;  \/\/ \u042d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u044d\u0442\u043e\u043c\u0443 let x = try!(function_with_error());<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"rasprostranenie-oshibki-iz-main\">\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437 main()<\/h4>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <code>Rust<\/code> \u0432\u0435\u0440\u0441\u0438\u0438 1.26 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u0442\u0438\u043f\u044b <code>Result<\/code> \u0438 <code>Option<\/code> \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main()<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>Err<\/code> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u0435\u0435 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (<code>Debug<\/code>). \u041c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fs::File;  fn main() -> std::io::Result&lt;()> {     let _ = File::open(\"not-existing-file.txt\")?;      Ok(()) \/\/ \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043e\u0440\u0442\u0435\u0436 (`()`) }  \/\/ \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 `not-existing-file.txt` \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \/\/    Err(Os { code: 2, kind: NotFound, message: \"No such file or directory\" }) \/\/ \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \/\/    Error: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"kombinatory-combinators\">\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b (combinators)<\/h2>\n<p>  <\/p>\n<h4 id=\"chto-takoe-kombinator\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440?<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0434\u043d\u043e \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043b\u043e\u0432\u0430 &#171;\u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440&#187; \u2014 \u044d\u0442\u043e \u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0430 (combinator pattern), \u0441\u0442\u0438\u043b\u044e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 \u0438\u0434\u0435\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0449\u0435\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0438\u043f <code>T<\/code>, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f &#171;\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <code>T<\/code> \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 &#171;\u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <code>T<\/code> \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <code>T<\/code>. <a href=\"https:\/\/wiki.haskell.org\/Combinator\">\u0414\u0440\u0443\u0433\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/a> \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e &#171;\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0435\u0437 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (free variables)&#187;<\/li>\n<li>\u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u0438\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u0435\u0442\u0430\u043b\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e (John Hughes)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 <code>Rust<\/code> \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>or()<\/code>, <code>and()<\/code>, <code>or_else()<\/code>, <code>and_then()<\/code> \u2014 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044e\u0442 \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <code>T<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>T<\/code><\/li>\n<li><code>filter()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Option<\/code><br \/> \n<ul>\n<li>\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <code>T<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<li>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>T<\/code><\/li>\n<\/ul>\n<\/li>\n<li><code>map()<\/code>, <code>map_err()<\/code><br \/> \n<ul>\n<li>\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442 \u0442\u0438\u043f <code>T<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f<\/li>\n<li>\u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 <code>T<\/code> \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>Some&lt;&amp;str><\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c <code>Some&lt;usize><\/code>, \u0430 <code>Err&lt;&amp;str><\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c <code>Err&lt;isize><\/code> \u0438 \u0442.\u0434.<\/li>\n<\/ul>\n<\/li>\n<li><code>map_or()<\/code>, <code>map_or_else()<\/code><br \/> \n<ul>\n<li>\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0442\u0438\u043f <code>T<\/code>, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u043a \u043d\u0435\u043c\u0443 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>T<\/code><\/li>\n<li>\u0434\u043b\u044f <code>None<\/code> \u0438 <code>Err<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e<\/li>\n<li><code>ok_or()<\/code>, <code>ok_or_else()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Option<\/code> \u2014 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0442\u0438\u043f <code>Option<\/code> \u0432 \u0442\u0438\u043f <code>Result<\/code><\/li>\n<\/ul>\n<\/li>\n<li><code>as_ref()<\/code>, <code>as_mut()<\/code> \u2014 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0442\u0438\u043f <code>T<\/code> \u0432 \u0441\u0441\u044b\u043b\u043a\u0443 \u0438\u043b\u0438 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"or-i-and\">or() \u0438 and()<\/h4>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044e\u0442 \u0434\u0432\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 <code>Option<\/code>\/<code>Result<\/code><\/p>\n<p>  <\/p>\n<ul>\n<li><code>or()<\/code> \u2014 \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Some<\/code> \u0438\u043b\u0438 <code>Ok<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443<\/li>\n<li><code>and()<\/code> \u2014 \u0435\u0441\u043b\u0438 \u043e\u0431\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <code>Some<\/code> \u0438\u043b\u0438 <code>Ok<\/code>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>None<\/code> \u0438\u043b\u0438 <code>Err<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {   let s1 = Some(\"some1\");   let s2 = Some(\"some2\");   let n: Option&lt;&amp;str> = None;    let o1: Result&lt;&amp;str, &amp;str> = Ok(\"ok1\");   let o2: Result&lt;&amp;str, &amp;str> = Ok(\"ok2\");   let e1: Result&lt;&amp;str, &amp;str> = Err(\"error1\");   let e2: Result&lt;&amp;str, &amp;str> = Err(\"error2\");    assert_eq!(s1.or(s2), s1); \/\/ Some1 or Some2 = Some1   assert_eq!(s1.or(n), s1);  \/\/ Some or None = Some   assert_eq!(n.or(s1), s1);  \/\/ None or Some = Some   assert_eq!(n.or(n), n);    \/\/ None1 or None2 = None2    assert_eq!(o1.or(o2), o1); \/\/ Ok1 or Ok2 = Ok1   assert_eq!(o1.or(e1), o1); \/\/ Ok or Err = Ok   assert_eq!(e1.or(o1), o1); \/\/ Err or Ok = Ok   assert_eq!(e1.or(e2), e2); \/\/ Err1 or Err2 = Err2    assert_eq!(s1.and(s2), s2); \/\/ Some1 and Some2 = Some2   assert_eq!(s1.and(n), n);   \/\/ Some and None = None   assert_eq!(n.and(s1), n);   \/\/ None and Some = None   assert_eq!(n.and(n), n);    \/\/ None1 and None2 = None1    assert_eq!(o1.and(o2), o2); \/\/ Ok1 and Ok2 = Ok2   assert_eq!(o1.and(e1), e1); \/\/ Ok and Err = Err   assert_eq!(e1.and(o1), e1); \/\/ Err and Ok = Err   assert_eq!(e1.and(e2), e1); \/\/ Err1 and Err2 = Err1 }<\/code><\/pre>\n<p>  <\/p>\n<p><code>Rust<\/code> \u043d\u043e\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>xor()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Option<\/code>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 <code>Some<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Some<\/code>, \u043d\u043e \u043d\u0435 \u043e\u0431\u0430.<\/p>\n<p>  <\/p>\n<h4 id=\"or_else\">or_else()<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>or()<\/code>, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ or_else c Option     let s1 = Some(\"some1\");     let s2 = Some(\"some2\");     let fn_some = || Some(\"some2\"); \/\/ \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430: let fn_some = || -> Option&lt;&amp;str> { Some(\"some2\") };      let n: Option&lt;&amp;str> = None;     let fn_none = || None;      assert_eq!(s1.or_else(fn_some), s1);  \/\/ Some1 or_else Some2 = Some1     assert_eq!(s1.or_else(fn_none), s1);  \/\/ Some or_else None = Some     assert_eq!(n.or_else(fn_some), s2);   \/\/ None or_else Some = Some     assert_eq!(n.or_else(fn_none), None); \/\/ None1 or_else None2 = None2      \/\/ or_else \u0441 Result     let o1: Result&lt;&amp;str, &amp;str> = Ok(\"ok1\");     let o2: Result&lt;&amp;str, &amp;str> = Ok(\"ok2\");     let fn_ok = |_| Ok(\"ok2\"); \/\/ \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430: let fn_ok = |_| -> Result&lt;&amp;str, &amp;str> { Ok(\"ok2\") };      let e1: Result&lt;&amp;str, &amp;str> = Err(\"error1\");     let e2: Result&lt;&amp;str, &amp;str> = Err(\"error2\");     let fn_err = |_| Err(\"error2\");      assert_eq!(o1.or_else(fn_ok), o1);  \/\/ Ok1 or_else Ok2 = Ok1     assert_eq!(o1.or_else(fn_err), o1); \/\/ Ok or_else Err = Ok     assert_eq!(e1.or_else(fn_ok), o2);  \/\/ Err or_else Ok = Ok     assert_eq!(e1.or_else(fn_err), e2); \/\/ Err1 or_else Err2 = Err2 }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"and_then\">and_then()<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>and()<\/code>, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ and_then c Option     let s1 = Some(\"some1\");     let s2 = Some(\"some2\");     let fn_some = |_| Some(\"some2\"); \/\/ \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430: let fn_some = |_| -> Option&lt;&amp;str> { Some(\"some2\") };      let n: Option&lt;&amp;str> = None;     let fn_none = |_| None;      assert_eq!(s1.and_then(fn_some), s2); \/\/ Some1 and_then Some2 = Some2     assert_eq!(s1.and_then(fn_none), n);  \/\/ Some and_then None = None     assert_eq!(n.and_then(fn_some), n);   \/\/ None and_then Some = None     assert_eq!(n.and_then(fn_none), n);   \/\/ None1 and_then None2 = None1      \/\/ and_then \u0441 Result     let o1: Result&lt;&amp;str, &amp;str> = Ok(\"ok1\");     let o2: Result&lt;&amp;str, &amp;str> = Ok(\"ok2\");     let fn_ok = |_| Ok(\"ok2\"); \/\/ \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430: let fn_ok = |_| -> Result&lt;&amp;str, &amp;str> { Ok(\"ok2\") };      let e1: Result&lt;&amp;str, &amp;str> = Err(\"error1\");     let e2: Result&lt;&amp;str, &amp;str> = Err(\"error2\");     let fn_err = |_| Err(\"error2\");      assert_eq!(o1.and_then(fn_ok), o2);  \/\/ Ok1 and_then Ok2 = Ok2     assert_eq!(o1.and_then(fn_err), e2); \/\/ Ok and_then Err = Err     assert_eq!(e1.and_then(fn_ok), e1);  \/\/ Err and_then Ok = Err     assert_eq!(e1.and_then(fn_err), e1); \/\/ Err1 and_then Err2 = Err1 }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"filter\">filter()<\/h4>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>filter()<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c \u0438\u043b\u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\/\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0443\u0442\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\/\u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f. <code>Rust<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"https:\/\/doc.rust-lang.org\/std\/iter\/trait.Iterator.html#method.filter\">filter()<\/a> \u043a\u0430\u043a \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 (iterator adapter) \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440. \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0435 <code>filter()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Option<\/code>.<\/p>\n<p>  <\/p>\n<p><code>Some<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code>, \u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0443\u043b\u043e \u0434\u043b\u044f \u043d\u0435\u0433\u043e <code>true<\/code>. <code>None<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e <code>None<\/code> \u0438\u043b\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0443\u043b\u043e <code>false<\/code>. \u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code> \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442. <code>Rust<\/code> \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>filter()<\/code> \u0434\u043b\u044f <code>Result<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let s1 = Some(3);     let s2 = Some(6);     let n = None;      let fn_is_even = |x: &amp;i8| x % 2 == 0;      assert_eq!(s1.filter(fn_is_even), n);  \/\/ Some(3) -> 3 \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435 -> None     assert_eq!(s2.filter(fn_is_even), s2); \/\/ Some(6) -> 6 \u0447\u0435\u0442\u043d\u043e\u0435 -> Some(6)     assert_eq!(n.filter(fn_is_even), n);   \/\/ None -> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 -> None }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"map-i-map_err\">map() \u0438 map_err()<\/h4>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>map()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0438\u043b\u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\/\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430. <code>Rust<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"https:\/\/doc.rust-lang.org\/std\/iter\/trait.Iterator.html#method.map\">map()<\/a> \u043a\u0430\u043a \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 (iterator adapter) \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440. \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0435 <code>filter()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Option<\/code> \u0438 <code>Result<\/code>.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>map()<\/code> \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f <code>T<\/code>, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435. \u0422\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 <code>Some<\/code> \u0438\u043b\u0438 <code>Ok<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u043c\u0443 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0443: <code>Option&lt;T><\/code> -> <code>Option&lt;U><\/code>, <code>Result&lt;T, E><\/code> -> <code>Result&lt;U, E><\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>map()<\/code> \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>Some<\/code> \u0438 <code>Ok<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>Err<\/code> \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f (<code>None<\/code> \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f).<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let s1 = Some(\"abcde\");     let s2 = Some(5);      let n1: Option&lt;&amp;str> = None;     let n2: Option&lt;usize> = None;      let o1: Result&lt;&amp;str, &amp;str> = Ok(\"abcde\");     let o2: Result&lt;usize, &amp;str> = Ok(5);      let e1: Result&lt;&amp;str, &amp;str> = Err(\"abcde\");     let e2: Result&lt;usize, &amp;str> = Err(\"abcde\");      let fn_character_count = |s: &amp;str| s.chars().count();      assert_eq!(s1.map(fn_character_count), s2); \/\/ Some1 map = Some2     assert_eq!(n1.map(fn_character_count), n2); \/\/ None1 map = None2      assert_eq!(o1.map(fn_character_count), o2); \/\/ Ok1 map = Ok2     assert_eq!(e1.map(fn_character_count), e2); \/\/ Err1 map = Err2 }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>map_err()<\/code> \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>Result<\/code> \u2014 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 <code>Err<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u043c\u0443 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0443: <code>Result&lt;T, E><\/code> -> <code>Result&lt;T, F><\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>map_err()<\/code> \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>Err<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>Ok<\/code> \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let o1: Result&lt;&amp;str, &amp;str> = Ok(\"abcde\");     let o2: Result&lt;&amp;str, isize> = Ok(\"abcde\");      let e1: Result&lt;&amp;str, &amp;str> = Err(\"404\");     let e2: Result&lt;&amp;str, isize> = Err(404);      let fn_character_count = |s: &amp;str| -> isize { s.parse().unwrap() }; \/\/ \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 str \u0432 isize      assert_eq!(o1.map_err(fn_character_count), o2); \/\/ Ok1 map = Ok2     assert_eq!(e1.map_err(fn_character_count), e2); \/\/ Err1 map = Err2 }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"map_or-i-map_or_else\">map_or() \u0438 map_or_else()<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>unwrap_or()<\/code> \u0438 <code>unwrap_or_else()<\/code>? \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430 \u043d\u0438\u0445 \u043f\u043e\u0445\u043e\u0436\u0438. \u041e\u0434\u043d\u0430\u043a\u043e <code>map_or()<\/code> \u0438 <code>map_or_else()<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c <code>Some<\/code> \u0438 <code>Ok<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>map_or()<\/code> \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <code>Option<\/code> (\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f <code>Result<\/code>). \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>Some<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0414\u043b\u044f <code>None<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     const V_DEFAULT: i8 = 1;      let s = Some(10);     let n: Option&lt;i8> = None;     let fn_closure = |v: i8| v + 2;      assert_eq!(s.map_or(V_DEFAULT, fn_closure), 12);     assert_eq!(n.map_or(V_DEFAULT, fn_closure), V_DEFAULT); }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>map_or_else()<\/code> \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u043b\u044f <code>Option<\/code>, \u0438 \u0434\u043b\u044f <code>Result<\/code> (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u043e\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <code>Rust<\/code>). \u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>map_or()<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0438\u043f\u044b <code>None<\/code> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f <code>Option<\/code> \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f. \u041d\u043e \u0442\u0438\u043f\u044b <code>Err<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f <code>Result<\/code> \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">#![feature(result_map_or_else)] \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 'result_map_or_else' \u0432 \u043d\u043e\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Rust fn main() {     let s = Some(10);     let n: Option&lt;i8> = None;      let fn_closure = |v: i8| v + 2;     let fn_default = || 1; \/\/ `None` \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435      assert_eq!(s.map_or_else(fn_default, fn_closure), 12);     assert_eq!(n.map_or_else(fn_default, fn_closure), 1);      let o = Ok(10);     let e = Err(5);     let fn_default_for_result = |v: i8| v + 1; \/\/ `Err` \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044e      assert_eq!(o.map_or_else(fn_default_for_result, fn_closure), 12);     assert_eq!(e.map_or_else(fn_default_for_result, fn_closure), 6); }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"ok_or-i-ok_or_else\">ok_or() \u0438 ok_or_else()<\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e \u0440\u0430\u043d\u0435\u0435, <code>ok_or()<\/code> \u0438 <code>ok_or_else()<\/code> \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0442\u0438\u043f <code>Option<\/code> \u0432 \u0442\u0438\u043f <code>Result<\/code>: <code>Some<\/code> \u0432 <code>Ok<\/code>, \u0430 <code>None<\/code> \u0432 <code>Err<\/code>.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>ok_or()<\/code> \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0434\u043b\u044f <code>Err<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     const ERR_DEFAULT: &amp;str = \"error message\";      let s = Some(\"abcde\");     let n: Option&lt;&amp;str> = None;      let o: Result&lt;&amp;str, &amp;str> = Ok(\"abcde\");     let e: Result&lt;&amp;str, &amp;str> = Err(ERR_DEFAULT);      assert_eq!(s.ok_or(ERR_DEFAULT), o); \/\/ Some(T) -> Ok(T)     assert_eq!(n.ok_or(ERR_DEFAULT), e); \/\/ None -> Err(default) }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>ok_or_else()<\/code> \u2014 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>ok_or()<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">fn main() {     let s = Some(\"abcde\");     let n: Option&lt;&amp;str> = None;     let fn_err_message = || \"error message\";      let o: Result&lt;&amp;str, &amp;str> = Ok(\"abcde\");     let e: Result&lt;&amp;str, &amp;str> = Err(\"error message\");      assert_eq!(s.ok_or_else(fn_err_message), o); \/\/ Some(T) -> Ok(T)     assert_eq!(n.ok_or_else(fn_err_message), e); \/\/ None -> Err(default) }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"as_ref-i-as_mut\">as_ref() \u0438 as_mut()<\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f (borrow) \u0442\u0438\u043f\u0430 <code>T<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u043b\u0438 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>as_ref()<\/code> \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 <code>Option&lt;T><\/code> \u0432 <code>Option&lt;&amp;T><\/code>, \u0430 <code>Result&lt;T, E><\/code> \u0432 <code>Result&lt;&amp;T, &amp;E><\/code><\/li>\n<li><code>as_mut()<\/code> \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 <code>Option&lt;T><\/code> \u0432 <code>Option&lt;&amp;mut T><\/code>, \u0430 <code>Result&lt;T, E><\/code> \u0432 <code>Result&lt;&amp;mut T, &amp;mut E><\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"kastomnye-tipy-oshibki\">\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0448\u0438\u0431\u043a\u0438<\/h2>\n<p>  <\/p>\n<p><code>Rust<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b <code>Err<\/code>. \u041c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u0445 &#171;\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0438&#187; (custom error types).<\/p>\n<p>  <\/p>\n<h4 id=\"treyt-error\">\u0422\u0440\u0435\u0439\u0442 Error<\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0442\u0440\u0435\u0439\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u043a\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0438\u043f. \u041d\u043e \u043d\u0430\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0442\u0440\u0435\u0439\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>Rust<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0440\u0435\u0439\u0442\u044b \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0438\u0445 \u0442\u0438\u043f\u0430\u0445. \u0414\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0442\u0438\u043f <code>Err<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0440\u0435\u0439\u0442 <a href=\"https:\/\/doc.rust-lang.org\/std\/error\/trait.Error.html\">std::error::Error<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fmt::{Debug, Display};  pub trait Error: Debug + Display {     fn source(&amp;self) -> Option&lt;&amp;(Error + 'static)> { ... } }<\/code><\/pre>\n<p>  <\/p>\n<p><code>trait Error: Debug + Display<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0442\u0440\u0435\u0439\u0442 <code>Error<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442 \u0442\u0440\u0435\u0439\u0442\u043e\u0432 <code>fmt::Debug<\/code> \u0438 <code>fmt::Display<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">pub trait Display {     fn fmt(&amp;self, f: &amp;mut Formatter) -> Result&lt;(), Error>; }  pub trait Debug {     fn fmt(&amp;self, f: &amp;mut Formatter) -> Result&lt;(), Error>; }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>Display<\/code><br \/> \n<ul>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u0430\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\/\u0432\u044b\u0432\u043e\u0434, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>println!(\"{}\")<\/code> \u0438\u043b\u0438 <code>eprintln!(\"{}\")<\/code> (<code>print<\/code> \u2014 \u044d\u0442\u043e <code>stdin<\/code>, <code>eprint<\/code> \u2014 <code>stderr<\/code>)<\/li>\n<\/ul>\n<\/li>\n<li><code>Debug<\/code><br \/> \n<ul>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435\/\u0432\u044b\u0432\u043e\u0434\u0435, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430<\/li>\n<li>\u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>println!(\"{:?}\")<\/code> \u0438\u043b\u0438 <code>eprintln!(\"{:?}\")<\/code><\/li>\n<li>\u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u043f\u0435\u0447\u0430\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>println!(\"{:#?}\")<\/code> \u0438\u043b\u0438 <code>eprintln!(\"{:#?}\")<\/code><\/li>\n<\/ul>\n<\/li>\n<li><code>source()<\/code><br \/> \n<ul>\n<li>\u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043e\u0448\u0438\u0431\u043a\u0438, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f<\/li>\n<li>\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>std::error::Error<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fmt;  \/\/ \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438; \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u0440\u0435\u0439\u0442\u0435. \/\/ \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 struct AppError;  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c `std::fmt::Display` \u0434\u043b\u044f `AppError` impl fmt::Display for AppError {     fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -> fmt::Result {         write!(f, \"An Error Occurred, Please Try Again!\") \/\/ user-facing output     } }  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c `std::fmt::Debug` \u0434\u043b\u044f `AppError` impl fmt::Debug for AppError {     fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -> fmt::Result {         write!(f, \"{{ file: {}, line: {} }}\", file!(), line!()) \/\/ programmer-facing output     } }  \/\/ \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 `AppError` fn produce_error() -> Result&lt;(), AppError> {     Err(AppError) }  fn main() {     match produce_error() {         Err(e) => eprintln!(\"{}\", e), \/\/ An Error Occurred, Please Try Again!         _ => println!(\"No error\"),     }      eprintln!(\"{:?}\", produce_error()); \/\/ Err({ file: src\/main.rs, line: 17 }) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c \u043e\u0448\u0438\u0431\u043a\u0438 (<code>code<\/code>) \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 (<code>message<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fmt;  struct AppError {     code: usize,     message: String, }  \/\/ \u0420\u0430\u0437\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 `AppError.code` impl fmt::Display for AppError {     fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -> fmt::Result {         let err_msg = match self.code {             404 => \"Sorry, Cannot find the Page!\",             _ => \"Sorry, something is wrong! Please Try Again!\",         };          write!(f, \"{}\", err_msg)     } }  \/\/ \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 impl fmt::Debug for AppError {     fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -> fmt::Result {         write!(             f,             \"AppError {{ code: {}, message: {} }}\",             self.code, self.message         )     } }  fn produce_error() -> Result&lt;(), AppError> {     Err(AppError {         code: 404,         message: String::from(\"Page not found\"),     }) }  fn main() {     match produce_error() {         Err(e) => eprintln!(\"{}\", e), \/\/ Sorry, Cannot find the Page!         _ => println!(\"No error\"),     }      eprintln!(\"{:?}\", produce_error()); \/\/ Err(AppError { code: 404, message: Page not found })      eprintln!(\"{:#?}\", produce_error());     \/\/ Err(     \/\/     AppError { code: 404, message: Page not found }     \/\/ ) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>Rust<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0442\u0440\u0435\u0439\u0442\u044b, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0440\u0435\u0439\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>#[derive]<\/code>. <code>Rust<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>derive std::fmt::Debug<\/code> \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0442\u043b\u0430\u0434\u043a\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>std::fmt::Debug<\/code> \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>#[derive(Debug)]<\/code> \u043f\u0435\u0440\u0435\u0434 <code>struct<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fmt;  #[derive(Debug)] \/\/ \u0432\u044b\u0432\u043e\u0434\u0438\u043c `std::fmt::Debug` \u0434\u043b\u044f `AppError` struct AppError {     code: usize,     message: String, }  impl fmt::Display for AppError {     fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -> fmt::Result {         let err_msg = match self.code {             404 => \"Sorry, Cannot find the Page!\",             _ => \"Sorry, something is wrong! Please Try Again!\",         };          write!(f, \"{}\", err_msg)     } }  fn produce_error() -> Result&lt;(), AppError> {     Err(AppError {         code: 404,         message: String::from(\"Page not found\"),     }) }  fn main() {     match produce_error() {         Err(e) => eprintln!(\"{}\", e), \/\/ Sorry, Cannot find the Page!         _ => println!(\"No error\"),     }      eprintln!(\"{:?}\", produce_error()); \/\/ Err(AppError { code: 404, message: Page not found })      eprintln!(\"{:#?}\", produce_error());     \/\/ Err(     \/\/     AppError {     \/\/         code: 404,     \/\/         message: \"Page not found\"     \/\/     }     \/\/ ) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f <code>struct<\/code> <code>#[derive(Debug)]<\/code> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<p>  <\/p>\n<h4 id=\"treyt-from\">\u0422\u0440\u0435\u0439\u0442 From<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0440\u0430\u0437\u043d\u044b\u043c\u0438 <code>std<\/code> \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0440\u0435\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0438 \u0442\u0438\u043f\u044b \u043e\u0448\u0438\u0431\u043e\u043a. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043d\u0430\u0448 \u0442\u0438\u043f. \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 <code>std::convert::From<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">pub trait From&lt;T>: Sized {   fn from(_: T) -> Self; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>String::from()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>String<\/code> \u0438\u0437 <code>&amp;str<\/code>. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0440\u0435\u0439\u0442\u0430 <code>std::convert::From<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>std::convert::From<\/code> \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fs::File; use std::io;  #[derive(Debug)] struct AppError {     kind: String,    \/\/ \u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438     message: String, \/\/ \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 }  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f `std::convert::From` \u0434\u043b\u044f `AppError`; \u0438\u0437 `io::Error` impl From&lt;io::Error> for AppError {     fn from(error: io::Error) -> Self {         AppError {             kind: String::from(\"io\"),             message: error.to_string(),         }     } }  fn main() -> Result&lt;(), AppError> {     let _file = File::open(\"nonexistent_file.txt\")?; \/\/ \u044d\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 `io::Error`, \u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f `Result&lt;(), AppError>`, `io::Error` \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 `AppError`      Ok(()) }  \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime error) \/\/ Error: AppError { kind: \"io\", message: \"No such file or directory (os error 2)\" }<\/code><\/pre>\n<p>  <\/p>\n<p><code>File::open(\"nonexistent.txt\")?<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <code>io::Error<\/code>, \u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Result&lt;(), AppError><\/code>, <code>io::Error<\/code> \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 <code>AppError<\/code>. \u0418\u0437-\u0437\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main()<\/code> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 (<code>Debug<\/code>) \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>Err<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">use std::fs::File; use std::io::{self, Read}; use std::num;  #[derive(Debug)] struct AppError {     kind: String,     message: String, }  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f `std::convert::From` \u0434\u043b\u044f `AppError`; \u0438\u0437 `io::Error` impl From&lt;io::Error> for AppError {     fn from(error: io::Error) -> Self {         AppError {             kind: String::from(\"io\"),             message: error.to_string(),         }     } }  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f `std::convert::From` \u0434\u043b\u044f `AppError`; \u0438\u0437 `num::ParseIntError` impl From&lt;num::ParseIntError> for AppError {     fn from(error: num::ParseIntError) -> Self {         AppError {             kind: String::from(\"parse\"),             message: error.to_string(),         }     } }  fn main() -> Result&lt;(), AppError> {     let mut file = File::open(\"hello_world.txt\")?; \/\/ \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f `io::Error`, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 `AppError`      let mut content = String::new();     file.read_to_string(&amp;mut content)?; \/\/ \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f `io::Error`, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 `AppError`      let _number: usize;     _number = content.parse()?; \/\/ \u0435\u0441\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043e \u0432 `usize`, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f `num::ParseIntError`, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 `AppError`      Ok(()) }  \/\/ \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f  \/\/ \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u0430 `hello_world.txt` \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \/\/ Error: AppError { kind: \"io\", message: \"No such file or directory (os error 2)\" }  \/\/ \u0415\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443 `hello_world.txt` \/\/ Error: AppError { kind: \"io\", message: \"Permission denied (os error 13)\" }  \/\/ \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b `hello_world.txt` \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \"Hello, world!\" \/\/ Error: AppError { kind: \"parse\", message: \"invalid digit found in string\" }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0446 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438, \u0432 \u0446\u0435\u043b\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>Happy coding!<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p><a href=\"https:\/\/timeweb.cloud\/vds-vps?utm_source=habr&amp;utm_medium=banner&amp;utm_campaign\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/b5\/pj\/of\/b5pjofdoxth14ro-rjsrn7sbmiy.png\" data-src=\"https:\/\/habrastorage.org\/webt\/b5\/pj\/of\/b5pjofdoxth14ro-rjsrn7sbmiy.png\"\/><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/787924\/\"> https:\/\/habr.com\/ru\/articles\/787924\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fj\/yi\/qn\/fjyiqnduv3l-rdgxnbu_t_qpgxk.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fj\/yi\/qn\/fjyiqnduv3l-rdgxnbu_t_qpgxk.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>Hello world!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438 \u043f\u043e <a href=\"https:\/\/www.rust-lang.org\/ru\/\">Rust<\/a>.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/785096\/\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/my-js.org\/docs\/cheatsheet\/rust\/\">\u0414\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u044e\u0442 \u043b\u044e\u0431\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u043d\u0435 \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0442\u044c ?<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/doc.rust-lang.ru\/book\/\">\u0423\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u043e Rust<\/a> (\u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-365911","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=365911"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365911\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=365911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=365911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=365911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}