diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcc40224..c1a94cb75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,11 @@ Bottom level categories: ## v0.19.2 (2024-02-29) +### Added/New Features + +#### General +- `wgpu::Id` now implements `PartialOrd`/`Ord` allowing it to be put in `BTreeMap`s. By @cwfitzgerald and @9291Sam in [#5176](https://github.com/gfx-rs/wgpu/pull/5176) + ### Bug Fixes #### General diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 9b4af33cd..f5e14f4b1 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -74,6 +74,7 @@ mod macros; use std::{ any::Any, borrow::Cow, + cmp::Ordering, error, fmt, future::Future, marker::PhantomData, @@ -4948,6 +4949,18 @@ impl PartialEq for Id { impl Eq for Id {} +impl PartialOrd for Id { + fn partial_cmp(&self, other: &Id) -> Option { + self.0.partial_cmp(&other.0) + } +} + +impl Ord for Id { + fn cmp(&self, other: &Id) -> Ordering { + self.0.cmp(&other.0) + } +} + impl std::hash::Hash for Id { fn hash(&self, state: &mut H) { self.0.hash(state)