{"id":8138,"date":"2021-10-03T09:39:31","date_gmt":"2021-10-03T09:39:31","guid":{"rendered":"http:\/\/TheNextWeb=1368742"},"modified":"2021-10-03T09:39:31","modified_gmt":"2021-10-03T09:39:31","slug":"thought-you-loved-python-wait-until-you-meet-rust","status":"publish","type":"post","link":"https:\/\/www.londonchiropracter.com\/?p=8138","title":{"rendered":"Thought you loved Python? Wait until you meet Rust"},"content":{"rendered":"\n<p>\u201cTechnology from the past comes to save the future from itself.\u201d That\u2019s how Graydon Hoare, the creator of Rust, <a href=\"https:\/\/steveklabnik.com\/writing\/rust-is-more-than-safety\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">describes what he wants to achieve<\/a>.<\/p>\n<p>That\u2019s one of the key hallmarks of Rust: using technologies that are well-known to academia but rarely implemented in contemporary programming languages. Technologies that are old, reliable, and sometimes forgotten. But which, above all, work extremely well.<\/p>\n<p>These technologies are used mainly for one thing: safety.<\/p>\n<p>Sounds boring? It is not, if you ask the community. A <a href=\"https:\/\/insights.stackoverflow.com\/survey\/2021#most-loved-dreaded-and-wanted-language-love-dread\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">whopping 87 percent of Rust developers love this language<\/a> above all others, making it the most-loved language since 2016 according to this year\u2019s StackOverflow developer survey.<\/p>\n<p>You\u2019d think that software developers are among the most innovative humans on this planet. Rust, however, is the exact opposite of the \u201cmove fast and break things\u201d mantra. Nevertheless, Rust developers are almost guaranteed to learn concepts they\u2019ve never heard about before.<\/p>\n<p>From the novelty of systems programming for some developers over algebraic data types to Rust\u2019s very own approach to memory safety: Every developer can find something new and incredibly useful to learn. And <a href=\"https:\/\/stackoverflow.blog\/2020\/01\/20\/what-is-rust-and-why-is-it-so-popular\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">there are more reasons<\/a> to fall in love with Rust.<\/p>\n<h2 id=\"2391\" class=\"na nb gr bf nc nd ne kt nf ng nh kw ni nj nk nl nm nn no np nq nr ns nt nu nv hy\">More memory safety without garbage collection<\/h2>\n<p>One challenge of every programming language is managing a computer\u2019s memory in a safe and efficient way. Python, for example, has a garbage collector that constantly looks out for no longer used memory and cleans it up while the program runs.<\/p>\n<p>In other languages, like C and C++, the programmer must explicitly allocate and free memory as they go. Since all memory-related problems are therefore cleared before the program runs, this approach is much better for optimizing performance.<\/p>\n<p>On the other hand, memory is yet another thing that developers need to think about all the time. This is one of the reasons why it takes much longer to write a program in C than in Python, even if it does the same thing at the end of the day.<\/p>\n<p>Rust goes an alternative way: Memory is allocated through a system of ownership at compile time. It\u2019s a neat hack to ensure that unused data is being cleaned without forcing the programmer to think about allocating and freeing memory all the time.<\/p>\n<p><span>Basically, ownership is a collection of three&nbsp;<\/span><a class=\"ek ko\" href=\"https:\/\/doc.rust-lang.org\/book\/ch04-01-what-is-ownership.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">rules<\/a><span>:<\/span><\/p>\n<ol class>\n<li id=\"7388\" class=\"kp kq gr kr b ia ks kt ku id kv kw kx ky kz la lb lc ld le lf lg lh li lj lk oi oj ok hy\" data-selectable-paragraph>Each value in Rust has a variable called owner.<\/li>\n<li id=\"ea2e\" class=\"kp kq gr kr b ia ol kt ku id om kw kx ky on la lb lc oo le lf lg op li lj lk oi oj ok hy\" data-selectable-paragraph>There can only be one owner at a time.<\/li>\n<li id=\"e533\" class=\"kp kq gr kr b ia ol kt ku id om kw kx ky on la lb lc oo le lf lg op li lj lk oi oj ok hy\" data-selectable-paragraph>When the owner goes out of scope, the value will be dropped, thus freeing memory.<\/li>\n<\/ol>\n<p><span>A simple example is assigning a vector in Rust:<\/span><\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368735 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23.png\" alt width=\"675\" height=\"130\" sizes=\"(max-width: 675px) 100vw, 675px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23.png 675w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-280x54.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-270x52.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-540x104.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368735 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23.png\" alt width=\"675\" height=\"130\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23.png 675w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-280x54.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-270x52.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.34.23-540x104.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p>In the second line, the vector [1, 2, 3] with the owner a is created. After that, b becomes the owner of the vector. Since the correct owner is called in the print statement, this program compiles and returns the expected result when executed:<\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368737 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54.png\" alt width=\"677\" height=\"60\" sizes=\"(max-width: 677px) 100vw, 677px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-280x25.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-270x24.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-540x48.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368737 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54.png\" alt width=\"677\" height=\"60\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-280x25.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-270x24.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.36.54-540x48.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p>On the other hand, you could try to call the vector with its previous owner, A, like so:<\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368736 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40.png\" alt width=\"677\" height=\"132\" sizes=\"(max-width: 677px) 100vw, 677px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-280x55.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-270x53.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-540x105.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368736 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40.png\" alt width=\"677\" height=\"132\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-280x55.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-270x53.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.35.40-540x105.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p>In this case, the compiler throws an error because a has already been dropped in the third line. There is <a href=\"https:\/\/depth-first.com\/articles\/2020\/01\/27\/rust-ownership-by-example\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">a lot more depth<\/a> to the subject, but this is the basic idea.<\/p>\n<p>In comparison, Python would run through in the second case. Its garbage collector would drop A only after the last time that it is called, which is nice for the developer but not so nice in terms of memory space.<\/p>\n<p>In C, things would be a bit more complicated: you would have to allocate memory space for a, then point it to the vector, then allocate more memory space for B, point B to A, and finally free the space taken up by A and B when you\u2019re done.<\/p>\n<p>In this sense, the approach of Rust to memory is a compromise between developing speed and performance. While it is not as dead-easy to write as Python, it\u2019s not as clunky as C once you\u2019ve understood the concept of ownership.<\/p>\n<p>On the other hand, the efficiency is quite astounding: The developer team at Tilde, for example, managed to r<a href=\"https:\/\/www.rust-lang.org\/static\/pdfs\/Rust-Tilde-Whitepaper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">educe their memory usage by 90 percent<\/a> after rewriting some JavaHTTP pieces in Rust.<\/p>\n<h2 id=\"6d06\" class=\"na nb gr bf nc nd ne kt nf ng nh kw ni nj nk nl nm nn no np nq nr ns nt nu nv hy\">Static typing without getting ugly<\/h2>\n<p>It\u2019s almost a religious war between fans of dynamic typing versus static typing. While it\u2019s much easier to produce software in languages with dynamic typing, the code can become unmaintainable pretty quickly. This is one of the reasons why Python code can be quite hard to maintain, compared to C for example.<\/p>\n<p>On the other hand, having to declare the type of each variable C-style can get rather annoying. If you\u2019ve ever tried to use a [double] in a function that returns a [float] type in C, you know what I mean.<\/p>\n<p>Rust goes a middle way: It\u2019s a static type system, but it only requires the programmer to specify top-level types like function arguments and constants. Inside function bodies, Python-style type inference is allowed.<\/p>\n<p><a href=\"https:\/\/learning-rust.github.io\/docs\/e3.option_and_result.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">One particularly useful feature<\/a> of Rust is that it has a None type as well. This allows you to handle exceptions at compile-time so that the program is guaranteed to run smoothly at the end-user. Consider this example, where we can get the full name of a person regardless of whether he has a middle name or not:<\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368738 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57.png\" alt width=\"677\" height=\"297\" sizes=\"(max-width: 677px) 100vw, 677px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-280x123.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-270x118.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-540x237.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368738 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57.png\" alt width=\"677\" height=\"297\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57.png 677w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-280x123.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-270x118.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.43.57-540x237.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p>While versions of the None workaround exist in other languages, too, it showcases the ambition of Rust in a neat way: not making things too hard for writing while keeping the code as durable and maintainable as possible.<\/p>\n<p>While Python is a general-purpose programming language, Rust is, like C, decidedly for systems programming. While Rust isn\u2019t the ideal language if you\u2019re making an application for your end-user, it is perfect for building pieces of software that provide services to other software.<\/p>\n<h2>A nifty approach to systems programming<\/h2>\n<p>As such, efficiency is at the core Rust. That\u2019s best demonstrated by zero-cost abstractions, which interpret code while keeping memory usage to a minimum. As Bjarne Stroustrup, the inventor of C++, <a href=\"https:\/\/www.stroustrup.com\/ETAPS-corrected-draft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">puts it<\/a>: \u201cWhat you don\u2019t use, you don\u2019t pay for. And further: What you do use, you couldn\u2019t hand code any better.\u201d<\/p>\n<p>For example, consider adding all integer numbers up to 1,000 in Python:<\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368739 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05.png\" alt width=\"678\" height=\"55\" sizes=\"(max-width: 678px) 100vw, 678px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05.png 678w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-280x23.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-270x22.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-540x44.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368739 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05.png\" alt width=\"678\" height=\"55\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05.png 678w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-280x23.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-270x22.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.47.05-540x44.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p><span>This does 1,000 iterations and additions every time the code runs \u2014 and you can imagine how much that can slow the code down. In contrast, consider the same thing in Rust:<\/span><\/p>\n<p><figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368740 aligncenter js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20.png\" alt width=\"676\" height=\"61\" sizes=\"(max-width: 676px) 100vw, 676px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20.png 676w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-280x25.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-270x24.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-540x49.png 540w\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1368740 aligncenter\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20.png\" alt width=\"676\" height=\"61\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20.png 676w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-280x25.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-270x24.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/10\/Screenshot-2021-10-03-at-10.48.20-540x49.png 540w\"><\/noscript><\/figure>\n<\/p>\n<p>This compiles down to the constant 499500. Effectively, the memory usage has just been decreased by a factor of 1,000.<\/p>\n<p>While these abstractions exist in C as well, Rust makes heavy use of them \u2014 in fact, one goal is to add as many zero-cost abstractions to the language as possible. In this sense, Rust is a bit like next-level C.<\/p>\n<p>C has been around for more than 40 years, and Rust aims to do the same. Rust places such a high emphasis on backwards-compatibility that you can still run code in Rust 1.0 today. Likewise, if you write Rust code today, you should still be able to run it in twenty years. Rust won\u2019t get rusty!<\/p>\n<h2 id=\"f95f\" class=\"na nb gr bf nc nd ne kt nf ng nh kw ni nj nk nl nm nn no np nq nr ns nt nu nv hy\">A small but incredible community<\/h2>\n<p>With its emphasis on safety and sustainability and all its nifty details speaking for it, it\u2019s no wonder that <a href=\"https:\/\/dropbox.tech\/infrastructure\/rewriting-the-heart-of-our-sync-engine\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Dropbox has rewritten a lot of its core structure<\/a> in Rust. Mozilla, Rust\u2019s first big sponsor, has <a href=\"https:\/\/medium.com\/mozilla-tech\/a-quantum-leap-for-the-web-a3b7174b3c12\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">written vital parts of Firefox in it<\/a>. Microsoft deems C and C++ <a href=\"https:\/\/thenewstack.io\/microsoft-rust-is-the-industrys-best-chance-at-safe-systems-programming\/#\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">no longer safe for mission-critical software<\/a> and is investing more and more in Rust.<\/p>\n<p>And it\u2019s not only big corporations \u2014 the love for Rust translates down to the individual programmer. Even though only five percent of StackOverflow\u2019s survey respondents use Rust so far, these developers are extremely enthusiastic about the language.<\/p>\n<p>And there are reasons for that. Not only are the language specification and the compiler very well thought through. There is rustup to install and manage toolchains. There\u2019s Cargo, a command line tool that comes with each Rust installation and helps manage dependencies, run tests and generate documentation.<\/p>\n<p>There\u2019s <a href=\"https:\/\/crates.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">crates.io<\/a> where users can share and discover libraries, and docs.rs where they are documented. There are<a href=\"https:\/\/github.com\/rust-lang\/rust-clippy\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"> compiler lints from Clippy<\/a> and <a href=\"https:\/\/github.com\/rust-lang\/rustfmt\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">automatic formatting from rustfmt<\/a>.<\/p>\n<p>Beyond that, there are official and unofficial chats, subreddits, user\u2019s forums, StackOverflow questions, and conferences all over the world. With a c<a href=\"https:\/\/steveklabnik.com\/writing\/rust-is-more-than-safety\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">ommunity that puts friendliness above everything<\/a>, is there anything more to ask for?<\/p>\n<h2 id=\"c4a4\" class=\"na nb gr bf nc nd ne kt nf ng nh kw ni nj nk nl nm nn no np nq nr ns nt nu nv hy\">The downside: the need to run before you can walk<\/h2>\n<p id=\"fa49\" class=\"kp kq gr kr b ia nw kt ku id nx kw kx ky ny la lb lc nz le lf lg oa li lj lk gk hy\" data-selectable-paragraph>The one thing that is discouraging about Rust is the high startup cost. While you would need one or two days to get productive in most languages, it\u2019s more like one or two weeks in Rust.<\/p>\n<p id=\"c6ad\" class=\"kp kq gr kr b ia ks kt ku id kv kw kx ky kz la lb lc ld le lf lg lh li lj lk gk hy\" data-selectable-paragraph>This is due to the many new concepts that other languages don\u2019t use, and the fact that there are typically a lot of errors at compile time. You need to handle all exceptions on day one, and can\u2019t just write a scratch code that runs and add exceptions later, like you\u2019d do in Python.<\/p>\n<p id=\"0817\" class=\"kp kq gr kr b ia ks kt ku id kv kw kx ky kz la lb lc ld le lf lg lh li lj lk gk hy\" data-selectable-paragraph>In addition, since Rust is still pretty new, not all libraries that you might want are there yet. Apart from the official documentation and various questions on StackOverflow, there are also not that many tutorials.<\/p>\n<p id=\"b499\" class=\"kp kq gr kr b ia ks kt ku id kv kw kx ky kz la lb lc ld le lf lg lh li lj lk gk hy\" data-selectable-paragraph>The good news is that once you\u2019ve learned the concepts and got your program compiled, it runs through like a charm. Plus, it should still work in twenty years given the backwards-compatibility.<\/p>\n<p id=\"6596\" class=\"kp kq gr kr b ia ks kt ku id kv kw kx ky kz la lb lc ld le lf lg lh li lj lk gk hy\" data-selectable-paragraph>Given the sustainability of your code and the fact that Rust is backed by a number of large corporations, one or two weeks of up-front learning might well be worth it, despite the downsides.<\/p>\n<h2 id=\"bccc\" class=\"na nb gr bf nc nd ne kt nf ng nh kw ni nj nk nl nm nn no np nq nr ns nt nu nv hy\">The bottom line: hack without fear<\/h2>\n<p data-selectable-paragraph><a href=\"https:\/\/steveklabnik.com\/writing\/rust-is-more-than-safety\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Rust is more than safety<\/a>. But it\u2019s hard to deny that many of its core concepts aim at eliminating memory leaks and other safety issues. And in an age where software is everything, safety is a must.<\/p>\n<p>There is probably a space for every upcoming language: <a href=\"https:\/\/towardsdatascience.com\/one-in-two-pythonistas-should-learn-golang-now-ba8dacaf06e8\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Go<\/a> is populating the space of Python and Java more and more, <a href=\"https:\/\/thenextweb.com\/news\/watch-out-python-julia-programming-coding-language-coming-for-crown-syndication\">Julia is going after Python in Data Science<\/a>, and Rust is growing in the realm of Python and C++. What makes Rust special is its incredible community, its innovative features, and the fact that it\u2019s designed to work for decades to come.<\/p>\n<p><a href=\"https:\/\/graydon2.dreamwidth.org\/253769.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">There\u2019s a lot more work to do<\/a>, and only a fraction of that can and will be done in Rust. The new languages of today have a strong chance of sticking around for a while, even though other languages will emerge in the next few years, too. But if I had to place my chips on one language, Rust would be a safe bet.<\/p>\n<p><em>This article was written by<span>&nbsp;<\/span><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Rhea Moutafis&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:4227,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16777215},&quot;10&quot;:2,&quot;15&quot;:&quot;arial,sans,sans-serif&quot;}\">Rhea Moutafis&nbsp;<\/span>and was originally published on<span>&nbsp;<\/span><a href=\"https:\/\/towardsdatascience.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Towards Data Science<\/a>. You can <a href=\"https:\/\/towardsdatascience.com\/thought-you-loved-python-wait-until-you-meet-rust-64a06d976ce\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">read it<span>&nbsp;<\/span>here<\/a>.&nbsp;<\/em><\/p>\n<p> <a href=\"https:\/\/thenextweb.com\/news\/thought-you-loved-python-meet-rust-programming-syndication\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cTechnology from the past comes to save the future from itself.\u201d That\u2019s how Graydon Hoare, the creator of Rust, describes what he wants to achieve. That\u2019s one of the key hallmarks of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8139,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/8138"}],"collection":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8138"}],"version-history":[{"count":0,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/8138\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/media\/8139"}],"wp:attachment":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}