Common traits and their priority:

  • Debug - every type should implement it
  • Send and Sync - implement unless there is a specific reason not to. No Send means the type can’t be sent to another thread (no thread pools, no Mutex<T>). No Sync means a shared reference to the type can’t be sent across threads (no Arc<T> or static)
  • Clone and Default - must implement
  • PartialEq, PartialOrd, Hash, Eq and Ord - where possible implement them, especially PartialEq and PartialOrd
  • Serialize and Deserialize - most libraries choose to provide a serde feature flag to not force a dependency

See also

References

  • J. Gjengset, Rust for Rustaceans: Idiomatic Programming for Experienced Developers. No Starch Press, 2021.