Skip to content

ishiev/rs-hello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Demo Rust hello server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published