pub fn try_insert(&mut self, key: K, value: V) -> Result<Option<V>, (K, V)> {
		if self.len() >= self.capacity() {
			return Err((key, value));
		}
		Ok(self.index_map.insert(key, value))
	}
/// Tries to add a key value pair to the map.
///
/// - If the map is full, returns the key and value back through
/// an `Err`
/// - Otherwise, returns `Ok` with whatever item previously had
/// that ID, if any
///
/// As of the time of writing, I never actually check the `Result`,
/// instead opting to ignore it with `ok()`. Most resources are
/// managed with the `basedrop` crate, which will automatically move
/// dropped items to the main thread for collection, so I can discard
/// any value in the `Result` without worrying about triggering
/// any memory deallocation on the audio thread.
///
/// That being said, I still think it's best to return a `Result` that
/// indicates if the key value pair was added successfully. That way,
/// clippy will encourage me to make an intentional decision about
/// what to do with the `Result`. If I move the code that produces
/// the user-facing out-of-capacity error to the audio thread in the
/// future, this will come in handy in that situation as well.
Tries to add a key value pair to the map.
If the map is full, returns the key and value back through
an `Err`
Otherwise, returns `Ok` with whatever item previously had
that ID, if any

As of the time of writing, I never actually check the `Result`,
instead opting to ignore it with `ok()`. Most resources are
managed with the `basedrop` crate, which will automatically move
dropped items to the main thread for collection, so I can discard
any value in the `Result` without worrying about triggering
any memory deallocation on the audio thread.

That being said, I still think it's best to return a `Result` that
indicates if the key value pair was added successfully. That way,
clippy will encourage me to make an intentional decision about
what to do with the `Result`. If I move the code that produces
the user-facing out-of-capacity error to the audio thread in the
future, this will come in handy in that situation as well.
Tries to add a key value pair to the map . If the map is full returns the key and value back through an ` Err ` Otherwise returns ` Ok ` with whatever item previously had that ID if any As of the time of writing I never actually check the ` Result ` instead opting to ignore it with ` ok () ` . Most resources are managed with the ` basedrop ` crate which will automatically move dropped items to the main thread for collection so I can discard any value in the ` Result ` without worrying about triggering any memory deallocation on the audio thread . That being said I still think it ' s best to return a ` Result ` that indicates if the key value pair was added successfully . That way clippy will encourage me to make an intentional decision about what to do with the ` Result ` . If I move the code that produces the user - facing out - of - capacity error to the audio thread in the future this will come in handy in that situation as well .
pub fn try_insert(&mut self, key: K, value: V) -> Result<Option<V>, (K, V)> {
		if self.len() >= self.capacity() {
			return Err((key, value));
		}
		Ok(self.index_map.insert(key, value))
	}
pub fn try_insert ( & mut self , key : K , value : V ) -> Result < Option < V > , ( K , V ) > { if self . len ( ) >= self . capacity ( ) { return Err ( ( key , value ) ) ; } Ok ( self . index_map . insert ( key , value ) ) }
Tries to add a key value pair to the map.
Tries to add a key value pair to the map .
&mut self
key
K
value
V
&mut self
key
K
value
V