Topic

rust

10 notes filed under this topic.

rust

rust concurrency

Send and Sync A type is Send if it is safe to send it to another thread. A type is Sync if it is safe to share between threads (T is Sync if and only if &T is Send). raw pointers are neithe…

Read article
rust

rust functional programming

iterator iter() Returns an iterator over the slice into_iter() Creates a consuming iterator, that is, one that moves each value out of the vector iter_mut() Returns an iterator that allows …

Read article
rust

rust async

I/OI/O:在计算机中指Input/Output。由于程序和运行时数据是在内存中驻留,由cpu来执行,涉及到数据交换的地方,通常是磁盘、网卡等,就需要IO接口 I/O 模型 同步阻塞 当用户线程发起IO请求后,会进行系统调用(system call)来让内核(Kernel)进行IO操作(系统调用是用户空间和内核空间的一个通道); 此时…

Read article
rust

rust reflect and macro

reflecttrait objectRust provides dynamic dispatch through a feature called trait objects. Trait objects, like &Foo or Box, are normal values that store a value of any type that implements t…

Read article
rust

rust frequently used crates

tokio-trace -> tracing contexts, multi threadscausality -structured diagnostics ( no grep) tracing is part of tokio, tokio not requied spans: a perido of time, entered and exitedevents: sin…

Read article
rust

rust cargo all in one

useful cmd specifying dependencies specifying dependencies from crates.io specifying dependencies from other registries specifying dependencies form git repositories path dependencies platf…

Read article
rust

rust similar concepts comparison

ref vs &ref annotates pattern bindings to make them borrow rather than move. It is not a part of the pattern as far as matching is concerned: it does not affect whether a value is matched, …

Read article
rust

rust tools

tools cargo-editThis tool extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line cargo whatfeatures ${crate} eg: cargo w…

Read article
rust

rust sugar

formatted print reference syntax attributes memoryThe compiler will not rearrange the memory layout ptr

Read article