mod.rs 771 B

12345678910111213141516171819202122232425262728293031323334
  1. #[cfg(feature = "async-runtime")]
  2. /// async utility functions
  3. pub mod async_util;
  4. /// Command-line interface utilities
  5. pub mod cli;
  6. /// Lamport clock (TODO: maybe shouldn't be in util module)
  7. pub mod clock;
  8. pub use clock::{Clock, Ticks};
  9. /// Filesystem utilities
  10. pub mod file;
  11. /// Network differentiations (TODO: shouldn't be here in util module))
  12. pub mod net_name;
  13. /// Parsing helpers
  14. pub mod parse;
  15. /// Filesystem path utilities
  16. pub mod path;
  17. /// Time utilities
  18. pub mod time;
  19. // =======================
  20. // TODO: Why is this here?
  21. // =======================
  22. use rand::{distributions::Alphanumeric, thread_rng, Rng};
  23. pub fn gen_id(len: usize) -> String {
  24. thread_rng().sample_iter(&Alphanumeric).take(len).map(char::from).collect()
  25. }
  26. // ======================