{"id":232829,"date":"2014-08-12T02:37:03","date_gmt":"2014-08-11T22:37:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=232829"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=232829","title":{"rendered":"<span class=\"post_title\">Rust \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445. \u0427\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       \u042d\u0442\u043e\u0442 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043a\u043d\u0438\u0433\u0438 \u00abRust by Example\u00bb, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0438\u0448\u0435\u0442 \u0425\u043e\u0440\u0445\u0435 \u0410\u043f\u0430\u0440\u0438\u0441\u0438\u043e \u043d\u0430 Github.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430 \u0430\u0432\u0442\u043e\u0440 \u043a\u043d\u0438\u0433\u0438 \u0441\u043e\u0437\u0434\u0430\u043b 49 \u0433\u043b\u0430\u0432, \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u044f\u0442\u0438. \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e Rust <a href=\"http:\/\/www.rust-lang.org\/install.html\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d<\/a> \u0438 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f <a href=\"http:\/\/doc.rust-lang.org\/std\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>. <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c!<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4><b>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/b><\/h4>\n<p>  <\/p>\n<ol>\n<li><a href=\"#hello_world\">\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0438\u0440!<\/a><\/li>\n<li><a href=\"#format_print\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434<\/a><\/li>\n<li><a href=\"#literals\">\u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/a><\/li>\n<li><a href=\"#vars\">\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/a><\/li>\n<li><a href=\"#types\">\u0422\u0438\u043f\u044b<\/a><\/li>\n<\/ol>\n<p>  <\/p>\n<blockquote><p><b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b>  <\/p>\n<ol>\n<li>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 Nightly (0.10), \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e \u044d\u0442\u043e.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0432 Rust Playpen: <a href=\"http:\/\/play.rust-lang.org\/\">http:\/\/play.rust-lang.org<\/a><\/li>\n<\/ol>\n<\/blockquote>\n<p>  <a name=\"hello_world\"><\/a><\/p>\n<h4><b>1. \u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0438\u0440!<\/b><\/h4>\n<p>  \u042d\u0442\u043e \u043a\u043e\u0434 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u00abHello World\u00bb:  <\/p>\n<pre><code class=\"rust\">\/\/ \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c  \/\/ \u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f fn main() {     \/\/ \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c     println!(&quot;Hello World!&quot;); } <\/code><\/pre>\n<p>  <code>println!<\/code> \u044d\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441 (\u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0445 \u043f\u043e\u0437\u0436\u0435), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 Rust <b>rustc<\/b>:  <\/p>\n<pre><code class=\"bash\">$ rustc hello.rs <\/code><\/pre>\n<p>  <b>rustc<\/b> \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u00abhello\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c:  <\/p>\n<pre><code class=\"bash\">$ .\/hello Hello World! <\/code><\/pre>\n<p>  <a name=\"format_print\"><\/a><\/p>\n<h4><b>2. \u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434<\/b><\/h4>\n<p>  \u041c\u0430\u043a\u0440\u043e\u0441 <code>println!<\/code> \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ `print!`, \u043a\u0430\u043a `println!`, \u043d\u043e \u043e\u043d \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435     print!(&quot;January has &quot;);      \/\/ `{}` \u044d\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438     println!(&quot;{} days&quot;, 31i);     \/\/ `i` \u0441\u0443\u0444\u0444\u0438\u043a\u0441 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f: \u0446\u0435\u043b\u043e\u0435     \/\/ \u0447\u0438\u0441\u043b\u043e \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0433\u043b\u0430\u0432\u0443 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438      \/\/ \u041f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443     println!(&quot;{0}, this is {1}. {1}, this is {0}&quot;, &quot;Alice&quot;, &quot;Bob&quot;);      \/\/ \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c     println!(&quot;{subject} {verb} {predicate}&quot;,              predicate=&quot;over the lazy dog&quot;,              subject=&quot;the quick brown fox&quot;,              verb=&quot;jumps&quot;);      \/\/ \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435 \u043f\u043e\u0441\u043b\u0435 `:`, `t` \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435     println!(&quot;{} of {:t} people know binary, the other half don't&quot;, 1i, 2i);      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430     println!(&quot;My name is {0}, {1} {0}&quot;, &quot;Bond&quot;);     \/\/ \u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 ^ \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442: &quot;James&quot; } <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/doc.rust-lang.org\/std\/fmt\/\">std\u200b::fmt\u200b<\/a><\/p>\n<p>  <a name=\"literals\"><\/a><\/p>\n<h4><b>3. \u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/b><\/h4>\n<p>  \u0426\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 <b>1<\/b>, \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 <b>1.2<\/b>, \u0441\u0438\u043c\u0432\u043e\u043b\u044b <b>&#8216;a&#8217;<\/b>, \u0441\u0442\u0440\u043e\u043a\u0438 <code>&quot;abc&quot;<\/code>, \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 <b>true<\/b> \u0438 \u0431\u043b\u043e\u0447\u043d\u044b\u0435 <b> ()<\/b> \u0442\u0438\u043f\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0435, \u0432\u043e\u0441\u044c\u043c\u0435\u0440\u0438\u0447\u043d\u043e\u0435 \u0438\u043b\u0438 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432: <b>0x<\/b>, <b>0o <\/b> \u0438\u043b\u0438 <b>0b<\/b>.<\/p>\n<p>  \u0412 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <b>1_000<\/b> \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 <b>1000<\/b>, \u0430 <b>0.000_001<\/b> \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 <b>0.000001<\/b>.<\/p>\n<p>  \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>u<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430, \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>i<\/code> \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0442\u0438\u043f\u043e\u0432 \u0432 5 \u0433\u043b\u0430\u0432\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432.<\/p>\n<p>  \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438 \u0438\u0445 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 C-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u0426\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435     println!(&quot;1 + 2 = {}&quot;, 1u + 2);      \/\/ \u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435     println!(&quot;1 - 2 = {}&quot;, 1i - 2);     \/\/ \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c `1i` \u043d\u0430 `1u` \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0438\u043f \u0432\u0430\u0436\u0435\u043d      \/\/ \u0411\u0443\u043b\u0435\u0432\u0430 \u043b\u043e\u0433\u0438\u043a\u0430     println!(&quot;true AND false is {}&quot;, true && false);     println!(&quot;true OR false is {}&quot;, true || false);     println!(&quot;NOT true is {}&quot;, !true);      \/\/ \u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438     println!(&quot;0011 AND 0101 is {:04t}&quot;, 0b0011u & 0b0101);     println!(&quot;0011 OR 0101 is {:04t}&quot;, 0b0011u | 0b0101);     println!(&quot;0011 XOR 0101 is {:04t}&quot;, 0b0011u ^ 0b0101);     println!(&quot;1 &lt;&lt; 5 is {}&quot;, 1u &lt;&lt; 5);     println!(&quot;0x80 &gt;&gt; 2 is 0x{:x}&quot;, 0x80u &gt;&gt; 2);      \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c     println!(&quot;One million is written as {}&quot;, 1_000_000u); } <\/code><\/pre>\n<p>  <a name=\"vars\"><\/a><\/p>\n<h4><b>4. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/b><\/h4>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u043a\u0430\u043a \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b) \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>let<\/b>.<\/p>\n<pre><code class=\"rust\">fn main() {     let an_integer = 1u;     let a_boolean = true;     let unit = ();      \/\/ \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 `an_integer` \u0432 `copied_integer`     let copied_integer = an_integer;      println!(&quot;An integer: {}&quot;, copied_integer);     println!(&quot;A boolean: {}&quot;, a_boolean);     println!(&quot;Meet the unit value: {}&quot;, unit);      \/\/ \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \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; \u044d\u0442\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e     \/\/ \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439     let _unused_variable = 3u;     let noisy_unused_variable = 2u;     \/\/ \u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 ^ \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 } <\/code><\/pre>\n<p>  <\/p>\n<h5><b>4.1 \u0418\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c<\/b><\/h5>\n<p>  \u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <b>mut<\/b>.<\/p>\n<pre><code class=\"rust\">fn main() {     let _immutable_variable = 1i;     let mut mutable_variable = 1i;      println!(&quot;Before mutation: {}&quot;, mutable_variable);      \/\/ \u041e\u043a     mutable_variable += 1;      println!(&quot;After mutation: {}&quot;, mutable_variable);      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430!     _immutable_variable += 1; } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438.<\/p>\n<h5><b>4.2 \u041e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c<\/b><\/h5>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0431\u043b\u043e\u043a\u0435 (\u0431\u043b\u043e\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0437\u0430\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0445 \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 <b>{}<\/b>). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0436\u0438\u0432\u0435\u0442 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main     let long_lived_variable = 1i;      \/\/ \u042d\u0442\u043e \u0431\u043b\u043e\u043a, \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u043d\u0435\u0436\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f     {         \/\/ \u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0431\u043b\u043e\u043a\u0435         let short_lived_variable = 2i;          println!(&quot;inner short: {}&quot;, short_lived_variable);          \/\/ \u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0432\u0438\u0434\u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         let long_lived_variable = 5_f32;          println!(&quot;inner long: {}&quot;, long_lived_variable);     }     \/\/ \u041a\u043e\u043d\u0435\u0446 \u0431\u043b\u043e\u043a\u0430      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430! `short_lived_variable` \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438     println!(&quot;outer short: {}&quot;, short_lived_variable);     \/\/ \u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 ^ \u0417\u0430\u043a\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443      println!(&quot;outer long: {}&quot;, long_lived_variable); } <\/code><\/pre>\n<p>  <\/p>\n<h5><b>4.3 \u00ab\u041f\u0435\u0440\u0432\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u00bb<\/b><\/h5>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u043f\u0435\u0440\u0432\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0437\u0436\u0435. \u041d\u043e \u044d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e     let a_variable;      {         let x = 2i;          \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e         a_variable = x * x;     }      println!(&quot;a variable: {}&quot;, a_variable);      let another_variable;      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439     println!(&quot;another variable: {}&quot;, another_variable);     \/\/ \u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 ^ \u0417\u0430\u043a\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443      another_variable = 1i;      println!(&quot;another variable: {}&quot;, another_variable); } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u0431\u044b \u043a \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c.<\/p>\n<p>  <a name=\"types\"><\/a><\/p>\n<h4><b>5. \u0422\u0438\u043f\u044b<\/b><\/h4>\n<p>  Rust \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432. \u0422\u0438\u043f\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u044d\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u0410\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439     let a_float: f64 = 1.0;      \/\/ \u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 `int`     let mut an_integer = 5i;      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430! \u0422\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c     an_integer = true; } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 Rust:  <\/p>\n<ul>\n<li>\u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430: <code>i8<\/code>, <code>i16<\/code>, <code>i32<\/code>, <code>i64<\/code> \u0438 <code>int<\/code> (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440)<\/li>\n<li>\u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430: <code>u8<\/code>, <code>u16<\/code>, <code>u32<\/code>, <code>u64<\/code> \u0438 <code>uint<\/code> (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440)<\/li>\n<li>\u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439: <code>f32<\/code>, <code>f64<\/code><\/li>\n<li><code>char<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f Unicode: <code>'a', '\u03b1'<\/code> \u0438 <code>'\u221e'<\/code> (4 \u0431\u0430\u0439\u0442\u0430 \u043a\u0430\u0436\u0434\u044b\u0439)<\/li>\n<li><code>bool<\/code> true \u0438\u043b\u0438 false<\/li>\n<li>\u0442\u0438\u043f \u0431\u043b\u043e\u043a\u0430 <code>()<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<h5><b>5.1 \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/b><\/h5>\n<p>  Rust \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 (coercion) \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438. \u041d\u043e, \u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 (casting) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <b>as<\/b>.<\/p>\n<pre><code class=\"rust\">fn main() {     let decimal = 65.4321_f32;      \/\/ \u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f     let integer: u8 = decimal;     \/\/ \u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 ^ \u0417\u0430\u043a\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443      \/\/ \u042f\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435     let integer = decimal as u8;     let character = integer as char;      println!(&quot;Casting: {} -&gt; {} -&gt; {}&quot;, decimal, integer, character); } <\/code><\/pre>\n<p>  <\/p>\n<h5><b>5.2 \u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b<\/b><\/h5>\n<p>  \u0412 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430\u0445 \u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0438\u043f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c <code>uint<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0439 \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>u<\/code> \u0438 <code>int<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>i<\/code>.<\/p>\n<p>  \u0422\u0438\u043f \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u0431\u0435\u0437 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430\u043c\u0438, \u0438\u0445 \u0432\u0438\u0434 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438     let x = 1u8;     let y = 2u;     let z = 3f32;      \/\/ \u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0431\u0435\u0437 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430, \u0438\u0445 \u0432\u0438\u0434 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f     let i = 1;     let f = 1.0;      \/\/ `size_of_val` \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445     println!(&quot;size of `x` in bytes: {}&quot;, std::mem::size_of_val(&x));     println!(&quot;size of `y` in bytes: {}&quot;, std::mem::size_of_val(&y));     println!(&quot;size of `z` in bytes: {}&quot;, std::mem::size_of_val(&z));     println!(&quot;size of `i` in bytes: {}&quot;, std::mem::size_of_val(&i));     println!(&quot;size of `f` in bytes: {}&quot;, std::mem::size_of_val(&f));      \/\/ \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (\u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0442\u0438\u043f) \u0434\u043b\u044f `i` \u0438 `f`     let _constraint_i = x + i;     let _constraint_f = z + f;     \/\/ \u0417\u0430\u043a\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 } <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043a\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b \u0440\u0430\u043d\u044c\u0448\u0435, \u0432\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439:  <\/p>\n<ul>\n<li><code>fun(&foo)<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0430 \u043d\u0435 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>fun(foo)<\/code>.<\/li>\n<li><code>std::mem::size_of_val<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438. \u041a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>size_of_val <\/code>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>mem<\/code>, \u0430 \u043c\u043e\u0434\u0443\u043b\u044c <code>mem <\/code>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u0440\u044d\u0439\u0442\u0435 <code>std<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h5><b>5.3 \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434<\/b><\/h5>\n<p>  \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u043c\u0451\u043d. \u0422\u0438\u043f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0442\u0438\u043f\u0430 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0412\u043e\u0442 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"rust\">fn main() {     \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e `elem` \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f `u8`     let elem = 5u8;      \/\/ \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 (\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432)     let mut vec = Vec::new();     \/\/ \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u044b\u0439 \u0442\u0438\u043f `vec`, \u043e\u043d     \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0435\u043a\u0442\u043e\u0440 `Vec&lt;_&gt;`      \/\/ \u0412\u0441\u0442\u0430\u0432\u0438\u043c `elem` \u0432 \u0432\u0435\u043a\u0442\u043e\u0440     vec.push(elem);     \/\/ \u0410\u0433\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e `vec` \u044d\u0442\u043e \u0432\u0435\u043a\u0442\u043e\u0440 `u8` (`Vec&lt;u8&gt;`)     \/\/ \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043a\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `vec.push(elem)`      println!(&quot;{}&quot;, vec); } <\/code><\/pre>\n<p>  \u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432 \u043a\u0430\u043a \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442!<\/p>\n<h5><b>5.4 \u041f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b (\u0430\u043b\u0438\u0430\u0441\u044b)<\/b><\/h5>\n<p>  \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>type<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0438\u043f\u0443. \u0422\u0438\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0441\u0442\u0438\u043b\u0435 CamelCase, \u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b: <code>uint<\/code>, <code>f32<\/code> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<pre><code class=\"rust\">\/\/ `NanoSecond` \u044d\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f `u64` type NanoSecond = u64; type Inch = u64;  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 #[allow(non_camel_case_types)] type uint64_t = u64; \/\/ \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442  fn main() {     \/\/ `NanoSecond` = `Inch` = `uint64_t` = `u64`     let nanoseconds: NanoSecond = 5 as uint64_t;     let inches: Inch = 2 as uint64_t;      \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b \u043d\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442     \/\/ \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430     println!(&quot;{} nanoseconds + {} inches = {} unit?&quot;,              nanoseconds,              inches,              nanoseconds + inches); } <\/code><\/pre>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432 \u044d\u0442\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0438\u043f <code>IoResult&lt;T&gt;<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u043c \u0442\u0438\u043f\u0430 <code>Result&lt;T, IoError&gt;<\/code>.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a google-\u0433\u0440\u0443\u043f\u043f\u0435: <a href=\"https:\/\/groups.google.com\/forum\/#!forum\/rust-russian\">Rust \u043f\u043e-\u0440\u0443\u0441\u0441\u043a\u0438<\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u044f\u0437\u044b\u043a\u0443.<\/p>\n<p>  <i>\u0412\u0441\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u043c\u043d\u0435 \u0432 \u043f\u043e\u0447\u0442\u0443.<\/i>   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/232829\/\"> http:\/\/habrahabr.ru\/post\/232829\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       \u042d\u0442\u043e\u0442 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043a\u043d\u0438\u0433\u0438 \u00abRust by Example\u00bb, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0438\u0448\u0435\u0442 \u0425\u043e\u0440\u0445\u0435 \u0410\u043f\u0430\u0440\u0438\u0441\u0438\u043e \u043d\u0430 Github.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430 \u0430\u0432\u0442\u043e\u0440 \u043a\u043d\u0438\u0433\u0438 \u0441\u043e\u0437\u0434\u0430\u043b 49 \u0433\u043b\u0430\u0432, \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u044f\u0442\u0438. \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e Rust <a href=\"http:\/\/www.rust-lang.org\/install.html\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d<\/a> \u0438 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f <a href=\"http:\/\/doc.rust-lang.org\/std\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>. <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c!  <\/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-232829","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/232829","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=232829"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/232829\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=232829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=232829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=232829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}