mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-30 22:10:37 +00:00
Also relax bounds on PartialEq
for LinearMap
.
This commit is contained in:
parent
6c6ba16921
commit
1052f4d783
@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Relax bounds on `IndexMap` from `V: Eq` to `V: PartialEq`.
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added `format` macro.
|
- Added `format` macro.
|
||||||
@ -60,6 +58,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Changed `stable_deref_trait` to a platform-dependent dependency.
|
- Changed `stable_deref_trait` to a platform-dependent dependency.
|
||||||
- Changed `SortedLinkedList::pop` return type from `Result<T, ()>` to `Option<T>` to match `std::vec::pop`.
|
- Changed `SortedLinkedList::pop` return type from `Result<T, ()>` to `Option<T>` to match `std::vec::pop`.
|
||||||
- `Vec::capacity` is no longer a `const` function.
|
- `Vec::capacity` is no longer a `const` function.
|
||||||
|
- Relaxed bounds on `PartialEq` for `IndexMap` from `V: Eq` to `V1: PartialEq<V2>`.
|
||||||
|
- Relaxed bounds on `PartialEq` for `LinearMap` from `V: PartialEq` to `V1: PartialEq<V2>`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -614,13 +614,13 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, V, S1: LinearMapStorage<K, V> + ?Sized, S2: LinearMapStorage<K, V> + ?Sized>
|
impl<K, V1, V2, S1: LinearMapStorage<K, V1> + ?Sized, S2: LinearMapStorage<K, V2> + ?Sized>
|
||||||
PartialEq<LinearMapInner<K, V, S2>> for LinearMapInner<K, V, S1>
|
PartialEq<LinearMapInner<K, V2, S2>> for LinearMapInner<K, V1, S1>
|
||||||
where
|
where
|
||||||
K: Eq,
|
K: Eq,
|
||||||
V: PartialEq,
|
V1: PartialEq<V2>,
|
||||||
{
|
{
|
||||||
fn eq(&self, other: &LinearMapInner<K, V, S2>) -> bool {
|
fn eq(&self, other: &LinearMapInner<K, V2, S2>) -> bool {
|
||||||
self.len() == other.len()
|
self.len() == other.len()
|
||||||
&& self
|
&& self
|
||||||
.iter()
|
.iter()
|
||||||
@ -745,4 +745,11 @@ mod test {
|
|||||||
) -> &'c LinearMapView<&'b (), u32> {
|
) -> &'c LinearMapView<&'b (), u32> {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn partial_eq_floats() {
|
||||||
|
// Make sure `PartialEq` is implemented even if `V` doesn't implement `Eq`.
|
||||||
|
let map: LinearMap<usize, f32, 4> = Default::default();
|
||||||
|
assert_eq!(map, map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user