{"id":357419,"date":"2024-05-20T23:50:24","date_gmt":"2024-05-20T23:50:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=357419"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=357419","title":{"rendered":"<span>\u041a\u0430\u043a \u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Python \u043d\u0430 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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/54d\/8f2\/2dc\/54d8f22dcb34d714d8078dcfa094f7f7.jpg\" width=\"1280\" height=\"963\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54d\/8f2\/2dc\/54d8f22dcb34d714d8078dcfa094f7f7.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0412\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0438\u0434\u0435\u043b\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0442\u0435\u043c\u0443 &#171;Python, Rust &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0431\u043b\u0430-\u0431\u043b\u0430-\u0431\u043b\u0430&#8230; \u0412\u043e\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c foo2plus2&#187;. \u0412\u0441\u044f \u0431\u0435\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0440\u043e\u0432\u043d\u044f &#171;hello-world&#187;. \u041d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0435\u0439 \u0436\u0435 <a href=\"https:\/\/medium.com\/@kudryavtsev_ia\/how-i-design-and-develop-real-world-python-extensions-in-rust-2abfe2377182?source=friends_link&amp;sk=24c0727706dd86d564aa683084afed79\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043d\u0430 Medium. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u0442 \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f Python \u043d\u0430 Rust (<a href=\"https:\/\/github.com\/insight-platform\/FFmpeg-Input\" rel=\"noopener noreferrer nofollow\"><u>1<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\"><u>2<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/savant-rs\" rel=\"noopener noreferrer nofollow\"><u>3<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/RocksQ\" rel=\"noopener noreferrer nofollow\"><u>4<\/u><\/a>) \u0438 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u043f\u044b\u0442, \u043d\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0438\u0433 \u0442\u043e\u0439 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0430 \u0447\u0442\u043e \u043d\u0435\u0442. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043c\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043b\u044e\u0434\u044c\u043c\u0438, \u0434\u0440\u0443\u0433\u0438\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u0434\u043e\u043b\u0433\u0438\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430, \u0438 \u0432\u0441\u0435 \u0436\u0435, \u044f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Rust, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043c\u043e\u0435\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0431\u0430\u0432\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 &#8212; \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0444\u0435\u0439\u0441\u043f\u0430\u043b\u043c\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0448\u0430\u0440\u0435\u043d\u044b \u0432 Rust.<\/p>\n<h2>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u044b\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0438\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Rust \u0434\u043b\u044f Python: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\"><u>Similari<\/u><\/a> \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0445\u043e\u0434\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043a\u0430\u0447\u043e\u043a \u0432\u043f\u0435\u0440\u0435\u0434, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b PR \u043e\u0442 <a href=\"https:\/\/github.com\/andreytkachenko\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0434\u0440\u0435\u044f \u0422\u043a\u0430\u0447\u0435\u043d\u043a\u043e<\/a>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0430, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Sphinx \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0438 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 <a href=\"https:\/\/medium.com\/inside-in-sight\/documenting-native-python-extensions-made-with-rust-and-pyo3-227aff68e481\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u042f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432, \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0441\u0440\u0435\u0434\u0443 Manylinux \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Maturin GitHub Action, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"https:\/\/medium.com\/inside-in-sight\/building-portable-native-python-extensions-with-rust-pyo3-and-maturin-3c1a1634d324\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Rust \u0434\u043b\u044f Python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GitHub CI \u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432 Docker.<\/p>\n<p>\u0425\u043e\u0447\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c &#171;\u0441\u043f\u0430\u0441\u0438\u0431\u043e&#187; \u0432\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u043c\u043e\u0433 \u043c\u043d\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435: \u0432\u0441\u0435 \u0432\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0431\u0435\u0437 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0442\u0438\u0432\u044b \u0438 \u043b\u044e\u0434\u0435\u0439 \u0437\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435:<\/p>\n<ul>\n<li>\n<p>PyO3\u00a0<a href=\"https:\/\/github.com\/PyO3\/pyo3\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0438\u0445 \u0443\u0441\u0438\u043b\u0438\u044f \u043f\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f  \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/andreytkachenko\" rel=\"noopener noreferrer nofollow\"><u>Andrei Tkachenko<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>transmute<\/code> \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust \u0438 \u0437\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 Similari;<\/p>\n<\/li>\n<li>\n<p>Pola.rs project\u00a0<a href=\"https:\/\/www.pola.rs\/\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0438\u0434\u0435\u0438 \u043f\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0443 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>Pometry\/Raphtory\u00a0<a href=\"https:\/\/github.com\/Pometry\/Raphtory\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0438\u0434\u0435\u0438 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0432\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 Rust \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 &#171;hello world&#187; \u0434\u043b\u044f Python \u043d\u0430 Rust \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PyO3. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 GIL \u0438 \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/h2>\n<p>Rust \u0438 Python \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0432 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u0432 Rust \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0438, \u0430 \u0432 Python &#8212; \u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430\u0445 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043a\u0443\u0447\u0435. <\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 Python, \u0432 Rust \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"rust\">type WrappedMutex = Arc&lt;Mutex&lt;T>>; \/\/ or type WrappedRwLock = Arc&lt;RwLock&lt;T>>;<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0432 Python \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d GIL &#8212; \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430, \u043e\u0431\u0449\u0430\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432 Rust \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439 \u0441 Python \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 (<code>&amp;mut<\/code> \u0438\u043b\u0438 <code>&amp;<\/code>) \u0438\u0437 Rust \u0432 Python \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Arc&lt;T><\/code>. <\/p>\n<p>\u0412 PyO3 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 Python \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 Rust-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u043d\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430: \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Rust-\u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 Python. PyO3 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Rust \u0432 Python \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f \u0438\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Python (<code>PyObject<\/code>).<\/p>\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 GIL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 GIL \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0439\u0442\u0430 <code>Ungil<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e \u0441\u0443\u0442\u0438, <a href=\"https:\/\/github.com\/PyO3\/pyo3\/blob\/b03c4cb33cc30da738270a4db8322d5d9b74fb8c\/src\/marker.rs#L182\" rel=\"noopener noreferrer nofollow\">\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f<\/a> <code>Send<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 Python \u0438 Rust, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 <code>Arc&lt;T><\/code> \u0438\u043b\u0438 <code>Arc&lt;Mutex&lt;T>>.<\/code><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Python:<\/p>\n<pre><code class=\"rust\">use pyo3::prelude::*;  #[pyclass] struct Object {     x: i32, }  #[pymethods] impl Object {     fn inc(&amp;mut self) {         self.x += 1;     } }<\/code><\/pre>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e Rust, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0438\u0437 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">#[pyfunction] fn callme(o: &amp;mut Object) {     o.inc(); }<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 Rust \u043a\u0430\u043a \u043a\u043e\u043f\u0438\u044e (<code>Clone<\/code>) &#8212; \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 Python \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442:<\/p>\n<pre><code class=\"rust\">#[pyfunction] fn callme(mut o: Object) {     o.inc(); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0437 Rust \u0438 Python:<\/p>\n<pre><code class=\"rust\">use parking_lot::Mutex; use pyo3::prelude::*; use std::sync::Arc;  struct Object {     x: i32, }  impl Object {     fn inc(&amp;mut self) {         self.x += 1;     } }  #[pyclass] #[pyo3(name = \"Object\")] #[derive(Clone)] struct ObjectWrapper(Arc&lt;Mutex&lt;Object>>);  #[pymethods] impl ObjectWrapper {     fn inc(&amp;self) {         let mut bound = self.0.lock();         bound.inc();     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u043c\u0435\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u0432 Python, \u0442\u0430\u043a \u0438 \u0432 Rust, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">thread_local! {     static OBJECT: ObjectWrapper = ObjectWrapper(Arc::new(Mutex::new(Object { x: 0 }))) }  #[pyfunction] fn get_shared_object() -> ObjectWrapper {     OBJECT.with(|o| o.clone()) }  #[pyfunction] fn callme(o: &amp;mut ObjectWrapper) {     o.inc(); }<\/code><\/pre>\n<p>\u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437 Python \u0438 Rust (\u0432 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440). <code>Mutex&lt;T><\/code> \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u043e\u0442 \u0433\u043e\u043d\u043a\u0438, \u0430 <code>Arc&lt;T><\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>RwLock&lt;T><\/code>.<\/p>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0443\u044e \u0432 Python \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 Rust. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c Python \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 Python:<\/p>\n<pre><code class=\"rust\">fn callme&lt;'p>(slf: PyRef&lt;'p, Self>, _py: Python&lt;'p>) -> PyResult&lt;PyRef&lt;'p, Self>> {     let o = slf.deref();     ...     Ok(slf) }<\/code><\/pre>\n<p>\u0421\u0444\u0435\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430, \u043d\u043e \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u043b\u0434\u0435\u0440\u043e\u0432 \u0438\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>with<\/code>.<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 PyO3, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u0434\u043e\u043c . \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u044f \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c, \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e PyO3, \u0432\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u0441\u0435\u0431\u0435 \u043a\u0430\u043a Rust-\u043a\u043e\u0434, \u0442\u0430\u043a \u0438 Python-\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u0435\u0441\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0441 Python &#8212; \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u0435\u0437 Python \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u0435\u0437 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u043c\u0435\u043d \u0438 feature-\u0444\u043b\u0430\u0433\u043e\u0432, \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044f \u043a\u043e\u0434, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 Python, \u0437\u0430 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 (\u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 <a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\">Similari<\/a>);<\/p>\n<\/li>\n<li>\n<p>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0440\u0435\u0439\u0442\u043e\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e (<a href=\"https:\/\/github.com\/insight-platform\/savant-rs\" rel=\"noopener noreferrer nofollow\">Savant-RS<\/a>, <a href=\"https:\/\/github.com\/insight-platform\/RocksQ\" rel=\"noopener noreferrer nofollow\">RocksQ<\/a>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 RocksQ \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7dc\/50a\/ef6\/7dc50aef6295f67226ff4436b3fac429.png\" width=\"720\" height=\"496\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7dc\/50a\/ef6\/7dc50aef6295f67226ff4436b3fac429.png\"\/><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0443 \u043c\u0435\u043d\u044f \u0434\u0432\u0430 \u043a\u0440\u0435\u0439\u0442\u0430: \u0432 <code>queue_rs<\/code> \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e Python. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 Python. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e \u0440\u044f\u0434\u0443 \u043f\u0440\u0438\u0447\u0438\u043d. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0438\u0445.<\/p>\n<p><strong>\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043d\u0430 Rust.<\/strong> \u042f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0439 \u043a\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0438 \u0435\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 PyO3 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0447\u0430\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0435\u0437 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0434\u044b Python, \u0447\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0438\u043d\u0435\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 GIL \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043e\u0434, \u0432\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0435 \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<blockquote>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>PyBytes<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0440\u0435\u0434\u0443 Python \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u042f \u0436\u0435 \u043d\u0435 \u0445\u043e\u0447\u0443 \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439.<\/p>\n<\/blockquote>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c\u0443, \u044f \u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u043e \u0431\u0435\u0437 \u0442\u0438\u043f\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 Python, \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 PyO3.<\/p>\n<p>\u041c\u043e\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438, \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043a\u043e\u0434\u043e\u043c \u043d\u0430 Rust, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0443\u0432\u0435\u0440\u0435\u043d \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 Python \u0438 Rust. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441\u0432\u044f\u0437\u0438 \u0441 Python \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 e2e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. <\/p>\n<blockquote>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0432 Rust \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 <code>Vec&lt;u8><\/code>  \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0438 \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>PyBytes<\/code> \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c \u0441 PyO3.<\/p>\n<\/blockquote>\n<p><strong>\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441 Python.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441 Python, \u043c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u0430\u043c\u0438 Python \u0438 \u0442\u0438\u043f\u0430\u043c\u0438 Rust, \u043d\u043e \u043d\u0435 \u043b\u043e\u0433\u0438\u043a\u0443. \u0412\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u043f\u0440\u043e\u0438\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442 \u043c\u0435\u043d\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 &#8212; \u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Sphix. \u041c\u043e\u0438 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Rust \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 <a href=\"https:\/\/medium.com\/inside-in-sight\/documenting-native-python-extensions-made-with-rust-and-pyo3-227aff68e481\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b.<\/strong> \u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u043d\u0430\u044e, \u0433\u0434\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0434 &#8212; \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u0432\u044f\u0437\u0430\u043d \u0441 Python, \u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>*_py<\/code>, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>*_rs<\/code>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0445\u0430\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u043a \u043b\u043e\u0433\u0438\u043a\u0435, \u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 Python.<\/p>\n<p><strong>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0434\u0430.<\/strong> Rust \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0439; \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f Rust) \u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 Python, \u0442\u043e \u043e\u0434\u043d\u0443 \u0438\u0437 \u043d\u0438\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u043e-\u0445\u0438\u0442\u0440\u043e\u043c\u0443.<\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432 \u0434\u0443\u0445\u0435:<\/p>\n<pre><code class=\"rust\">fn callme(x: i64) -> i64 { ... }  #[pyfunction] #[pyo3(name = \"callme\")] fn callme_py(x: i64) -> i64 {     callme(x) }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"rust\">use lib_rs as rust;  #[pyfunction] fn callme(x: i64) -> i64 {     rust::callme(x) }<\/code><\/pre>\n<p><strong>\u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0431\u0435\u0437 Python.<\/strong> \u0422\u0430\u043a \u0431\u044b\u043b\u043e \u0441 Similari, \u043b\u044e\u0434\u0438 \u0445\u043e\u0442\u0435\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434 \u0431\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 Python. \u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <a href=\"https:\/\/github.com\/andreytkachenko\" rel=\"noopener noreferrer nofollow\"><u>Andrei Tkachenko<\/u><\/a> \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0431\u043e\u043b\u044c\u0448\u043e\u0439 PR, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 Python, \u0437\u0430 feature-\u0444\u043b\u0430\u0433.<\/p>\n<h2>\u041e\u0431\u0435\u0440\u0442\u043a\u0438 Python \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0437\u043d\u0430\u044f \u043c\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0432\u044b, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043d\u0430\u0447\u0430\u043b\u0438 \u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0447\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0414\u0430, \u044d\u0442\u043e \u0442\u0430\u043a, \u0432\u043c\u0435\u0441\u0442\u043e \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 <code>#[pyclass]<\/code> \u0443 \u043c\u0435\u043d\u044f \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">pub struct Object {     x: i32, }  impl Object {     pub fn inc(&amp;mut self) {         self.x += 1;     } }<\/code><\/pre>\n<pre><code class=\"rust\">use pyo3::prelude::*; use lib_rs as rust;  #[pyclass] struct Object(rust::Object);  #[pymethods] impl Object {     fn inc(&amp;mut self) {         self.0.inc()     } }<\/code><\/pre>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u043d\u0430\u0445\u043e\u0436\u0443 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u0434 \u0432 \u043a\u0440\u0435\u0439\u0442\u0435 <code>*_py<\/code>  \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u043c \u0438 \u043b\u0435\u0433\u043a\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f GitHub Copilot \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a.<\/p>\n<h2>\u041e\u0431\u0435\u0440\u0442\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 Python \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u0440\u0442\u0435\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Rust \u0432 \u0441\u0432\u043e\u0438\u0445 \u043a\u0440\u0435\u0439\u0442\u0430\u0445 <code>*_py<\/code> : \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0420\u0430\u043d\u0435\u0435 \u044f \u043f\u0438\u0441\u0430\u043b \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"rust\">struct Object {     inner: rust::Object }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0432\u0438\u0436\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e &#171;inner&#187;, \u0438\u043d\u043e\u0433\u0434\u0430 &#171;object&#187;, &#171;internal&#187; \u0438 \u0442.\u0434. \u042d\u0442\u043e \u0432\u043d\u043e\u0441\u0438\u0442 \u0445\u0430\u043e\u0441.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u0435\u043d\u0435\u0435 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u043f\u0440\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 <code>.0.<\/code> .<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>std::mem::transmute<\/code> ? \u0441 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f Option \u0438 Result \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443 \u0432\u0438\u0434\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">#[pyfunction] fn callme() -> Option&lt;Object> {     if ... {        None     } else {        let res_opt = Some(rust::Object);        res_opt.map(Object) \/\/ here it is         } }<\/code><\/pre>\n<p><strong>\u041c\u0430\u0433\u0438\u044f transmute.<\/strong> \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 <code>X<\/code> \u0438 <code>struct Y(X)<\/code> \u0432 Rust \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>transmute<\/code> \u043c\u043e\u0436\u043d\u043e &#171;<em>\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e<\/em>&#187; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Python \u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Rust \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 (<code>Vec&lt;T><\/code>) \u043c\u0435\u0436\u0434\u0443 <code>rust::Object<\/code> \u0438 Python&#8217;\u043e\u0432\u0441\u043a\u0438\u043c <code>Object<\/code>.<\/p>\n<p>\u041d\u0435 \u043f\u043e\u0439\u043c\u0438\u0442\u0435 \u043c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u044f \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0433\u0430\u043d\u0434\u0438\u0440\u0443\u044e <code>transmute<\/code> &#8212; \u044d\u0442\u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437 \u0437\u0430\u0442\u0440\u0430\u0442.<\/p>\n<pre><code class=\"rust\">struct X {   i: i64 }  struct W(X)  let x = X { i: 1 }; let w: W = unsafe { std::mem::transmute(x) }; let x: X = unsafe { std::mem::transmute(w) };  let vx = vec![X { i: 1 }]; let wx: Vec&lt;W> = unsafe { std::mem::transmute(vx) };<\/code><\/pre>\n<h2>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0431\u0435\u0437 \u043f\u043e\u043b\u0435\u0439<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e \u0438\u0445 \u0432 \u0434\u0432\u0443\u0445 \u043a\u0440\u0435\u0439\u0442\u0430\u0445 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u0440\u0435\u0439\u0442\u0435 <code>*_py<\/code> <code>trait From<\/code> \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"rust\">\/\/ in lib_rs  enum X {   A,   B, }  \/\/ in lib_py  enum X {   A,   B }  impl From&lt;rust::X> for X { ... }  impl From&lt;X> for rust::X { ... }<\/code><\/pre>\n<p>\u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0434\u0430\u044e\u0442 \u043c\u043d\u0435 \u043f\u043e\u043a\u043e\u044f. \u0422\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f PyO3, \u0438 \u044f \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 <code>#[pyclass]<\/code>, \u043d\u043e \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043e\u0442 PyO3, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 PyO3 \u0432 \u043c\u043e\u0439 \u043a\u0440\u0435\u0439\u0442 <code>*_rs<\/code>. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 <code>enums<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0434\u043b\u044f <code>lib_rs<\/code> \u0438 <code>lib_py<\/code>. \u042f \u0435\u0449\u0435 \u043d\u0435 \u0440\u0435\u0448\u0438\u043b.<\/p>\n<h2>Enum \u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c\u0438 \u043f\u043e\u043b\u044f<\/h2>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f PyO3. \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u043d\u0438\u043c\u0438 \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<pre><code class=\"rust\">use pyo3::prelude::*;  mod rust {     pub enum Pet {         Dog { name: String, age: u8 },         Hamster { name: String },     } }  #[pyclass] struct Pet(rust::Pet);  #[pyclass] struct Dog {     name: String,     age: u8, }  #[pyclass] struct Hamster {     name: String, }  #[pymethods] impl Pet {     fn is_dog(&amp;self) -> bool {         matches!(&amp;self.0, Dog { name: _, age: _ })     }      fn is_hamster(&amp;self) -> bool {         matches!(&amp;self.0, Hamster { name: _ })     }      fn as_dog(&amp;self) -> Option&lt;Dog> {         if let rust::Pet::Dog { name, age } = &amp;self.0 {             Some(Dog {                 name: name.clone(),                 age: *age,             })         }         None     }      fn as_hamster(&amp;self) -> Option&lt;Hamster> {         if let rust::Pet::Hamster { name } = &amp;self.0 {             Some(Hamster { name: name.clone() })         }         None     } }<\/code><\/pre>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 Python<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PyO3 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c Rust <code>Result<\/code> (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>anyhow<\/code>) \u0432 Python <code>PyResult<\/code>, \u0432\u0430\u0440\u0438\u0430\u043d\u0442  <code>Err<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Python-\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"rust\">use pyo3::exceptions::PyValueError; use pyo3::prelude::*;  mod rust {     use anyhow::Result;     pub fn u8_overflow_plus(add: u8, to: u8) -> Result&lt;u8> {         if add > u8::MAX - to {             bail!(\"overflow\")         } else {             Ok(add + to)         }     } }  #[pyfunction] fn u8_overflow_plus(add: u8, to: u8) -> PyResult&lt;u8> {     rust::u8_overflow_plus(add, to)         .map_err(|e| PyValueError::new_err(format!(\"u8_overflow_plus: {}\", e))) }  \/\/ in your Python code \/\/ \/\/ try: \/\/     u8_overflow_plus(255, 255) \/\/ except ValueError: \/\/     # impossible<\/code><\/pre>\n<p>\u042f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>Result<\/code> \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 PyO3 \u043e\u0447\u0435\u043d\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u0430\u044f: \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Rust, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 Python. \u042f \u043d\u0430\u0445\u043e\u0436\u0443 \u044d\u0442\u043e \u0432\u043e\u043b\u0448\u0435\u043d\u044b\u043c: \u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>Ok(smth)<\/code>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Python; \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>Err(e)<\/code> &#8212; \u043a\u043e\u0434 Python \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/h2>\n<p>Python \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0438\u0445 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f API. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445, \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445.<\/p>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b:<\/p>\n<pre><code class=\"rust\">#[pymethods] impl PersistentQueueWithCapacity {     #[new]     #[pyo3(signature=(path, max_elements = 1_000_000_000))]     fn new(path: &amp;str, max_elements: usize) -> PyResult&lt;Self> {     ... }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b (self \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b):<\/p>\n<pre><code class=\"rust\">#[pymethods] impl PersistentQueueWithCapacity {     #[pyo3(signature=(n = 1_000_000_000))]     fn set(&amp;mut self, n: usize) {     ... }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">#[pyfunction] #[pyo3(signature=(x=0, i=1))] fn inc(x: i64, i: i64) -> i64 { ... }  \/\/ can be called in python \/\/ inc() \/\/ inc(1) \/\/ inc(i=10) \/\/ inc(x=1, i=10) \/\/ inc(1, 10)<\/code><\/pre>\n<h2>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c <code>#[new]<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a <code>__init__<\/code> \u0432 Python. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 Rust, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u043c\u0435\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. <\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u044f \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 <code>#[staticmethod]<\/code>. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043d\u0430\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 <code>Pet<\/code> \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<pre><code class=\"rust\">use pyo3::prelude::*;  mod rust {     pub enum Pet {         Dog { name: String, age: u8 },         Hamster { name: String },     } }  #[pyclass] struct Pet(rust::Pet);  #[pyclass] struct Dog {     name: String,     age: u8, }  #[pyclass] struct Hamster {     name: String, }  #[pymethods] impl Pet {     #[staticmethod]     fn dog(name: String, age: u8) -> Self {         Self(rust::Pet::Dog { name, age })     }     #[staticmethod]     fn hamster(name: String) -> Self {         Self(rust::Pet::Hamster { name })     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u044f\u0437\u044b\u043a\u0435 Python \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">dog = Pet.dog(\"Pike\", 3) hamster = Pet.hamster(\"Wheely\")<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 GIL<\/h2>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 GIL \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439. \u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u044f \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 GIL. \u042d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0443\u0442\u0435\u043c \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 <code>1000\u043d\u0441<\/code>, \u0438 \u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044e GIL \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0435. \u0418\u043d\u043e\u0433\u0434\u0430 \u044f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0442\u044c GIL \u0438\u043b\u0438 \u043d\u0435\u0442. \u0412 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"rust\">#[pyo3(signature = (items, no_gil = true))] fn push(&amp;mut self, items: Vec&lt;&amp;PyBytes>, no_gil: bool) -> PyResult&lt;()> {     let data = items.iter().map(|e| e.as_bytes()).collect::&lt;Vec&lt;&amp;[u8]>>();     Python::with_gil(|py| {         let mut f = move || {             self.0                 .push(&amp;data)                 .map_err(|e| PyRuntimeError::new_err(format!(\"Failed to push item: {}\", e)))         };          if no_gil {             py.allow_threads(f)         } else {             f()         }     }) }<\/code><\/pre>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430, \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0435\u0449\u0435 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 GIL, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u0436\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0442\u044c GIL \u0438\u043b\u0438 \u043d\u0435\u0442 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 GIL \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u043e\u0445\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c? \u041f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043c\u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c GIL, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>ACQUIRE_GIL     &lt;&lt;&lt;&lt;&lt;   CALL function     DO STUFF   ENDCALL RELEASE_GIL<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c:<\/p>\n<pre><code>ACQUIRE_GIL     &lt;&lt;&lt;&lt;&lt;   CALL function     RELEASE_GIL       DO STUFF     ACQUIRE_GIL &lt;&lt;&lt;&lt;&lt;   ENDCALL RELEASE_GIL<\/code><\/pre>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 <code>ACQUIRE GIL<\/code> \u0434\u0432\u0435, \u0430 \u043d\u0435 \u043e\u0434\u043d\u0430, \u043a\u0430\u043a \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u041a\u0430\u0436\u0434\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>ACQUIRE GIL<\/code> &#8212; \u044d\u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 GIL, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438. \u041f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0437\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<blockquote>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448 \u043a\u043e\u0434 \u0432\u044b\u0437\u0432\u0430\u043b\u0441\u044f, \u043e\u043d \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0438 \u0443\u0436\u0435 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0437\u0430\u0445\u0432\u0430\u0442 GIL. \u042f \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044e GIL \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430, \u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<\/blockquote>\n<h2>PyBytes \u0432\u043c\u0435\u0441\u0442\u043e Vec&lt;u8><\/h2>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u0432 PyO3 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <code>&amp;Vec&lt;u8><\/code> \u0438\u043b\u0438 <code>&amp;[u8]<\/code>):<\/p>\n<pre><code class=\"rust\">#[pyfunction] fn bypass_and_ret(v: Vec&lt;u8>) -> Vec&lt;u8> {     v }<\/code><\/pre>\n<p>\u041e\u043d \u043c\u0435\u0434\u043b\u0438\u0442\u0435\u043b\u0435\u043d \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c: \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c Python <code>bytes<\/code> \u0438\u043b\u0438 <code>[1, 2, 3]<\/code>. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>&amp;PyBytes<\/code> (\u0434\u0430, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>&amp;<\/code>):<\/p>\n<pre><code class=\"rust\">use pyo3::prelude::*; use pyo3::types::PyBytes;  #[pyfunction] fn bypass_and_ret(v: &amp;PyBytes) -> PyObject {     let data = v.as_bytes();     Python::with_gil(|py| PyObject::from(PyBytes::new(py, data))) }<\/code><\/pre>\n<p>\u0412\u0430\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f GIL: \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0443\u0436\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442, \u0442\u043e \u0437\u0430\u0445\u0432\u0430\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439.<\/p>\n<h2>\u0412\u0435\u0440\u0441\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u044f \u043f\u043e\u043c\u0435\u0449\u0430\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>version()<\/code> \u0432 \u043f\u0430\u043a\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f \u0432\u0435\u0440\u043d\u0430 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043a\u043e\u0434\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0430 Python \u0438 Rust \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b.<\/p>\n<pre><code class=\"rust\">mod rust {     pub fn version() -> &amp;'static str { env!(\"CARGO_PKG_VERSION\") } }  #[pyfunction] fn version() -> String { rust::version() }L<\/code><\/pre>\n<p>\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0443\u0434\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430 &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043b\u0438\u0431\u0435, \u043d\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432 \u0440\u0435\u043a\u043b\u0430\u043c\u0435: &#171;\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0440\u0430\u0437, \u0435\u043c \u0438 \u0441\u0435\u0439\u0447\u0430\u0441&#187;. \u0422\u0430\u043a\u043e\u0439 \u0443\u0436 \u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a \ud83d\ude42<\/p>\n<h2>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b Python<\/h2>\n<p>\u0423 PyO3 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 Python. \u041f\u043e\u0433\u0443\u0433\u043b\u0438\u0432 \u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f, \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"rust\">#[pymodule] fn rocksq_blocking(_: Python, m: &amp;PyModule) -> PyResult&lt;()> {     Ok(()) }  #[pymodule] fn rocksq_nonblocking(_: Python, m: &amp;PyModule) -> PyResult&lt;()> {     Ok(()) }  #[pymodule] fn rocksq(py: Python, m: &amp;PyModule) -> PyResult&lt;()> {     m.add_function(wrap_pyfunction!(version, m)?)?;      m.add_wrapped(wrap_pymodule!(rocksq_blocking))?;     m.add_wrapped(wrap_pymodule!(rocksq_nonblocking))?;      let sys = PyModule::import(py, \"sys\")?;     let sys_modules: &amp;PyDict = sys.getattr(\"modules\")?.downcast()?;      sys_modules.set_item(\"rocksq.blocking\", m.getattr(\"rocksq_blocking\")?)?;     sys_modules.set_item(\"rocksq.nonblocking\", m.getattr(\"rocksq_nonblocking\")?)?;      Ok(()) }<\/code><\/pre>\n<h2>\u0412\u0435\u0434\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u043e\u0432<\/h2>\n<p>\u0412 PyO3 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0435\u0439\u0442 (<code>pyo3-log<\/code>), \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b\u044b Rust \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Python (\u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e PyO3):<\/p>\n<pre><code class=\"rust\">use log::info; use pyo3::prelude::*;  #[pyfunction] fn log_something() {     \/\/ This will use the logger installed in `my_module` to send the `info`     \/\/ message to the Python logging facilities.     info!(\"Something!\"); }  #[pymodule] fn my_module(_py: Python&lt;'_>, m: &amp;PyModule) -> PyResult&lt;()> {     \/\/ A good place to install the Rust -> Python logger.     pyo3_log::init();      m.add_function(wrap_pyfunction!(log_something))?;     Ok(()) }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u043f\u043e\u0439\u043c\u0435\u0442\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c GIL \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0447\u0442\u043e-\u0442\u043e \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442\u0435.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443: \u042f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>log<\/code> , \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 Rust \u0432 Python, \u0430 Python \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0430\u043f\u043f\u0435\u043d\u0434\u0435\u0440 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Rust. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/insight-platform\/savant-rs\/blob\/main\/savant_python\/src\/logging.rs\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0421\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b <code>__repr__<\/code> \u0438 <code>__str__<\/code> . \u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u0440\u0435\u0439\u0442 <code>Debug<\/code>, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434:<\/p>\n<pre><code class=\"rust\">impl Struct {     fn __repr__(&amp;self) -> String {         format!(\"{:?}\", &amp;self.0)     }      fn __str__(&amp;self) -> String {         self.__repr__()     } }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b Python, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<h2>\u0425\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u044d\u0448-\u043a\u043b\u044e\u0447\u0430, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e  \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f <code>__hash__<\/code> :<\/p>\n<pre><code class=\"rust\">impl Struct {     fn __hash__(&amp;self) -> u64 {         let mut hasher = DefaultHasher::new();         self.hash(&amp;mut hasher);         hasher.finish()     } }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0445\u043e\u0447\u0443 \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0435\u0439, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e:<\/p>\n<pre><code class=\"rust\">#[classattr] const __hash__: Option&lt;Py&lt;PyAny>> = None;<\/code><\/pre>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/h2>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u0442\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u0435\u0436\u0434\u0443 Rust \u0438 Python \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0438\u043c\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"rust\">#[pyclass] #[derive(Debug, Clone)] pub struct AttributeValuesView(Arc&lt;Vec&lt;rust::AttributeValue>>)<\/code><\/pre>\n<p>\u041c\u043e\u044f \u0446\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c API \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c <code>AttributeValue<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <code>attribute_value[i]<\/code>. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0435 (\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435) \u0438\u043b\u0438 \u0442\u0440\u0438 (\u0447\u0442\u0435\u043d\u0438\u0435-\u0437\u0430\u043f\u0438\u0441\u044c) dunder-\u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">#[pymethods] impl AttributeValuesView {     fn __getitem__(&amp;self, index: usize) -> PyResult&lt;AttributeValue> {         let v = self             .0             .get(index)             .ok_or(PyIndexError::new_err(\"index out of range\"))             .map(|x| x.clone())?;         Ok(AttributeValue(v))     }      fn __len__(&amp;self) -> PyResult&lt;usize> {         Ok(self.0.len())     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0442\u043e \u0432\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>__setitem__<\/code> dunder:<\/p>\n<pre><code class=\"rust\">fn __setitem__(&amp;mut self, idx: isize, value: impl FromPyObject) -> PyResult&lt;()> <\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0432 PyO3 \u0435\u0441\u0442\u044c <a href=\"https:\/\/pyo3.rs\/v0.14.5\/class\/protocols\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437\u0434\u0435\u043b<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h2>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 Python, \u043d\u0435 \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 Rust.<\/p>\n<p>\u0418\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Sphinx \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0432 \u043c\u043e\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/blog.savant-ai.io\/documenting-native-python-extensions-made-with-rust-and-pyo3-227aff68e481\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u042f \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<h2>\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u0432 PYPI<\/h2>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 Python. \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u043e \u0438 \u0441\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u043d\u043e \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u043b\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Docker \u0438 GitHub Actions (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b CI\/CD).<\/p>\n<p>\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u0442\u0430\u043a\u0438\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GitHub Actions \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0432 \u043c\u043e\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/blog.savant-ai.io\/building-portable-native-python-extensions-with-rust-pyo3-and-maturin-3c1a1634d324\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u042f \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<h2>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/h2>\n<p>\u042f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/insight-platform\/RocksQ\" rel=\"noopener noreferrer nofollow\">RocksQ<\/a> (\u043f\u0435\u0440\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 RocksDB), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0432\u0435\u0449\u0435\u0439, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043c\u043e\u0438\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f Python \u043d\u0430 Rust \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043e\u0432\u0435\u0442\u044b \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u0438\u0434\u0435\u0438 \u0438 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0438\u0445 \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c.<\/p>\n<\/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\/767254\/\"> https:\/\/habr.com\/ru\/articles\/767254\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u0412\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0438\u0434\u0435\u043b\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0442\u0435\u043c\u0443 &#171;Python, Rust &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0431\u043b\u0430-\u0431\u043b\u0430-\u0431\u043b\u0430&#8230; \u0412\u043e\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c foo2plus2&#187;. \u0412\u0441\u044f \u0431\u0435\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0440\u043e\u0432\u043d\u044f &#171;hello-world&#187;. \u041d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0435\u0439 \u0436\u0435 <a href=\"https:\/\/medium.com\/@kudryavtsev_ia\/how-i-design-and-develop-real-world-python-extensions-in-rust-2abfe2377182?source=friends_link&amp;sk=24c0727706dd86d564aa683084afed79\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043d\u0430 Medium. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u0442 \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f Python \u043d\u0430 Rust (<a href=\"https:\/\/github.com\/insight-platform\/FFmpeg-Input\" rel=\"noopener noreferrer nofollow\"><u>1<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\"><u>2<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/savant-rs\" rel=\"noopener noreferrer nofollow\"><u>3<\/u><\/a>,\u00a0<a href=\"https:\/\/github.com\/insight-platform\/RocksQ\" rel=\"noopener noreferrer nofollow\"><u>4<\/u><\/a>) \u0438 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u043f\u044b\u0442, \u043d\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0438\u0433 \u0442\u043e\u0439 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0430 \u0447\u0442\u043e \u043d\u0435\u0442. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043c\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043b\u044e\u0434\u044c\u043c\u0438, \u0434\u0440\u0443\u0433\u0438\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u0434\u043e\u043b\u0433\u0438\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430, \u0438 \u0432\u0441\u0435 \u0436\u0435, \u044f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Rust, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043c\u043e\u0435\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0431\u0430\u0432\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 &#8212; \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0444\u0435\u0439\u0441\u043f\u0430\u043b\u043c\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0448\u0430\u0440\u0435\u043d\u044b \u0432 Rust.<\/p>\n<h2>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u044b\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0438\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Rust \u0434\u043b\u044f Python: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\"><u>Similari<\/u><\/a> \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0445\u043e\u0434\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043a\u0430\u0447\u043e\u043a \u0432\u043f\u0435\u0440\u0435\u0434, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b PR \u043e\u0442 <a href=\"https:\/\/github.com\/andreytkachenko\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0434\u0440\u0435\u044f \u0422\u043a\u0430\u0447\u0435\u043d\u043a\u043e<\/a>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0430, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Sphinx \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0438 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 <a href=\"https:\/\/medium.com\/inside-in-sight\/documenting-native-python-extensions-made-with-rust-and-pyo3-227aff68e481\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u042f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432, \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0441\u0440\u0435\u0434\u0443 Manylinux \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Maturin GitHub Action, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"https:\/\/medium.com\/inside-in-sight\/building-portable-native-python-extensions-with-rust-pyo3-and-maturin-3c1a1634d324\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Rust \u0434\u043b\u044f Python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GitHub CI \u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432 Docker.<\/p>\n<p>\u0425\u043e\u0447\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c &#171;\u0441\u043f\u0430\u0441\u0438\u0431\u043e&#187; \u0432\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u043c\u043e\u0433 \u043c\u043d\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435: \u0432\u0441\u0435 \u0432\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0431\u0435\u0437 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0442\u0438\u0432\u044b \u0438 \u043b\u044e\u0434\u0435\u0439 \u0437\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435:<\/p>\n<ul>\n<li>\n<p>PyO3\u00a0<a href=\"https:\/\/github.com\/PyO3\/pyo3\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0438\u0445 \u0443\u0441\u0438\u043b\u0438\u044f \u043f\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f  \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/andreytkachenko\" rel=\"noopener noreferrer nofollow\"><u>Andrei Tkachenko<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>transmute<\/code> \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust \u0438 \u0437\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 Similari;<\/p>\n<\/li>\n<li>\n<p>Pola.rs project\u00a0<a href=\"https:\/\/www.pola.rs\/\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0438\u0434\u0435\u0438 \u043f\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0443 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>Pometry\/Raphtory\u00a0<a href=\"https:\/\/github.com\/Pometry\/Raphtory\" rel=\"noopener noreferrer nofollow\"><u>team<\/u><\/a>\u00a0\u2014 \u0437\u0430 \u0438\u0434\u0435\u0438 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Python \u043d\u0430 Rust.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0432\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 Rust \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 &#171;hello world&#187; \u0434\u043b\u044f Python \u043d\u0430 Rust \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PyO3. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 GIL \u0438 \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/h2>\n<p>Rust \u0438 Python \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0432 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u0432 Rust \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0438, \u0430 \u0432 Python &#8212; \u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430\u0445 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043a\u0443\u0447\u0435. <\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 Python, \u0432 Rust \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"rust\">type WrappedMutex = Arc&lt;Mutex&lt;T>>; \/\/ or type WrappedRwLock = Arc&lt;RwLock&lt;T>>;<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0432 Python \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d GIL &#8212; \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430, \u043e\u0431\u0449\u0430\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432 Rust \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439 \u0441 Python \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 (<code>&amp;mut<\/code> \u0438\u043b\u0438 <code>&amp;<\/code>) \u0438\u0437 Rust \u0432 Python \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Arc&lt;T><\/code>. <\/p>\n<p>\u0412 PyO3 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 Python \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 Rust-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u043d\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430: \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Rust-\u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 Python. PyO3 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Rust \u0432 Python \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f \u0438\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Python (<code>PyObject<\/code>).<\/p>\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 GIL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 GIL \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0439\u0442\u0430 <code>Ungil<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e \u0441\u0443\u0442\u0438, <a href=\"https:\/\/github.com\/PyO3\/pyo3\/blob\/b03c4cb33cc30da738270a4db8322d5d9b74fb8c\/src\/marker.rs#L182\" rel=\"noopener noreferrer nofollow\">\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f<\/a> <code>Send<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 Python \u0438 Rust, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 <code>Arc&lt;T><\/code> \u0438\u043b\u0438 <code>Arc&lt;Mutex&lt;T>>.<\/code><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Python:<\/p>\n<pre><code class=\"rust\">use pyo3::prelude::*;  #[pyclass] struct Object {     x: i32, }  #[pymethods] impl Object {     fn inc(&amp;mut self) {         self.x += 1;     } }<\/code><\/pre>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e Rust, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0438\u0437 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">#[pyfunction] fn callme(o: &amp;mut Object) {     o.inc(); }<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 Rust \u043a\u0430\u043a \u043a\u043e\u043f\u0438\u044e (<code>Clone<\/code>) &#8212; \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 Python \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442:<\/p>\n<pre><code class=\"rust\">#[pyfunction] fn callme(mut o: Object) {     o.inc(); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0437 Rust \u0438 Python:<\/p>\n<pre><code class=\"rust\">use parking_lot::Mutex; use pyo3::prelude::*; use std::sync::Arc;  struct Object {     x: i32, }  impl Object {     fn inc(&amp;mut self) {         self.x += 1;     } }  #[pyclass] #[pyo3(name = \"Object\")] #[derive(Clone)] struct ObjectWrapper(Arc&lt;Mutex&lt;Object>>);  #[pymethods] impl ObjectWrapper {     fn inc(&amp;self) {         let mut bound = self.0.lock();         bound.inc();     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u043c\u0435\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u0432 Python, \u0442\u0430\u043a \u0438 \u0432 Rust, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">thread_local! {     static OBJECT: ObjectWrapper = ObjectWrapper(Arc::new(Mutex::new(Object { x: 0 }))) }  #[pyfunction] fn get_shared_object() -> ObjectWrapper {     OBJECT.with(|o| o.clone()) }  #[pyfunction] fn callme(o: &amp;mut ObjectWrapper) {     o.inc(); }<\/code><\/pre>\n<p>\u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437 Python \u0438 Rust (\u0432 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440). <code>Mutex&lt;T><\/code> \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u043e\u0442 \u0433\u043e\u043d\u043a\u0438, \u0430 <code>Arc&lt;T><\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>RwLock&lt;T><\/code>.<\/p>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0443\u044e \u0432 Python \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 Rust. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c Python \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 Python:<\/p>\n<pre><code class=\"rust\">fn callme&lt;'p>(slf: PyRef&lt;'p, Self>, _py: Python&lt;'p>) -> PyResult&lt;PyRef&lt;'p, Self>> {     let o = slf.deref();     ...     Ok(slf) }<\/code><\/pre>\n<p>\u0421\u0444\u0435\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430, \u043d\u043e \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u043b\u0434\u0435\u0440\u043e\u0432 \u0438\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>with<\/code>.<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 PyO3, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u0434\u043e\u043c . \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u044f \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c, \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e PyO3, \u0432\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u0441\u0435\u0431\u0435 \u043a\u0430\u043a Rust-\u043a\u043e\u0434, \u0442\u0430\u043a \u0438 Python-\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u0435\u0441\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0441 Python &#8212; \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u0435\u0437 Python \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u0435\u0437 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u043c\u0435\u043d \u0438 feature-\u0444\u043b\u0430\u0433\u043e\u0432, \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044f \u043a\u043e\u0434, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 Python, \u0437\u0430 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 (\u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 <a href=\"https:\/\/github.com\/insight-platform\/Similari\" rel=\"noopener noreferrer nofollow\">Similari<\/a>);<\/p>\n<\/li>\n<li>\n<p>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0440\u0435\u0439\u0442\u043e\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e (<a href=\"https:\/\/github.com\/insight-platform\/savant-rs\" rel=\"noopener noreferrer nofollow\">Savant-RS<\/a>, <a href=\"https:\/\/github.com\/insight-platform\/RocksQ\" rel=\"noopener noreferrer nofollow\">RocksQ<\/a>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 RocksQ \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0440\u0435\u0439\u0442\u0430\u043c\u0438:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0443 \u043c\u0435\u043d\u044f \u0434\u0432\u0430 \u043a\u0440\u0435\u0439\u0442\u0430: \u0432 <code>queue_rs<\/code> \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e Python. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 Python. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e \u0440\u044f\u0434\u0443 \u043f\u0440\u0438\u0447\u0438\u043d. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0438\u0445.<\/p>\n<p><strong>\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043d\u0430 Rust.<\/strong> \u042f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0439 \u043a\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0438 \u0435\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 PyO3 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0447\u0430\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0435\u0437 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0434\u044b Python, \u0447\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0438\u043d\u0435\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 GIL \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043e\u0434, \u0432\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0435 \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<blockquote>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>PyBytes<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0440\u0435\u0434\u0443 Python \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u042f \u0436\u0435 \u043d\u0435 \u0445\u043e\u0447\u0443 \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439.<\/p>\n<\/blockquote>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c\u0443, \u044f \u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u043e \u0431\u0435\u0437 \u0442\u0438\u043f\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 Python, \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 PyO3.<\/p>\n<p>\u041c\u043e\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438, \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043a\u043e\u0434\u043e\u043c \u043d\u0430 Rust, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0443\u0432\u0435\u0440\u0435\u043d \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 Python \u0438 Rust. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441\u0432\u044f\u0437\u0438 \u0441 Python \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 e2e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. <\/p>\n<blockquote>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0432 Rust \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 <code>Vec&lt;u8><\/code>  \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0438 \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>PyBytes<\/code> \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c \u0441 PyO3.<\/p>\n<\/blockquote>\n<p><strong>\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441 Python.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441 Python, \u043c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u0430\u043c\u0438 Python \u0438 \u0442\u0438\u043f\u0430\u043c\u0438 Rust, \u043d\u043e \u043d\u0435 \u043b\u043e\u0433\u0438\u043a\u0443. \u0412\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0440\u0435\u0439\u0442\u0435 \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u043f\u0440\u043e\u0438\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442 \u043c\u0435\u043d\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 &#8212; \u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Sphix. \u041c\u043e\u0438 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Rust \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 <a href=\"https:\/\/medium.com\/inside-in-sight\/documenting-native-python-extensions-made-with-rust-and-pyo3-227aff68e481\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b.<\/strong> \u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u043d\u0430\u044e, \u0433\u0434\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0434 &#8212; \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u0432\u044f\u0437\u0430\u043d \u0441 Python, \u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>*_py<\/code>, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>*_rs<\/code>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0445\u0430\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u043a \u043b\u043e\u0433\u0438\u043a\u0435, \u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 Python.<\/p>\n<p><strong>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0434\u0430.<\/strong> Rust \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0439; \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/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-357419","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357419","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=357419"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357419\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}