Tag:ownership

  • Rust programming video tutorial (Advanced) – 017_ 2 messaging 2

    Time:2021-9-12

    Video address Headline address:https://www.ixigua.com/i677586170644791348…Station B address:https://www.bilibili.com/video/av81202308/ Source address GitHub address:https://github.com/anonymousGiga/learn_rus… Explanation content 1. Channel and ownership transfer(1) Example: use std::thread; use std::sync::mpsc; fn main() { let (tx, rx) = mpsc::channel(); thread::spawn(move || { let val = String::from(“hi”); tx.send(val).unwrap(); println! (“val is {}”, val);// Error, Val cannot be used here because the ownership of Val has […]

  • Rust ownership

    Time:2021-8-31

    As a java developer, everything I know about memory allocation is handled by some processes called garbage collection. This is the problem of the JVM, not mine.So when I openRust BookI became a little worried when I saw that rust had no garbage collection mechanism. Should the responsibility for dealing with memory management rest on […]

  • Rust from pit to soil – pit – string compared to str

    Time:2021-8-30

    String compared to str Rust String Rust str When we first came into contact with rust, we may not be very clear about the relationship and difference between string and STR, so that we are not sure which type to use when writing functions. This paper mainly expounds this problem. Rust’s official documents areStringIn the […]

  • 034 rust book of the dead for VEC to implement drain

    Time:2021-8-24

    introduce The videos recorded in this series are mainly put on station BRust dead book learning video The source code information related to rust dead book is ingithub.com/anonymousGiga/Rustonomi… Details Drain is a collection API that removes the ownership of the data in the container without occupying the container itself. We can claim ownership of all […]

  • Rust bit by bit: how to write the expression in pattern matching

    Time:2021-8-23

    Pattern matching is often used in rust. Match expression is the most commonly used expression for pattern matching The match expression is roughly divided into three parts: match keyword, head expression and match block. This article mainly discusses how to write head expression Head expression As we know, there are only two expressions in rust:Position […]

  • Rust copy on write cow

    Time:2021-8-7

    Copy on write (copy on write) technology is an optimization strategy in the program, which is mostly used in the scenario of more reading and less writing. The main idea is not to copy the object immediately, but to reference (borrow) the original object for a large number of read operations. Only when a small […]

  • 016 learn the safe double linked list layout of rust through the linked list

    Time:2021-8-6

    introduce Video address:www.bilibili.com/video/av78062009/Relevant source code:github.com/anonymousGiga/Rust-link… Details At the beginning of this section, we will design a secure double ended queue. For the layout of double ended queues, we mainly use RC and refcell. Rc RC: data can be shared through the RC pointer. Because the rust language has the concept of ownership, after the data […]

  • Microsoft is developing a secure programming language Verona based on rust

    Time:2021-8-5

    recentlyIn a speech, referring to Microsoft’s work to solve the corresponding memory problems, Matthew Parkinson, a Microsoft researcher in the UK, mentioned the new programming language based on rust that Microsoft is developing,This project is called “Verona” within Microsoft“。 Previously, Microsoft said it was exploring rust as a security alternative to C and C + […]

  • NPM throws an error without sudo

    Time:2021-7-19

    I just installed node and NPM through the package on nodejs.org. Whenever I try to search or install something with NPM, it will throw the following error npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNRESET: request to https://registry.npmjs.org/utf8 failed, reason: Client network socket disconnected before secure TLS connection was established npm WARN registry […]

  • &The difference between self and self

    Time:2021-6-12

    describe Some students asked, in rust’s method, the first parameter is self, so if it is changed to self (not uppercase self), what’s the difference between the two.&Self, which means that a reference is passed to the function and the ownership of the object will not be transferred;Self means that an object is passed to […]

  • Rust learning – when to put data on the heap

    Time:2021-6-10

    When to put data on the heap Cognitive ownership, Life cycle and reference validity, Smart pointerThese three chapters are related. Ownership and life cycle ensure the validity of data. Smart pointer data is stored on the heap and the pointer is on the stack. Suggestions in the book When there is a type of unknown […]

  • Using acme.sh to automatically generate certificates from letsencrypt and install them to nginx

    Time:2021-6-4

    1、 Install acme.sh curl https://get.acme.sh | sh Reload.bashrc source ~/.bashrc 2、 Generate certificate acme.shTwo HTTP and DNS verification methods are supported to verify the domain name ownership. DNS verification methods are automatic and manual. Automatic verification uses the API provided by the domain name resolver to automatically add a TXT record to complete the verification,acme.shSupport […]