{"id":342062,"date":"2022-12-02T03:00:15","date_gmt":"2022-12-02T03:00:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=342062"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=342062","title":{"rendered":"<span>Rust: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0443\u0435\u043c \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/he\/dl\/hr\/hedlhryh07x9-ql8kwg6d0e55ec.png\" alt=\"\u041a\u041f\u0414\u0412: borrow checker \u043d\u0435 \u0434\u0430\u0451\u0442 \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u0432 \u043d\u043e\u0433\u0443 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 FFI\" data-src=\"https:\/\/habrastorage.org\/webt\/he\/dl\/hr\/hedlhryh07x9-ql8kwg6d0e55ec.png\"\/><\/p>\n<p>  <\/p>\n<p>Borrow-checker \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u043a\u044e\u0440\u0438\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c Rust. \u0415\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 RustBook, \u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c \u0441 \u043f\u0440\u0438\u0434\u0438\u0440\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0431\u044b \u043d\u0435 \u0431\u044b\u043b \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438-\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 API \u043d\u0430\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b \u2014 \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u0441\u0442\u0430\u043b\u043e \u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u0437 \u0440\u0443\u043a. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u0434 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 API \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b\u0430\u0441\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0435\u0439 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043d\u0438 \u0436\u0438\u0432\u0443\u0442 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u2014 \u043d\u0430 <a href=\"https:\/\/levitanus.github.io\/generic-mutability-test-doc\/generic_mutability_test\/index.html\" rel=\"nofollow noopener noreferrer\">GitHub pages<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0442\u0435\u0441\u0442\u043e\u0432 \u2014 \u043d\u0430 <a href=\"https:\/\/github.com\/Levitanus\/generic_mutability_test\" rel=\"nofollow noopener noreferrer\">GitHub<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"problema\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>  <\/p>\n<p>\u042f \u0441\u043e\u0431\u0440\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>monkey_ffi<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c C API \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 GUI \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0422\u0430\u043c \u044f\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u0451\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0442.\u043f. \u041d\u043e \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c \u0443\u0436\u0435 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u2014 \u043c\u044b \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u043a\u043d\u043e\u043f\u043e\u043a \u0442\u043e\u0436\u0435 \u043f\u043e\u0440\u0430 \u0434\u0440\u043e\u043f\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Root ----Window ----Frame ----|----FrameButton ----WindowButton<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041c\u043e\u0434\u0443\u043b\u044c `monkey_ffi`<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"rust\">fn make_window() -> usize; fn get_window(window_id: usize) -> usize; fn make_frame(_window_id: usize) -> usize; fn make_window_button(_window_id: usize) -> usize; fn make_frame_button(_window_id: usize) -> usize; fn window_button_is_clicked(_window_id: usize, _button_id: usize) -> bool; fn window_button_click(window_id: usize, button_id: usize); fn window_button_set_text(window_id: usize, button_id: usize, text: &amp;String); fn frame_button_is_clicked(_frame_id: usize, _button_id: usize) -> bool; fn frame_button_click(frame_id: usize, button_id: usize); fn frame_button_set_text(frame_id: usize, button_id: usize, text: &amp;String);<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430 \u0440\u0430\u0437. \u0418 \u043d\u0430\u0434\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u0442\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0443\u0442 \u0441\u0432\u043e\u0438\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>Rc<\/code>, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u00ab\u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438\u00bb, \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>Window<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0431\u043e <code>&amp;Root<\/code>, \u043b\u0438\u0431\u043e <code>&amp;mut Root<\/code>. \u0414\u0430\u0436\u0435 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0439\u0442\u0430 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u0438 \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f. \u0422\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0433\u043e: <code>SecondChild&lt;&amp;mut Parent, &amp;mut FirstChild&lt;&amp;mut Parent>><\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 <code>Window<\/code>? \u0422\u043e\u0436\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0430 \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442, \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u0444\u043d\u0443\u043a\u0446\u0438\u0439 <code>get()<\/code> \u0438 <code>get_mut()<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0436\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0446\u0435\u043b\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043c\u044b\u0441\u043b\u044c \u043e\u0431 \u0443\u0434\u043e\u0431\u043e\u0432\u0430\u0440\u0438\u043c\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043c\u0435\u043d\u044f \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b \u0444\u0430\u043a\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e <code>Self<\/code>, <code>&amp;Self<\/code> \u0438 <code>&amp;mut Self<\/code> \u2014 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0440\u0435\u0439\u0442\u044b. \u0410 \u044d\u0442\u0430 <a href=\"https:\/\/users.rust-lang.org\/t\/generic-mutability-parameters\/16837\/23\" rel=\"nofollow noopener noreferrer\">\u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u044f<\/a> \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430 \u043c\u0435\u043d\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e, \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 Rust \u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0430\u044f, \u0430 \u0442\u0440\u043e\u0438\u0447\u043d\u0430\u044f: \u0435\u0441\u0442\u044c \u0442\u0438\u043f\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435, \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435, \u0438 \u00ab\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043b\u0435\u0432\u0430\u0442\u044c\u00bb, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0430\u043a \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0435 \u043c\u043d\u043e\u0439 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u0442\u0438 \u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f: \u043e\u0434\u0438\u043d \u0442\u0440\u0435\u0439\u0442 \u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">trait ProbablyMutable;  struct Mutable; impl ProbablyMutable for Mutable {}  struct Immutable; impl ProbablyMutable for Immutable {}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0445 \u043a\u0430\u043a \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u0434\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u0436\u0438\u0437\u043d\u0438 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u0441\u043a\u0435\u043b\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. <code>PhantomData<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a \u043f\u043e \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0430\u0449\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u043e\u043e\u043f\u0430\u0440\u043a generic \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">struct Root; struct Window&lt;'a, T: ProbablyMutable> {     id: usize,     name: String,     frames_amount: usize,     buttons_amount: usize,     root: &amp;'a Root,     mutability: PhantomData&lt;T>, }  struct Frame&lt;'a, T: ProbablyMutable> {     window: &amp;'a Window&lt;'a, T>,     id: usize,     width_px: Option&lt;u16>,     buttons_amount: usize, }  struct WindowButton&lt;'a, T: ProbablyMutable> {     id: usize,     text: String,     parent: &amp;'a Window&lt;'a, T>, }  struct FrameButton&lt;'a, T: ProbablyMutable> {     id: usize,     text: String,     parent: &amp;'a Frame&lt;'a, T>, }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u0432 FFI API \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0438 \u043e\u043a\u043e\u043d, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (\u0442\u0440\u0435\u0439\u0442) <code>Button<\/code>. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0447\u0435\u0440\u0435\u0437 <code>enum<\/code>. \u041d\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0442\u0445\u043e\u0434\u043e\u043c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u044f \u043f\u0438\u0448\u0443 \u0442\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u0434\u043b\u044f \u0442\u0440\u0451\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>struct&lt;T: ProbablyMutable><\/code> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b.<\/li>\n<li><code>struct&lt;Mutable><\/code> \u0434\u043b\u044f \u0442\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<li><code>struct&lt;Immutable><\/code> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"rust\">impl&lt;'a, T: ProbablyMutable> Window&lt;'a, T> {     fn new(root: &amp;'a Root, id: usize) -> Option&lt;Self> {todo!()}     fn get_id(&amp;self) -> usize {todo!()}     fn get_name(&amp;self) -> &amp;String {todo!()}     fn get_width(&amp;self) -> u16 {todo!()} } impl&lt;'a> Window&lt;'a, Immutable> {     fn get_frame(&amp;self, id: usize) -> Option&lt;Frame&lt;Immutable>> {todo!()}     fn get_button(&amp;self, id: usize) -> Option&lt;WindowButton&lt;Immutable>> {todo!()} } impl&lt;'a> Window&lt;'a, Mutable> {     fn set_name(&amp;mut self, name: impl Into&lt;String>) {todo!()}     fn make_frame(&amp;mut self) -> Frame&lt;Mutable> {todo!()}     fn make_button(&amp;mut self) -> WindowButton&lt;Mutable> {todo!()} }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a\u0436\u0435, \u043d\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0431\u0449\u0438\u0445 \u0442\u0440\u0435\u0439\u0442\u0430 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">trait Button&lt;T: ProbablyMutable> where     Self: Sized, {     type Parent;     fn new(parent: Self::Parent, id: usize) -> Option&lt;Self>;     fn get_id(&amp;self) -> usize;     fn is_clicked(&amp;self) -> bool;     fn get_text(&amp;self) -> &amp;String; } trait ButtonMut where     Self: Sized, {     type Parent;     fn click(&amp;mut self);     fn set_text(&amp;mut self, text: impl Into&lt;String>); } struct WindowButton&lt;'a, T: ProbablyMutable> {     id: usize,     text: String,     parent: &amp;'a Window&lt;'a, T>, } impl&lt;'a, T: ProbablyMutable> Button&lt;T> for WindowButton&lt;'a, T> {     type Parent = &amp;'a Window&lt;'a, T>;     fn new(parent: Self::Parent, id: usize) -> Option&lt;Self>;     fn get_id(&amp;self) -> usize;     fn is_clicked(&amp;self) -> bool;     fn get_text(&amp;self) -> &amp;String; } impl&lt;'a> ButtonMut for WindowButton&lt;'a, Mutable> {     type Parent = Window&lt;'a, Mutable>;     fn click(&amp;mut self);     fn set_text(&amp;mut self, text: impl Into&lt;String>); }  struct FrameButton&lt;'a, T: ProbablyMutable> {     id: usize,     text: String,     parent: &amp;'a Frame&lt;'a, T>, } impl&lt;'a, T: ProbablyMutable> Button&lt;T> for FrameButton&lt;'a, T> {     type Parent = &amp;'a Frame&lt;'a, T>;     fn new(parent: Self::Parent, id: usize) -> Option&lt;Self>;     fn get_id(&amp;self) -> usize;     fn is_clicked(&amp;self) -> bool;     fn get_text(&amp;self) -> &amp;String; } impl&lt;'a> ButtonMut for FrameButton&lt;'a, Mutable> {     type Parent = Frame&lt;'a, Mutable>;     fn click(&amp;mut self) ;     fn set_text(&amp;mut self, text: impl Into&lt;String>); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u2014 \u0443\u0436\u0435 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442. \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"poprobuem-poigratsya\">\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f:<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 <code>Root<\/code>. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u043d\u0430\u0434\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b <code>RUST_LOG=debug<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">env_logger::init(); let mut root = Root::new(); let window1: Window&lt;Mutable> = root.make_child();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e: \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043a\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 <code>root<\/code>. \u0422\u0430\u043a \u0447\u0442\u043e <code>window1<\/code> \u2014 \u0442\u043e\u0436\u0435 <code>Mutable<\/code>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u043e!<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let window2 = root.make_child();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u0439!: <code>Err: cannot borrow root as mutable more than once at a time<\/code>. \u041d\u043e, \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u0430\u043a \u043e\u043d\u043e \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c. \u0414\u0440\u043e\u043f\u043d\u0435\u043c \u044d\u0442\u043e \u043e\u043a\u043d\u043e, \u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c id \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let w1_id: usize = window1.get_id(); debug!(\"{}\", w1_id); drop(window1);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <code>root<\/code> \u0441\u043d\u043e\u0432\u0430 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u0439 (\u0442\u043e\u0447\u043d\u0435\u0435, \u043d\u0435 \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0439). \u041d\u0443-\u043a\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0432\u0430 \u043e\u043a\u043d\u0430 \u043f\u043e-\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let id2: usize = root.make_child().get_id(); let window1: Window&lt;Immutable> = root.get_child(w1_id).unwrap(); let _window2: Window&lt;Immutable> = root.get_child(id2).unwrap(); \/\/ OK!<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a, \u043e\u043d\u0438 \u043e\u0431\u0430 <code>Immutable<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u2014 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0441\u043a\u043e\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">window1.make_button(); Err: no method named `make_button` found for struct `Window&lt;'_, test::Immutable>` in the current scope. The method was found for `Window&lt;'a, test::Mutable>`<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let mut window1: Window&lt;Mutable> = root.get_child_mut(w1_id).unwrap(); let button: WindowButton&lt;Mutable> = window1.make_button(); let b_id: usize = button.get_id(); \/\/ button is dropped. let mut frame: Frame&lt;Mutable> = window1.make_frame(); let fr_b_id: usize = frame.make_button().get_id(); let f_id: usize = frame.get_id(); \/\/ frame is dropped. debug!(\"button text: {}\", button.get_text()); \/\/ Err: cannot borrow `window1` as mutable more than once at a time<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <code>button<\/code> \u0431\u044b\u043b\u0430 <code>WindowButton&lt;Mutable><\/code>. \u041d\u043e, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0435\u0451 \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e?<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let button: WindowButton&lt;Immutable> = window1.get_button(b_id); Err: no method named `get_button` found for struct `Window&lt;'_, test::Mutable>` in the current scope the. Method was found for - `Window&lt;'a, test::Immutable>`<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443, \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043e\u0432 \u0443\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"rust\">let window1: Window&lt;Immutable> = root.get_child(w1_id).unwrap(); let frame: Frame&lt;Immutable> = window1.get_frame(f_id).unwrap(); let w_b: WindowButton&lt;Immutable> = window1.get_button(b_id).unwrap(); let fr_b: FrameButton&lt;Immutable> = frame.get_button(fr_b_id).unwrap();  debug!(\"is window button clicked: {}\", w_b.is_clicked()); debug!(\"is frame button clicked: {}\", fr_b.is_clicked());<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0434\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u2014 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0436\u0435\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e. \u0412\u043e\u0442 \u043f\u0440\u043e Python \u043c\u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0443\u0436\u0435 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u2014 \u0442\u0430\u043c, \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0438 \u0442\u0430\u043a \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u044f \u0441\u0435\u0431\u044f \u0438\u0437\u0432\u0438\u043d\u044f\u044e \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0418 \u0442\u0435\u043c, \u0447\u0442\u043e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 rust \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0433\u0440\u0435\u0448\u0438\u0442 \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0438\u043a. \u0410 \u0432 \u043d\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0438\u043c\u044b\u0435 \u043a\u0440\u0435\u0439\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u043e\u0442\u043b\u0438\u0447\u0438\u043c\u043e \u043e\u0442 \u043d\u0435\u043b\u044e\u0431\u0438\u043c\u044b\u0445, \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u0432\u0440\u043e\u0434\u0435 <code>std::sync::Once<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442 \u0430\u0432\u0442\u043e\u043a\u043e\u043c\u043f\u043b\u0438\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u044d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u0437\u0434\u0435\u0441\u044c \u0438 \u043d\u0430 GitHub) \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u0440\u0438\u0442\u0438\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>P.S. \u041e\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u0442\u0430\u0440\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440.<\/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\/post\/703018\/\"> https:\/\/habr.com\/ru\/post\/703018\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/he\/dl\/hr\/hedlhryh07x9-ql8kwg6d0e55ec.png\" alt=\"\u041a\u041f\u0414\u0412: borrow checker \u043d\u0435 \u0434\u0430\u0451\u0442 \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u0432 \u043d\u043e\u0433\u0443 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 FFI\" data-src=\"https:\/\/habrastorage.org\/webt\/he\/dl\/hr\/hedlhryh07x9-ql8kwg6d0e55ec.png\"\/><\/p>\n<p>  <\/p>\n<p>Borrow-checker \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u043a\u044e\u0440\u0438\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c Rust. \u0415\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 RustBook, \u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c \u0441 \u043f\u0440\u0438\u0434\u0438\u0440\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0431\u044b \u043d\u0435 \u0431\u044b\u043b \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438-\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 API \u043d\u0430\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b \u2014 \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u0441\u0442\u0430\u043b\u043e \u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u0437 \u0440\u0443\u043a. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u0434 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 API \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b\u0430\u0441\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0435\u0439 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043d\u0438 \u0436\u0438\u0432\u0443\u0442 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u2014 \u043d\u0430 <a href=\"https:\/\/levitanus.github.io\/generic-mutability-test-doc\/generic_mutability_test\/index.html\" rel=\"nofollow noopener noreferrer\">GitHub pages<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0442\u0435\u0441\u0442\u043e\u0432 \u2014 \u043d\u0430 <a href=\"https:\/\/github.com\/Levitanus\/generic_mutability_test\" rel=\"nofollow noopener noreferrer\">GitHub<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-342062","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342062","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=342062"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342062\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}