diff --git a/CHANGELOG.md b/CHANGELOG.md index f0886693c4..ff76b8d889 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ Bottom level categories: -wgpu::Instance::any_backend_feature_enabled() +!wgpu::Instance::enabled_backend_features().is_empty() ``` +- `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 diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 11cc1b6a77..8c7fed9753 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -75,6 +75,7 @@ mod macros; use std::{ any::Any, borrow::Cow, + cmp::Ordering, error, fmt, future::Future, marker::PhantomData, @@ -4971,6 +4972,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)