{"id":12032,"date":"2021-04-18T16:18:18","date_gmt":"2021-04-18T16:18:18","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=12032"},"modified":"2023-06-26T18:45:24","modified_gmt":"2023-06-26T18:45:24","slug":"rust-programming","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=12032","title":{"rendered":"Rust Programming"},"content":{"rendered":"<h3>Developer Survey<\/h3>\n<p><a href=\"https:\/\/twitter.com\/rustlang\/status\/1539710445078167555\">Rust language: Stack Overflow Developer Survey<\/a>, 22. Juni 2022<br \/>\n<a href=\"https:\/\/survey.stackoverflow.co\/2023\/\">Stack Overflow Developer Survey 2023<\/a><br \/>\n<a href=\"https:\/\/survey.stackoverflow.co\/2022\">Stack Overflow Developer Survey 2022<\/a><br \/>\n<a href=\"https:\/\/www.dice.com\/career-advice\/10-most-loved-programming-languages-rust-typescript-more\">10 Most Loved Programming Languages: Rust, TypeScript, and More<\/a>, May 29, 2020<\/p>\n<h3>Documentation<\/h3>\n<p><a href=\"https:\/\/doc.rust-lang.org\/reference\/index.html\">The Rust Reference<\/a><br \/>\n<a href=\"https:\/\/doc.rust-lang.org\/book\/index.html\">The Rust Programming Language<\/a><\/p>\n<ul>\n<li><a href=\"https:\/\/web.mit.edu\/rust-lang_v1.25\/arch\/amd64_ubuntu1404\/share\/doc\/rust\/html\/book\/second-edition\/ch17-01-what-is-oo.html\">17.1. What Does Object-Oriented Mean?<\/a><\/li>\n<li><a href=\"https:\/\/doc.rust-lang.org\/book\/ch17-01-what-is-oo.html\">17.1. Characteristics of Object-Oriented Languages<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/rust-lang.github.io\/async-book\/\">Asynchronous Programming in Rust<\/a><\/p>\n<p><a href=\"https:\/\/doc.rust-lang.org\/stable\/rust-by-example\/\">Rust by Example<\/a><br \/>\n<a href=\"https:\/\/github.com\/rust-lang\/rust-by-example\">github.com\/rust-lang\/rust-by-example<\/a><br \/>\n<a href=\"https:\/\/practice.rs\/why-exercise.html\">Rust By Practice<\/a><\/p>\n<h3>Blog<\/h3>\n<p><a href=\"https:\/\/blog.rust-lang.org\/2015\/04\/10\/Fearless-Concurrency.html\">Fearless Concurrency with Rust<\/a><br \/>\n<a href=\"https:\/\/blog.rust-lang.org\/2015\/05\/11\/traits.html\">Abstraction without overhead: traits in Rust<\/a><\/p>\n<p><a href=\"https:\/\/smallcultfollowing.com\/babysteps\/blog\/2015\/05\/05\/where-rusts-enum-shines\/\">Virtual Structs Part 1: Where Rust&#8217;s enum shines<\/a><br \/>\n<a href=\"https:\/\/smallcultfollowing.com\/babysteps\/blog\/2015\/05\/29\/classes-strike-back\/\">Virtual Structs Part 2: Classes strike back<\/a><br \/>\n<a href=\"https:\/\/smallcultfollowing.com\/babysteps\/blog\/2015\/08\/20\/virtual-structs-part-3-bringing-enums-and-structs-together\/\">Virtual Structs Part 3: Bringing Enums and Structs Together<\/a><\/p>\n<h3>Unsafe<\/h3>\n<p><a href=\"https:\/\/doc.rust-lang.org\/nomicon\/index.html\">The Rustonomicon<\/a><\/p>\n<ul>\n<li>the meaning of (un)safety<\/li>\n<li>unsafe primitives provided by the language and standard library<\/li>\n<li>techniques for creating safe abstractions with those unsafe primitives<\/li>\n<li>subtyping and variance<\/li>\n<li>exception-safety (panic\/unwind-safety)<\/li>\n<li>working with uninitialized memory<\/li>\n<li>type punning<\/li>\n<li>concurrency<\/li>\n<li>interoperating with other languages (FFI)<\/li>\n<li>optimization tricks<\/li>\n<li>how constructs lower to compiler\/OS\/hardware primitives<\/li>\n<li>how to not make the memory model people angry<\/li>\n<li>how you&#8217;re going to make the memory model people angry<\/li>\n<\/ul>\n<p><!-- ----------------------------------------------------------------------- --><\/p>\n<hr\/>\n<h1>Books<\/h1>\n<p><a href=\"https:\/\/www.newline.co\/books\/fullstack-rust\/adding-state-to-our-web-app\">Fullstack Rust &#8211; Adding State to Our Web App<\/a><\/p>\n<p><!-- ----------------------------------------------------------------------- --><\/p>\n<hr\/>\n<h1>Syntax<\/h1>\n<h3>unit type<\/h3>\n<p><a href=\"https:\/\/doc.rust-lang.org\/std\/primitive.unit.html\">Primitive Type unit<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/24842271\/what-is-the-purpose-of-the-unit-type-in-rust\">What is the purpose of the unit type in Rust?<\/a><\/p>\n<h3>Option and Result<\/h3>\n<p><a href=\"https:\/\/doc.rust-lang.org\/std\/option\/\">Module std::option<\/a><br \/>\n<a href=\"https:\/\/doc.rust-lang.org\/std\/result\/\">Module std::result<\/a><br \/>\n<a href=\"https:\/\/blog.logrocket.com\/understanding-rust-option-results-enums\/\">Understanding Rust Option and Result enums<\/a><\/p>\n<h3>static<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nfn spawn&lt;F&gt;(f: F) where F: 'static, ...\r\nfn scoped&lt;'a, F&gt;(f: F) -&gt; JoinGuard&lt;'a&gt; where F: 'a, ...\r\n<\/pre>\n<p>constraint<\/p>\n<table>\n<tr>\n<td><code>'static<\/code><\/td>\n<td>no borrowed data is permitted in the closure<\/td>\n<\/tr>\n<tr>\n<td><code>'a<\/code><\/td>\n<td>cannot escape the scope of any data borrowed by the closure<\/td>\n<\/tr>\n<\/table>\n<h3>trait<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ntrait ClickCallback {\r\n    fn on_click(&amp;self, x: i64, y: i64);\r\n}\r\nstruct Button {\r\n    listeners: Vec&lt;Box&lt;ClickCallback&gt;&gt;,\r\n    ...\r\n}\r\n<\/pre>\n<p>trait object<\/p>\n<ul>\n<li>traits are types, but they are &#8220;unsized&#8221;<\/li>\n<li>they are only allowed to show up behind a pointer like <code>Box <\/code> (which points onto the heap) or <code>&<\/code> (which can point anywhere)<\/li>\n<li>Static and dynamic dispatch<\/li>\n<\/ul>\n<table>\n<tr>\n<td><code>&ClickCallback<\/code><\/td>\n<td>no borrowed data is permitted in the closure<\/td>\n<\/tr>\n<tr>\n<td><code>Box<ClickCallback><\/code><\/td>\n<td>cannot escape the scope of any data borrowed by the closure<\/td>\n<\/tr>\n<\/table>\n<h3>Future trait<\/h3>\n<p><a href=\"https:\/\/rust-lang.github.io\/async-book\/02_execution\/02_future.html\">The Future Trait<\/a><br \/>\n<a href=\"https:\/\/rust-lang.github.io\/async-book\/02_execution\/04_executor.html\">Build an Executor<\/a><\/p>\n<p><!-- ----------------------------------------------------------------------- --><\/p>\n<hr\/>\n<h1>Tutorials<\/h1>\n<h3>NICLAS ROSSBERGER<\/h3>\n<p><a href=\"https:\/\/nidomiro.de\/code\/learning-rust\/01-why-learning-rust\/\">Rust-01: Why am I learning Rust?<\/a><br \/>\n<a href=\"https:\/\/nidomiro.de\/code\/learning-rust\/02-the-beginning\/\">Rust-02: The beginning<\/a><br \/>\n<a href=\"https:\/\/nidomiro.de\/code\/learning-rust\/03-improving-the-simple-program\/\">Rust-03: Improving the simple program<\/a><\/p>\n<h3>Medium<\/h3>\n<p><a href=\"https:\/\/glaubercosta-11125.medium.com\/c-vs-rust-an-async-thread-per-core-story-28c4b43c410c\">C++ vs Rust: an async Thread-per-Core story<\/a><\/p>\n<p><a href=\"https:\/\/www.sitepoint.com\/rust-global-variables\/\">How to Idiomatically Use Global Variables in Rust<\/a><\/p>\n<h3>Java<\/h3>\n<p><a href=\"https:\/\/www.baeldung.com\/java-executor-wait-for-threads\">ExecutorService \u2013 Waiting for Threads to Finish<\/a><br \/>\n<a href=\"https:\/\/www.baeldung.com\/java-future\">Guide to java.util.concurrent.Future<\/a><\/p>\n<p><!-- ----------------------------------------------------------------------- --><\/p>\n<hr\/>\n<h1>YouTube<\/h1>\n<h3>Andrew Sharp<\/h3>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=bNy_Md8dx94\">Learn Rust Part 1: numbers, variables, types and functions<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=eH4crgsnDyM\">Learn Rust Part 2: Structs<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=0EJQfXbbsTg\">Learn Rust Part 3: References<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=QNQ4MbD3tpI\">Learn Rust Part 4: Mutable References<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=EDcc8O3MHRc\">Learn Rust Part 5: Ownership<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=613qn2E61Po\">Learn Rust Part 6: Borrowing<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=hhu_kW5Q95Y\">Learn Rust Part 7: Lifetimes<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=jSrcIRxpNoA\">Learn Rust Part 8: Lifetimes with Structs<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=DGIP3I153K4\">Learn Rust Part 9: Constant Items and the Static Lifetime<\/a><br \/>\n<a href=\"https:\/\/www.youtube.com\/watch?v=JhVpjWkYZ_A\">Learn Rust Part 10: Methods and Associated Functions<\/a><\/p>\n<h3>Dave Halter<\/h3>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=RvAVnH8PTcI\">Rust f\u00fcr Python Developers (english) | Swiss Python Summit 2022<\/a><br \/>\n<a href=\"https:\/\/github.com\/davidhalter\/rust-for-python-developers\">github.com\/davidhalter\/rust-for-python-developers<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Developer Survey Rust language: Stack Overflow Developer Survey, 22. Juni 2022 Stack Overflow Developer Survey 2023 Stack Overflow Developer Survey 2022 10 Most Loved Programming Languages: Rust, TypeScript, and More, May 29, 2020 Documentation The Rust Reference The Rust Programming Language 17.1. What Does Object-Oriented Mean? 17.1. Characteristics of Object-Oriented Languages Asynchronous Programming in Rust [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12032","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12032"}],"version-history":[{"count":18,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12032\/revisions"}],"predecessor-version":[{"id":14110,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12032\/revisions\/14110"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}