Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 599 Bytes

File metadata and controls

23 lines (20 loc) · 599 Bytes
  • List file in directory
let paths = fs::read_dir("./").unwrap();

for path in paths {
    println!("Name: {}", path.unwrap().path().display())
}
Box: makes any type Sized, by heap allocation
Arc: makes any type Clone, by simply cloning a reference to it instead of the type itself
Mutex: makes any type Sync, by locking access to it
RefCell: converts any & ref to &mut checked at runtime, bypassing the borrow checker (using `borrow_mut`)
  • Crossbeam channels
use crossbeam_channel::unbounded;
let (sender, receiver) = unbounded();
sender.send(())
receiver.recv()