Implement Debug and comparison with CosmicMapped for CosmicMappedKey

This commit is contained in:
Ian Douglas Scott 2026-07-06 12:34:21 -07:00 committed by Ian Douglas Scott
parent 29320bdab5
commit 26ee83aaa7

View file

@ -125,9 +125,9 @@ impl fmt::Debug for CosmicMapped {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct CosmicMappedKey(CosmicMappedKeyInner);
#[derive(Clone)]
#[derive(Clone, Debug)]
enum CosmicMappedKeyInner {
Window(Weak<Mutex<IcedElementInternal<CosmicWindowInternal>>>),
Stack(Weak<Mutex<IcedElementInternal<CosmicStackInternal>>>),
@ -166,6 +166,20 @@ impl PartialEq for CosmicMappedKey {
}
impl Eq for CosmicMappedKey {}
impl PartialEq<CosmicMappedKey> for CosmicMapped {
fn eq(&self, other: &CosmicMappedKey) -> bool {
match (&self.element, &other.0) {
(CosmicMappedInternal::Window(window), CosmicMappedKeyInner::Window(weak)) => {
Arc::as_ptr(&window.0.0) == weak.as_ptr()
}
(CosmicMappedInternal::Stack(stack), CosmicMappedKeyInner::Stack(weak)) => {
Arc::as_ptr(&stack.0.0) == weak.as_ptr()
}
_ => false,
}
}
}
impl PartialEq for CosmicMapped {
fn eq(&self, other: &Self) -> bool {
self.element == other.element