cl-structures: IndexMap::get_disjoint_mut to match Rust 1.86 🎉
This commit is contained in:
parent
a4176c710e
commit
2ecb2efc09
@ -61,8 +61,10 @@ macro_rules! make_index {($($(#[$meta:meta])* $name:ident),*$(,)?) => {$(
|
|||||||
)*}}
|
)*}}
|
||||||
|
|
||||||
use self::iter::MapIndexIter;
|
use self::iter::MapIndexIter;
|
||||||
use core::slice::GetManyMutError;
|
use std::{
|
||||||
use std::ops::{Index, IndexMut};
|
ops::{Index, IndexMut},
|
||||||
|
slice::GetDisjointMutError,
|
||||||
|
};
|
||||||
|
|
||||||
pub use make_index;
|
pub use make_index;
|
||||||
|
|
||||||
@ -103,11 +105,11 @@ impl<V, K: MapIndex> IndexMap<K, V> {
|
|||||||
/// Returns mutable references to many indices at once.
|
/// Returns mutable references to many indices at once.
|
||||||
///
|
///
|
||||||
/// Returns an error if any index is out of bounds, or if the same index was passed twice.
|
/// Returns an error if any index is out of bounds, or if the same index was passed twice.
|
||||||
pub fn get_many_mut<const N: usize>(
|
pub fn get_disjoint_mut<const N: usize>(
|
||||||
&mut self,
|
&mut self,
|
||||||
indices: [K; N],
|
indices: [K; N],
|
||||||
) -> Result<[&mut V; N], GetManyMutError> {
|
) -> Result<[&mut V; N], GetDisjointMutError> {
|
||||||
self.map.get_many_mut(indices.map(|id| id.get()))
|
self.map.get_disjoint_mut(indices.map(|id| id.get()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator over the IndexMap.
|
/// Returns an iterator over the IndexMap.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
//! [im]: index_map::IndexMap
|
//! [im]: index_map::IndexMap
|
||||||
//! [mi]: index_map::MapIndex
|
//! [mi]: index_map::MapIndex
|
||||||
#![warn(clippy::all)]
|
#![warn(clippy::all)]
|
||||||
#![feature(dropck_eyepatch, decl_macro, get_many_mut)]
|
#![feature(dropck_eyepatch, decl_macro)]
|
||||||
#![deny(unsafe_op_in_unsafe_fn)]
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
pub mod intern;
|
pub mod intern;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user