{"id":467931,"date":"2025-07-20T22:05:28","date_gmt":"2025-07-20T22:05:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=467931"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=467931","title":{"rendered":"<span>\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. Rust<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/910194\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0434\u0435\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/923178\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. \u0427\u0442\u043e \u0442\u0430\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c?<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. Rust<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0442\u0435\u043e\u0440\u0438\u044e: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0438 \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d Rust \u2014 \u044f\u0437\u044b\u043a \u0441 \u0431\u043e\u0433\u0430\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u2014 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<h2>\u0417\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c<\/h2>\n<p><strong>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0432 Rust \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a. <br \/>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <code>&amp;str<\/code> \u0438 <code>String<\/code>.<br \/><code>&amp;str<\/code> \u2014 \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u0440\u0435\u0437, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0443\u0447\u0435 \u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u043e \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f.<br \/><code>String<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f UTF-8 \u0431\u0430\u0439\u0442, \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f \u0432 \u043a\u0443\u0447\u0435. \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0432 Rust \u043d\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p><strong>\u0422\u0440\u0435\u0442\u0438\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"rust\">fn print_name(name: &amp;str) {     println!(\"Name is {name}\"); }  fn main() {     let name = String::from(\"Alex\");      print_name(&amp;name)); }<\/code><\/pre>\n<p>\u041d\u0443 \u043b\u0430\u0434\u043d\u043e \u0432 Java, \u043b\u0430\u0434\u043d\u043e \u0432 C#, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e String \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 str. \u041d\u043e \u0432 Rust \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442. \u041a\u0430\u043a \u0436\u0435 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 &amp;str \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 String?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u044f\u0432\u043d\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code class=\"rust\">impl ops::Deref for String {     type Target = str;      #[inline]     fn deref(&amp;self) -&gt; &amp;str {         self.as_str()     } }<\/code><\/pre>\n<p>\u0422\u0438\u043f <code>String<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>String<\/code> \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u0440\u0435\u0437, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"rust\">pub const fn as_str(&amp;self) -&gt; &amp;str {     unsafe { str::from_utf8_unchecked(self.vec.as_slice()) } }  pub const unsafe fn from_utf8_unchecked(v: &amp;[u8]) -&gt; &amp;str {     \/\/ \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0440\u0435\u0434 \u0431\u0430\u0439\u0442      \/\/ \u043c\u044b \u0444\u043e\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u043a \u0442\u0438\u043f\u0443 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0440\u0435\u0437\u0430     unsafe { mem::transmute(v) } } <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b:<\/p>\n<pre><code class=\"rust\">print_name(&amp;name); print_name(&amp;name.as_str());<\/code><\/pre>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0435. \u0412 Rust \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e: \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 (trait) \u0434\u043b\u044f \u0442\u0438\u043f\u0430: <\/p>\n<pre><code class=\"rust\">impl ops::Add&lt;Point&gt; for Point {     type Output = Point;      fn add(self, rhs: Point) -&gt; Self::Output {         Self {             x: self.x + rhs.x,             y: self.y + rhs.y,         }     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438: <\/p>\n<pre><code class=\"rust\">fn main() {     let point_a = Point { x: 3.4, y: 5.6 };     let point_b = Point { x: 1.4, y: 8.8 };      let point_c = point_a + point_b;      \/\/ Point { x: 4.8, y: 14.4 }     println!(\"{point_c:?}\") }<\/code><\/pre>\n<h2>\u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c<\/h2>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 Rust \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p><strong>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f<\/strong> \u2014 \u044d\u0442\u043e \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u043b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u043c \u043a\u0440\u0438\u0442\u0438\u0440\u0438\u0438 \u0442\u0438\u043f\u043e\u043c. \u0422\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0435 \u0438 \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"json\">Player -&gt; T:User -&gt; Player<\/code><\/pre>\n<p><strong>\u042d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f<\/strong> \u2014  \u044d\u0442\u043e \u0442\u0438\u043f, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0442\u0438\u043d\u043d\u0443\u044e \u043f\u0440\u0438\u0440\u043e\u0434\u0443 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0447\u0442\u043e \u0442\u043e\u0442 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c. \u0422\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0435 \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<pre><code class=\"kotlin\">Player -&gt; ?:User -&gt; ?:User<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code> \u0438 \u0442\u0438\u043f\u044b <code>Player<\/code> \u0438 <code>Admin<\/code>, \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"rust\">trait User {     fn id(&amp;self) -&gt; u32; }  #[derive(Debug)] struct Player {     id: u32,     games: Vec&lt;String&gt;, }  #[derive(Debug)] struct Admin {     id: u32,     permissions: Vec&lt;u8&gt;, }<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"rust\">fn universal&lt;T&gt;(user: &amp;T) -&gt; &amp;T where T: User {     \/\/ \u0442\u0438\u043f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d     let u: &amp;T = user;     \/\/ monomor::core::Player     println!(\"{}\", type_name_of_val(u));     println!(\"{}\", u.id());     u } let original_player: &amp;Player = universal(&amp;player);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0448\u0430\u0431\u043b\u043e\u043d <code>T<\/code> \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0438\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code>. \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0438\u043f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 <code>T<\/code>, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0432\u0435\u0440\u043d\u0443\u0432 <code>T<\/code>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 <code>Player<\/code>, \u0447\u0442\u043e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>T<\/code> \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <code>User<\/code>, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"rust\">fn existional(user: &amp;impl User) -&gt; &amp;impl User {     \/\/ \u0442\u0438\u043f \u0443\u0442\u0435\u0440\u044f\u043d, \u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0432\u043d\u043e     let u = user;     \/\/ monomor::core::Player     println!(\"{}\", type_name_of_val(u));     println!(\"{}\", u.id());     u } let unknown_user = existional(&amp;player);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0432\u0441\u0451 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443: \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0442\u0438\u043f\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u043d\u0430 <s>\u0437\u0430\u0431\u0438\u0432\u0430\u0435\u0442<\/s> \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0438 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <code>User<\/code>. \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a <code>Player<\/code>, \u0430 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043d\u0435\u0447\u0442\u043e, \u0442\u0438\u043f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code>.<\/p>\n<p>\u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0435\u0437\u043e\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u044b \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u0435\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f?<br \/>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0442\u0438\u043f: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>impl<\/code> \u043a\u0443\u0434\u0430 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f.<br \/>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c.<\/p>\n<p>\u0410\u0445\u0438\u043b\u043b\u0435\u0441\u043e\u0432\u0430 \u043f\u044f\u0442\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u2014 \u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0438\u0437\u0432\u043d\u0435, \u043d\u043e \u043d\u0435 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u043f\u0440\u0438 \u0432\u0441\u0435\u0445 \u0438\u0445 \u043f\u043b\u044e\u0441\u0430\u0445, \u043b\u043e\u043c\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"rust\">fn create_default_user&lt;T&gt;(id: u32) -&gt; T where T: User {     Player { id, games: vec![] } }<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0436\u0451\u0441\u0442\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u0438. \u0417\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0438\u0442\u043e\u0433:  <\/p>\n<pre><code class=\"rust\">fn create_default_user&lt;T&gt;(id: u32) -&gt; T where T: User {                        -              -                        |              |                        |              expected `T` because of return type                        |              help: consider using an impl return type: `impl User`                        expected this type parameter     Player { id, games: vec![] }     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `Player`<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<pre><code class=\"rust\">fn create_default_user(id: u32) -&gt; impl User {     Player { id, games: vec![] } }<\/code><\/pre>\n<p>\u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041e\u0442\u0432\u0435\u0442: \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u0432\u043d\u0435, \u0435\u043c\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u2014 \u0432\u0430\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u2014 \u044d\u0442\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0442\u0438\u043f\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0438\u043f\u044b:<\/p>\n<pre><code class=\"rust\">trait Printer {     fn print(&amp;self); }  impl Printer for bool {     fn print(&amp;self) {         println!(\"Is's bool:{self}\")     } }  impl Printer for i32 {     fn print(&amp;self) {         println!(\"Is's i32:self\")     } }  struct Point {     x: f64,     y: f64, }  impl Printer for Point {     fn print(&amp;self) {         println!(\"Is's Point:({}.{})\", self.x, self.y)     } }<\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>Printer<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>print<\/code> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c <code>Printer<\/code> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c:<\/p>\n<pre><code class=\"rust\">fn universal_print&lt;T&gt;(val: T) where T: Printer {     val.print(); }  pub fn main() {     universal_print(true);     universal_print(99);     universal_print(Point { x: 1.0, y: 4.5 }); }<\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e: <code>universal_print<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0442\u0438\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>Printer<\/code>, \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0430 \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441 \u0442\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 ASM \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/godbolt.org\" rel=\"noopener noreferrer nofollow\">Godbolt<\/a>:<\/p>\n<pre><code class=\"assembly\">example::main::hdc436770f0aefb4c:         push    rax          mov     edi, 1         call    example::universal_print::h711e55ed310c15bb          mov     edi, 99         call    example::universal_print::h9f7d5cef34f9e24e          movsd   xmm0, qword ptr [rip + .LCPI12_0]         movsd   xmm1, qword ptr [rip + .LCPI12_1]         call    example::universal_print::hdb8d1cfe18105ad7          pop     rax         ret<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0447\u0451\u0442\u043a\u043e \u0432\u0438\u0434\u0438\u043c \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 <code>universal_print<\/code>, \u043d\u043e \u043f\u0440\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0442\u043d\u043e: \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0442\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u0447\u0430\u0441\u0442\u044c \u0438\u043c\u0435\u043d\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0445\u0435\u0448, \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0430\u043c\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"assembly\">example::universal_print::h711e55ed310c15bb:         push    rax         mov     al, dil         and     al, 1         mov     byte ptr [rsp + 7], al         lea     rdi, [rsp + 7]         call    qword ptr [rip + &lt;bool as example::Printer&gt;::print::ha90281dba6484e75@GOTPCREL]         pop     rax         ret  example::universal_print::h9f7d5cef34f9e24e:         push    rax         mov     dword ptr [rsp + 4], edi         lea     rdi, [rsp + 4]         call    qword ptr [rip + &lt;i32 as example::Printer&gt;::print::h4ed00bd6afa69296@GOTPCREL]         pop     rax         ret  example::universal_print::hdb8d1cfe18105ad7:         sub     rsp, 24         movsd   qword ptr [rsp + 8], xmm0         movsd   qword ptr [rsp + 16], xmm1         lea     rdi, [rsp + 8]         call    qword ptr [rip + &lt;example::Point as example::Printer&gt;::print::h278cd73f496c36f1@GOTPCREL]         add     rsp, 24         ret<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f. \u042d\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b <strong>\u043c\u043e\u043d\u043e\u043c\u043e\u0440\u0444\u0438\u0437\u0430\u0446\u0438\u044e<\/strong> \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044f \u043e\u0434\u043d\u0443 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0443\u044e (\u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u0443\u044e) \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043d\u0430\u0431\u043e\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<blockquote>\n<p>-C panic=abort -C opt-level=0<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 (inlining). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u043e\u043d\u043e\u043c\u043e\u0440\u0444\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<\/div>\n<\/details>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c:<\/p>\n<pre><code class=\"rust\">fn existential_print(val: impl Printer) {     val.print(); }  pub fn main() {     existential_print(true);     existential_print(99);     existential_print(Point { x: 1.0, y: 4.5 }) }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f. \u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442:<\/p>\n<pre><code class=\"assembly\">example::main::hdc436770f0aefb4c:         push    rax          mov     edi, 1         call    example::existential_print::h27a720521bb10817          mov     edi, 99         call    example::existential_print::h127a4c4152bc7a41          movsd   xmm0, qword ptr [rip + .LCPI12_0]         movsd   xmm1, qword ptr [rip + .LCPI12_1]         call    example::existential_print::hc85fc40cdb877da9          pop     rax         ret<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">example::existential_print::h127a4c4152bc7a41:         push    rax         mov     dword ptr [rsp + 4], edi         lea     rdi, [rsp + 4]         call    qword ptr [rip + &lt;i32 as example::Printer&gt;::print::h4ed00bd6afa69296@GOTPCREL]         pop     rax         ret  example::existential_print::h27a720521bb10817:         push    rax         mov     al, dil         and     al, 1         mov     byte ptr [rsp + 7], al         lea     rdi, [rsp + 7]         call    qword ptr [rip + &lt;bool as example::Printer&gt;::print::ha90281dba6484e75@GOTPCREL]         pop     rax         ret  example::existential_print::hc85fc40cdb877da9:         sub     rsp, 24         movsd   qword ptr [rsp + 8], xmm0         movsd   qword ptr [rsp + 16], xmm1         lea     rdi, [rsp + 8]         call    qword ptr [rip + &lt;example::Point as example::Printer&gt;::print::h278cd73f496c36f1@GOTPCREL]         add     rsp, 24         ret<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0410 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0430\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443 \u043d\u0438\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f:  <\/p>\n<pre><code class=\"rust\">fn universal_print&lt;T&gt;(val: T) where T: Printer {     val.print(); }  fn existential_print(val: impl Printer) {     val.print(); }<\/code><\/pre>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f <code>T: Printer<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d \u0431\u043e\u043b\u0435\u0435 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0439 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u042d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f <code>impl Printer<\/code>, \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0431\u0435\u0437 \u0435\u0433\u043e \u044f\u0432\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">fn create_user_by_type(id: u32, user_type: UserType) -&gt; impl User {     match user_type {         UserType::Player =&gt; Player { id, games: vec![] },         UserType::Admin =&gt; Admin {             id,             permissions: vec![1],         },     } }<\/code><\/pre>\n<p>\u041e\u0441\u043e\u0437\u043d\u0430\u0432 \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 <code>T<\/code> \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f:<\/p>\n<pre><code class=\"rust\">    | 32 |               match user_type {    |               --------------- `match` arms have incompatible types 33 |                   UserType::Player =&gt; Player { id, games: vec![] },    |                                       ---------------------------- this is found to be of type `Player` 34 |                   UserType::Admin =&gt; Admin {    |  ____________________________________^ 35 | |                     id, 36 | |                     permissions: vec![1], 37 | |                 },    | |_________________^ expected `Player`, found `Admin`    | help: you could change the return type to be a boxed trait object    | 31 -         fn create_user_by_type(id: u32, user_type: UserType) -&gt; impl User { 31 +         fn create_user_by_type(id: u32, user_type: UserType) -&gt; Box&lt;dyn User&gt; {    | help: if you change the return type to expect trait objects, box the returned expressions    | 33 ~                 UserType::Player =&gt; Box::new(Player { id, games: vec![] }), 34 ~                 UserType::Admin =&gt; Box::new(Admin { 35 |                     id, 36 |                     permissions: vec![1], 37 ~                 }),<\/code><\/pre>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430. \u0412\u0441\u0451 \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0442\u0435\u043a\u0435. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e. \u0411\u044b\u043b\u043e \u0442\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>\u041d\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u043e\u0439 \u2014 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0434\u0443\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041c\u043e\u043d\u043e\u043c\u043e\u0440\u0444\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0434\u0435\u0441\u044c \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u0430. \u041f\u0440\u0438\u0434\u0435\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0441\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u2014 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0435.<\/p>\n<p><strong>\u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code class=\"rust\">enum UserUnion {     Admin(Admin),     Player(Player), }  fn create_user_by_type3(id: u32, user_type: UserType) -&gt; UserUnion {     match user_type {         UserType::Player =&gt; UserUnion::Player(Player {              id,              games: vec![]          }),         UserType::Admin =&gt; UserUnion::Admin(Admin {             id,             permissions: vec![1],         }),     } } let user = create_user_by_type(10, UserType::Player);  match user {     UserUnion::Admin(admin) =&gt; todo!(),     UserUnion::Player(player) =&gt; todo!(), }<\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d.<\/p>\n<p><strong>\u0423\u043f\u0430\u043a\u043e\u0432\u043a\u0430<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u2014 \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430 \u0441\u0441\u044b\u043b\u043a\u0443, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432 Rust \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p><code>impl User<\/code> \u2014 \u044d\u0442\u043e \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u043e\u0439. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0432\u0430\u0436\u0435\u043d.<\/p>\n<p><code>dyn User<\/code> \u2014 \u0435\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u00ab\u043a\u0443\u0437\u0435\u043d\u00bb. \u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c, \u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<pre><code class=\"rust\">fn create_user_by_type(id: u32, user_type: UserType) -&gt; Box&lt;dyn User&gt; {     match user_type {         UserType::Player =&gt; Box::new(Player {              id,              games: vec![]          }),         UserType::Admin =&gt; Box::new(Admin {             id,             permissions: vec![1],         }),     } }  let user: Box&lt;dyn User&gt; = create_user_by_type(10, UserType::Player);<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435 \u2014 \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0435 \u0441\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 <code>User<\/code>, \u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043a\u0443\u0447\u0435.<br \/>\u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 <code>User<\/code>.<br \/>\u0422\u0440\u0435\u0442\u044c\u0435 \u2014 \u0434\u043b\u044f <code>User<\/code> \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>dyn<\/code>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0438 \u0430\u0434\u0440\u0435\u0441 \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043a\u0443\u0447\u0435?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>User<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0442\u0438\u043f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u2014 \u0432 \u043a\u0443\u0447\u0435.<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0441 <code>print<\/code>:<\/p>\n<pre><code class=\"rust\">fn dynamic_existential_print(val: &amp;dyn Printer) {     val.print(); }  pub fn main() {     let a = true;     let b = 99;     let c = Point { x: 1.0, y: 4.5 };      dynamic_existential_print(&amp;a);     dynamic_existential_print(&amp;b);     dynamic_existential_print(&amp;c) }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0443\u0447\u0443, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u044b \u0432 <code>main<\/code>:<\/p>\n<pre><code class=\"assembly\">example::main::hdc436770f0aefb4c:         sub     rsp, 24          mov     byte ptr [rsp + 3], 1         mov     dword ptr [rsp + 4], 99         movsd   xmm0, qword ptr [rip + .LCPI13_1]         movsd   qword ptr [rsp + 8], xmm0         movsd   xmm0, qword ptr [rip + .LCPI13_0]         movsd   qword ptr [rsp + 16], xmm0          lea     rdi, [rsp + 3]         lea     rsi, [rip + .Lanon.ca4ea46b1734d957c09d7b07bf131053.10]         call    example::dynamic_existential_print::hd5f8b3b52234a935          lea     rdi, [rsp + 4]         lea     rsi, [rip + .Lanon.ca4ea46b1734d957c09d7b07bf131053.11]         call    example::dynamic_existential_print::hd5f8b3b52234a935          lea     rdi, [rsp + 8]         lea     rsi, [rip + .Lanon.ca4ea46b1734d957c09d7b07bf131053.12]         call    example::dynamic_existential_print::hd5f8b3b52234a935          add     rsp, 24         ret<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u2014 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"assembly\">        lea     rdi, [rsp + 3]         lea     rsi, [rip + .Lanon.ca4ea46b1734d957c09d7b07bf131053.10]         call    example::dynamic_existential_print::hd5f8b3b52234a935<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>rdi<\/code> \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (<code>bool<\/code>, <code>i32<\/code>, <code>Point<\/code>).<br \/>\u0412 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>rsi<\/code> \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (<code>vtable<\/code>).<br \/>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>dynamic_existential_print<\/code>.<\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0442\u0430\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c<code>.Lanon.ca4ea46b1734d957c09d7b07bf131053.10<\/code>:<\/p>\n<pre><code class=\"assembly\">.Lanon.ca4ea46b1734d957c09d7b07bf131053.10:         .asciz  \"\\000\\000\\000\\000\\000\\000\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\001\\000\\000\\000\\000\\000\\000\"         .quad   &lt;bool as example::Printer&gt;::print::ha90281dba6484e75  .Lanon.ca4ea46b1734d957c09d7b07bf131053.11:         .asciz  \"\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\"         .quad   &lt;i32 as example::Printer&gt;::print::h4ed00bd6afa69296  .Lanon.ca4ea46b1734d957c09d7b07bf131053.12:         .asciz  \"\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\b\\000\\000\\000\\000\\000\\000\"         .quad   &lt;example::Point as example::Printer&gt;::print::h278cd73f496c36f1<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0442\u0438\u043f\u0430 <code>bool<\/code>: <\/p>\n<pre><code class=\"django\">Offset | Bytes                      | \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 -------+----------------------------+--------------------------------- +0     | 00 00 00 00 00 00 00 00    | \u0410\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 +8     | 01 00 00 00 00 00 00 00    | size +16    | 01 00 00 00 00 00 00 00    | align +24    | &lt;\u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438&gt;            | \u0410\u0434\u0440\u0435\u0441 &lt;bool as example::Printer&gt;::print::...<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e\u0434 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0438\u043f\u0430 \u0438 \u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435.<br \/>\u0421\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0432 24 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439: \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0432 24 \u0431\u0430\u0439\u0442\u0430, \u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432 32 \u0431\u0430\u0439\u0442\u0430 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>dynamic_existential_print<\/code>:<\/p>\n<pre><code class=\"assembly\">example::dynamic_existential_print::hd5f8b3b52234a935:         sub     rsp, 24          mov     qword ptr [rsp + 8], rdi         mov     qword ptr [rsp + 16], rsi         call    qword ptr [rsi + 24]          add     rsp, 24         ret<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: <\/p>\n<pre><code class=\"assembly\">        mov     qword ptr [rsp + 8], rdi         mov     qword ptr [rsp + 16], rsi<\/code><\/pre>\n<p> \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u2014 \u0432 \u0441\u0442\u0435\u043a.<\/p>\n<pre><code class=\"assembly\">call    qword ptr [rsi + 24]<\/code><\/pre>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0430\u0434\u0440\u0435\u0441 <code>vtable<\/code> + <code>\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/code>. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435  \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>Offset | Value                      | \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 -------+----------------------------+--------------------------------- +0     | 0                          | \u0410\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 +8     | 1                          | size +16    | 1                          | align +24    | 93824992263216             | \u0410\u0434\u0440\u0435\u0441 &lt;bool as example::Printer&gt;::print::...<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u2014 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u044d\u0442\u0438\u043c \u0442\u0438\u043f\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433: \u0432 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 <code>vtable<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <code>vtable<\/code> \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432.<\/p>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u2014 \u043e\u043d\u0430 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442:<\/p>\n<pre><code class=\"rust\">fn dynamic_existential_print(val: &amp;dyn Printer) {     val.print(); }<\/code><\/pre>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ab\/aec\/010\/2abaec010db611760fd31764f3b9e42f.png\" alt=\"\u0432\u043d\u0443\u0442\u0440\u044f\u043d\u043a\u0430 val: &amp;dyn Printer\" title=\"\u0432\u043d\u0443\u0442\u0440\u044f\u043d\u043a\u0430 val: &amp;dyn Printer\" width=\"612\" height=\"201\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2ab\/aec\/010\/2abaec010db611760fd31764f3b9e42f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ab\/aec\/010\/2abaec010db611760fd31764f3b9e42f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0432\u043d\u0443\u0442\u0440\u044f\u043d\u043a\u0430 val: &amp;dyn Printer<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0442\u0438\u043f\u043e\u0432<\/h2>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e Rust, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043c\u043d\u043e\u0433\u0438\u0445 \u043c\u0435\u0439\u043d\u0441\u0442\u0440\u0438\u043c\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0438 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0443 \u0442\u0438\u043f\u0430 \u0431\u044b\u043b \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 \u044f\u0437\u044b\u043a\u0435 \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442:<\/p>\n<pre><code class=\"rust\">pub trait Default: Sized {     fn default() -&gt; Self; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"rust\">impl Default for Point {     fn default() -&gt; Self {         Self { x: 0., y: 0. }     } }  fn main() {     let default_point = Point::default();     \/\/ Point { x: 0.0, y: 0.0 }     println!(\"{default_point:?}\"); }<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u0435\u043d:<\/p>\n<pre><code class=\"rust\">fn print_type_info&lt;T&gt;() where     T: Default,     T: Debug, {     println!(         \"Type name: {}\\nSize: {}\\nDefault: {:?}\",         type_name::&lt;T&gt;(),         size_of::&lt;T&gt;(),         T::default()     ); } fn main() {     \/\/ Type name: monomor::Point     \/\/ Size: 16     \/\/ Default: Point { x: 0.0, y: 0.0 }     print_type_info::&lt;Point&gt;(); }<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u0432 \u044f\u0437\u044b\u043a\u0435 Rust. \u041e\u0441\u043e\u0431\u043e\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u0447\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e \u044f\u0437\u044b\u043a\u0430 \u2014 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u0434\u043b\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Rust.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/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\/925576\/\"> https:\/\/habr.com\/ru\/articles\/925576\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/910194\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0434\u0435\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/923178\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. \u0427\u0442\u043e \u0442\u0430\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c?<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0430\u0439\u0434 \u043d\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. Rust<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0442\u0435\u043e\u0440\u0438\u044e: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0438 \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d Rust \u2014 \u044f\u0437\u044b\u043a \u0441 \u0431\u043e\u0433\u0430\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u2014 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<h2>\u0417\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c<\/h2>\n<p><strong>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0432 Rust \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a. <br \/>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <code>&amp;str<\/code> \u0438 <code>String<\/code>.<br \/><code>&amp;str<\/code> \u2014 \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u0440\u0435\u0437, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0443\u0447\u0435 \u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u043e \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f.<br \/><code>String<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f UTF-8 \u0431\u0430\u0439\u0442, \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f \u0432 \u043a\u0443\u0447\u0435. \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0432 Rust \u043d\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p><strong>\u0422\u0440\u0435\u0442\u0438\u0439 \u0444\u0430\u043a\u0442<\/strong> \u2014 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"rust\">fn print_name(name: &amp;str) {     println!(\"Name is {name}\"); }  fn main() {     let name = String::from(\"Alex\");      print_name(&amp;name)); }<\/code><\/pre>\n<p>\u041d\u0443 \u043b\u0430\u0434\u043d\u043e \u0432 Java, \u043b\u0430\u0434\u043d\u043e \u0432 C#, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e String \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 str. \u041d\u043e \u0432 Rust \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442. \u041a\u0430\u043a \u0436\u0435 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 &amp;str \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 String?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u044f\u0432\u043d\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code class=\"rust\">impl ops::Deref for String {     type Target = str;      #[inline]     fn deref(&amp;self) -&gt; &amp;str {         self.as_str()     } }<\/code><\/pre>\n<p>\u0422\u0438\u043f <code>String<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>String<\/code> \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u0440\u0435\u0437, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"rust\">pub const fn as_str(&amp;self) -&gt; &amp;str {     unsafe { str::from_utf8_unchecked(self.vec.as_slice()) } }  pub const unsafe fn from_utf8_unchecked(v: &amp;[u8]) -&gt; &amp;str {     \/\/ \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0440\u0435\u0434 \u0431\u0430\u0439\u0442      \/\/ \u043c\u044b \u0444\u043e\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u043a \u0442\u0438\u043f\u0443 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0440\u0435\u0437\u0430     unsafe { mem::transmute(v) } } <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b:<\/p>\n<pre><code class=\"rust\">print_name(&amp;name); print_name(&amp;name.as_str());<\/code><\/pre>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0435. \u0412 Rust \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e: \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 (trait) \u0434\u043b\u044f \u0442\u0438\u043f\u0430: <\/p>\n<pre><code class=\"rust\">impl ops::Add&lt;Point&gt; for Point {     type Output = Point;      fn add(self, rhs: Point) -&gt; Self::Output {         Self {             x: self.x + rhs.x,             y: self.y + rhs.y,         }     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438: <\/p>\n<pre><code class=\"rust\">fn main() {     let point_a = Point { x: 3.4, y: 5.6 };     let point_b = Point { x: 1.4, y: 8.8 };      let point_c = point_a + point_b;      \/\/ Point { x: 4.8, y: 14.4 }     println!(\"{point_c:?}\") }<\/code><\/pre>\n<h2>\u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c<\/h2>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 Rust \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p><strong>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f<\/strong> \u2014 \u044d\u0442\u043e \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u043b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u043c \u043a\u0440\u0438\u0442\u0438\u0440\u0438\u0438 \u0442\u0438\u043f\u043e\u043c. \u0422\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0435 \u0438 \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"json\">Player -&gt; T:User -&gt; Player<\/code><\/pre>\n<p><strong>\u042d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f<\/strong> \u2014  \u044d\u0442\u043e \u0442\u0438\u043f, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0442\u0438\u043d\u043d\u0443\u044e \u043f\u0440\u0438\u0440\u043e\u0434\u0443 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0447\u0442\u043e \u0442\u043e\u0442 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c. \u0422\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0435 \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<pre><code class=\"kotlin\">Player -&gt; ?:User -&gt; ?:User<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code> \u0438 \u0442\u0438\u043f\u044b <code>Player<\/code> \u0438 <code>Admin<\/code>, \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"rust\">trait User {     fn id(&amp;self) -&gt; u32; }  #[derive(Debug)] struct Player {     id: u32,     games: Vec&lt;String&gt;, }  #[derive(Debug)] struct Admin {     id: u32,     permissions: Vec&lt;u8&gt;, }<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"rust\">fn universal&lt;T&gt;(user: &amp;T) -&gt; &amp;T where T: User {     \/\/ \u0442\u0438\u043f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d     let u: &amp;T = user;     \/\/ monomor::core::Player     println!(\"{}\", type_name_of_val(u));     println!(\"{}\", u.id());     u } let original_player: &amp;Player = universal(&amp;player);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0448\u0430\u0431\u043b\u043e\u043d <code>T<\/code> \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0438\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code>. \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0438\u043f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 <code>T<\/code>, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0432\u0435\u0440\u043d\u0443\u0432 <code>T<\/code>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 <code>Player<\/code>, \u0447\u0442\u043e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>T<\/code> \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <code>User<\/code>, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"rust\">fn existional(user: &amp;impl User) -&gt; &amp;impl User {     \/\/ \u0442\u0438\u043f \u0443\u0442\u0435\u0440\u044f\u043d, \u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0432\u043d\u043e     let u = user;     \/\/ monomor::core::Player     println!(\"{}\", type_name_of_val(u));     println!(\"{}\", u.id());     u } let unknown_user = existional(&amp;player);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0432\u0441\u0451 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443: \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0442\u0438\u043f\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u043d\u0430 <s>\u0437\u0430\u0431\u0438\u0432\u0430\u0435\u0442<\/s> \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0438 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <code>User<\/code>. \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a <code>Player<\/code>, \u0430 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043d\u0435\u0447\u0442\u043e, \u0442\u0438\u043f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>User<\/code>.<\/p>\n<p>\u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0435\u0437\u043e\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u044b \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u0435\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f?<br \/>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0442\u0438\u043f: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>impl<\/code> \u043a\u0443\u0434\u0430 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f.<br \/>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c.<\/p>\n<p>\u0410\u0445\u0438\u043b\u043b\u0435\u0441\u043e\u0432\u0430 \u043f\u044f\u0442\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u2014 \u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0438\u0437\u0432\u043d\u0435, \u043d\u043e \u043d\u0435 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u043f\u0440\u0438 \u0432\u0441\u0435\u0445 \u0438\u0445 \u043f\u043b\u044e\u0441\u0430\u0445, \u043b\u043e\u043c\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"rust\">fn create_default_user&lt;T&gt;(id: u32) -&gt; T where T: User {     Player { id, games: vec![] } }<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0436\u0451\u0441\u0442\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u0438. \u0417\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0438\u0442\u043e\u0433:  <\/p>\n<pre><code class=\"rust\">fn create_default_user&lt;T&gt;(id: u32) -&gt; T where T: User {                        -              -                        |              |                        |              expected `T` because of return type                        |              help: consider using an impl return type: `impl User`                        expected this type parameter     Player { id, games: vec![] }     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `Player`<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<pre><code class=\"rust\">fn create_default_user(id: u32) -&gt; impl User {     Player { id, games: vec![] } }<\/code><\/pre>\n<p>\u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041e\u0442\u0432\u0435\u0442: \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u044d\u043a\u0437\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u0432\u043d\u0435, \u0435\u043c\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u2014 \u0432\u0430\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u2014 \u044d\u0442\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0442\u0438\u043f\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0438\u043f\u044b:<\/p>\n<pre><code class=\"rust\">trait Printer {     fn print(&amp;self); }  impl Printer for bool {     fn print(&amp;self) {         println!(\"Is's bool:{self}\")     } }  impl Printer for i32 {     fn print(&amp;self) {         println!(\"Is's i32:self\")     } }  struct Point {     x: f64,     y: f64, }  impl Printer for Point {     fn print(&amp;self) {         println!(\"Is's Point:({}.{})\", self.x, self.y)     } }<\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>Printer<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>print<\/code> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c <code>Printer<\/code> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c:<\/p>\n<pre><code class=\"rust\">fn universal_print&lt;T&gt;(val: T) where T: Printer {     val.print(); }  pub fn main() {     universal_print(true);     universal_print(99);     universal_print(Point { x: 1.0, y: 4.5 }); }<\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e: <code>universal_print<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0442\u0438\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>Printer<\/code>, \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0430 \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441 \u0442\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 ASM \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/godbolt.org\" rel=\"noopener noreferrer nofollow\">Godbolt<\/a>:<\/p>\n<pre><code class=\"assembly\">example::main::hdc436770f0aefb4c:         push    rax          mov     edi, 1         call    example::universal_print::h711e55ed310c15bb          mov     edi, 99         call    example::universal_print::h9f7d5cef34f9e24e          movsd   xmm0, qword ptr [rip + .LCPI12_0]         movsd   xmm1, qword ptr [rip + .LCPI12_1]         call    example::universal_print::hdb8d1cfe18105ad7          pop     rax         ret<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0447\u0451\u0442\u043a\u043e \u0432\u0438\u0434\u0438\u043c \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 <code>universal_print<\/code>, \u043d\u043e \u043f\u0440\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0442\u043d\u043e: \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0442\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u0447\u0430\u0441\u0442\u044c \u0438\u043c\u0435\u043d\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0445\u0435\u0448, \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0430\u043c\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"assembly\">example::universal_print::h711e55ed310c15bb:         push    rax         mov     al, dil         and     al, 1         mov     byte ptr [rsp + 7], al         lea     rdi, [rsp + 7]         call    qword ptr [rip + &lt;bool as example::Printer&gt;::print::ha90281dba6484e75@GOTPCREL]         pop     rax         ret  example::universal_print::h9f7d5cef34f9e24e:         push    rax         mov     dword ptr [rsp + 4], edi         lea     rdi, [rsp + 4]         call    qword ptr [rip + &lt;i32 as example::Printer&gt;::print::h4ed00bd6afa69296@GOTPCREL]         pop     rax         ret  example::universal_print::hdb8d1cfe18105ad7:         sub     rsp, 24         movsd   qword ptr [rsp + 8], xmm0         movsd   qword ptr [rsp + 16], xmm1         lea     rdi, [rsp + 8]         call    qword ptr [rip + &lt;example::Point as example::Printer&gt;::print::h278cd73f496c36f1@GOTPCREL]         add     rsp, 24         ret<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f. \u042d\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b <strong>\u043c\u043e\u043d\u043e\u043c\u043e\u0440\u0444\u0438\u0437\u0430\u0446\u0438\u044e<\/strong> \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044f \u043e\u0434\u043d\u0443 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0443\u044e (\u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u0443\u044e) \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043d\u0430\u0431\u043e\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<blockquote>\n<p>-C panic=abort -C opt-level=0<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 (inlining). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u043e\u043d\u043e\u043c\u043e\u0440\u0444\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<\/div>\n<\/details>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u043c\u044b <\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-467931","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467931","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=467931"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467931\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=467931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=467931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=467931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}