T rust learning -- the basic concept of ownership

Ownership is the most distinctive feature of trust, which enables trust to ensure memory security without garbage collection mechanism. So what is ownership and what is its use? First, ownership in t rust means:1. Ownership rules: (1),Rust Each value in has a variable called its owner. (2),You can only be one owner at a time. (3),When the owner ...

Posted by jamfrag on Mon, 23 May 2022 19:53:47 +0300

T rust learning - generics data types

We can use generics to create definitions for items such as function signatures or structures, which can then be used for many different specific data types. First, let's look at how to use generics to define functions, structures, enumerations, and methods. We will then discuss how generics affect code performance. In function definitionFor ex ...

Posted by majocmatt on Mon, 23 May 2022 04:27:24 +0300

Reference and borrowing

https://kaisery.github.io/trpl-zh-cn/ch04-02-references-and-borrowing.html   The tuple code in example 4-5 has such a problem: we must return string to the calling function in order to call string calculate_ String can still be used after length, because string is moved to calculate_ Within length. Here is how to define and use a (New) calculat ...

Posted by madrazel on Fri, 29 Apr 2022 13:55:57 +0300

Option enumeration and match

Option enumeration Rust doesn't have the null function that many other languages have. It is a null value and does not represent a null value. In languages with null values, variables are always one of these two states: null and non null. Null value attempts to express the concept: null value is a value that is currently invalid or missing for ...

Posted by cdoyle on Sat, 23 Apr 2022 18:24:49 +0300

With less than 50 lines of code, the Tensorflow model can be deployed in a production environment

Serverless TensorFlow function in public cloud For software developers and students, AI is paid. In 2021, the average annual salary of developers of Tensorflow, the most popular AI framework, was US $148508, which was converted into nearly one million yuan. Now, even for entry-level programming, developers must have AI skills. In fact, it's ...

Posted by nick1 on Sat, 16 Apr 2022 01:46:55 +0300

Intrigue with Rust · points

Previous: prefaceThe origin of the three-dimensional world is the point whose projection is 0 on the three number axes. Assuming that the three number axes are x, y and Z, the projection of the origin on them can be expressed as x = 0, y = 0, z = 0, which can be expressed aslet x: f64 = 0.0; let y: f64 = 0.0; let z: f64 = 0.0;That is, three var ...

Posted by Jason_London on Sun, 03 Apr 2022 10:02:59 +0300

How to troubleshoot the high memory usage of Rust in the production environment

Memory safe Rust, although there is basically no memory leakage, how to allocate memory reasonably is a problem that every complex application must face. Often, with different businesses, the same code may have different memory occupation. Therefore, there is a high probability that the memory will be used too much and the memory will not be re ...

Posted by shoombooltala on Sat, 02 Apr 2022 12:26:51 +0300

Practice analysis - Rust built-in trait: PartialEq and Eq

Absrtact: Rust uses traits in many places, from very simple operator overloading to the very subtle feature of send and sync. This article is shared from Huawei cloud community< Rust built-in trait parsing: PartialEq and Eq >Author: debug Rust uses traits in many places, from very simple operator overloading to the subtle features of ...

Posted by kla0005 on Wed, 30 Mar 2022 22:10:31 +0300