1
0
Fork 0
forked from wry/wry

all: split reusable components into workspace crates

This commit is contained in:
kossLAN 2026-05-29 09:14:53 -04:00
parent 2a079ed800
commit 657e7ce2f7
No known key found for this signature in database
225 changed files with 7422 additions and 17602 deletions

View file

@ -1,37 +0,0 @@
use std::{
ops::Deref,
rc::{Rc, Weak},
};
pub fn rc_eq<T: ?Sized>(a: &Rc<T>, b: &Rc<T>) -> bool {
Rc::as_ptr(a) as *const u8 == Rc::as_ptr(b) as *const u8
}
pub fn rc_weak_eq<T: ?Sized>(a: &Rc<T>, b: &Weak<T>) -> bool {
Rc::as_ptr(a) as *const u8 == b.as_ptr() as *const u8
}
#[derive(Default)]
pub struct RcEq<T>(pub Rc<T>);
impl<T> Clone for RcEq<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T> PartialEq for RcEq<T> {
fn eq(&self, other: &Self) -> bool {
rc_eq(&self.0, &other.0)
}
}
impl<T> Eq for RcEq<T> {}
impl<T> Deref for RcEq<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.0
}
}