Skip to content

Latest commit

 

History

History
11 lines (11 loc) · 703 Bytes

README.md

File metadata and controls

11 lines (11 loc) · 703 Bytes

rs-hello

Demo Rust hello server from Rust book. Contains collection of Rust design patterns:

  • create OS native threads with std::thread;
  • thread communication with std::sync::mpsc channel;
  • use Arc<Mutex<...>> for safe share receiver end between threads (use channel as shared queue);
  • passing job closure to worker theads (use trait object type Box<dyn FnOnce() + Send + 'static> for it);
  • simple use Tcp Listener;
  • use Option<...> enum to take() some value from mutable self reference (move JoinHandler value from self to join());
  • use type alias;
  • impl Drop trait for gracefull shutdown.