Topic

rust

8 notes filed under this topic.

rust

cargo doc

文档注释用于生成文档 使用 /// 支持 Markdown 放置在被说没条目之前 例子 命令 常用章节 # Examples Panics: 可能panic的场景 Errors: 如果fn返回Result, 描述可能的错误种类, 以及导致错误的条件 Safety: 如果fn出入unsafe调用, 解释unsafe的原因, 以及调用者确保的使用前提…

Read article
rust

rust project management

basic concepts Packages: A Cargo feature that lets you build, test, and share crates Crates: A tree of modules that produces a library or executable Modules and use: Let you control the org…

Read article
rust

rust smart pointer

OverviewThe most common kind of pointer in Rust is a reference (borrow but not own)Smart pointers, on the other hand, are data structures that not only act like a pointer but also have addi…

Read article
rust

rust memory layout

trait objecta reference to a trait type (or Box) is called trait object two ways convert concrete type to trait object assigning to variable pass a concrete type as a argument to a function…

Read article
rust

rust lifetime

lifetime Every reference in Rust has its own lifecycle most of the time, Rust’s lifetime is implicit and can be inferred There are two types of life cycle: input life cycle and output life …

Read article
rust

rust ownership

ownership rule Each value in Rust has an owner. There can only be one owner at a time. When the owner goes out of scope, the value will be dropped. variable scope Movestack-only data: Copy …

Read article
rust

rust basics

frequently used cmd data typeinteger i8,i16,i32,i64,i128,isize,u8,u16,u32,u64,u128,usize,etc isize, usize indicates that the type is determined by the architecture of the computer. For exam…

Read article
rust

rust resource

learning resources the book cargo book the rust performance book rust design patterns the rust RFC book the rustdoc book rustnomicon the rust reference rust by example async programming in …

Read article