mirror of
https://codeberg.org/JasterV/event_bus.rs.git
synced 2026-04-26 18:10:02 +00:00
refactor: do not enforce the internal key of RcMap to be Clone
This commit is contained in:
parent
fd0d761e17
commit
db6424b8ad
1 changed files with 3 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ use std::{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ObjectRef<K, V>
|
pub struct ObjectRef<K, V>
|
||||||
where
|
where
|
||||||
K: Hash + Eq + Clone,
|
K: Hash + Eq,
|
||||||
{
|
{
|
||||||
parent_ref: Weak<DashMap<K, (AtomicIsize, V)>>,
|
parent_ref: Weak<DashMap<K, (AtomicIsize, V)>>,
|
||||||
key: K,
|
key: K,
|
||||||
|
|
@ -35,7 +35,7 @@ where
|
||||||
|
|
||||||
impl<K, V> Drop for ObjectRef<K, V>
|
impl<K, V> Drop for ObjectRef<K, V>
|
||||||
where
|
where
|
||||||
K: Hash + Eq + Clone,
|
K: Hash + Eq,
|
||||||
{
|
{
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let Some(map) = self.parent_ref.upgrade() else {
|
let Some(map) = self.parent_ref.upgrade() else {
|
||||||
|
|
@ -56,7 +56,7 @@ where
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum InsertError<K, V>
|
pub enum InsertError<K, V>
|
||||||
where
|
where
|
||||||
K: Hash + Eq + Clone + Debug,
|
K: Hash + Eq + Debug,
|
||||||
{
|
{
|
||||||
#[error(
|
#[error(
|
||||||
"An entry already exists with the given key: '{0:?}'. You must wait until all existing object references are dropped for the pair to be removed."
|
"An entry already exists with the given key: '{0:?}'. You must wait until all existing object references are dropped for the pair to be removed."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue