Skip to main content

hexga_core/
handle.rs

1// Prevision for https://smallcultfollowing.com/babysteps/blog/2025/10/07/the-handle-trait/
2pub trait Handle: Clone
3{
4    fn clone_handle(&self) -> Self { self.clone() }
5}
6impl<T> Handle for core::cell::RefCell<T> where T: ?Sized + Clone {}
7
8#[cfg(feature = "std")]
9impl<T> Handle for std::rc::Rc<T> where T: ?Sized {}
10#[cfg(feature = "std")]
11impl<T> Handle for std::rc::Weak<T> where T: ?Sized {}
12#[cfg(feature = "std")]
13impl<T> Handle for std::sync::Arc<T> where T: ?Sized {}
14#[cfg(feature = "std")]
15impl<T> Handle for std::sync::Weak<T> where T: ?Sized {}
16
17#[cfg(not(feature = "std"))]
18impl<T> Handle for alloc::rc::Rc<T> where T: ?Sized {}
19#[cfg(not(feature = "std"))]
20impl<T> Handle for alloc::rc::Weak<T> where T: ?Sized {}
21#[cfg(not(feature = "std"))]
22impl<T> Handle for alloc::sync::Arc<T> where T: ?Sized {}
23#[cfg(not(feature = "std"))]
24impl<T> Handle for alloc::sync::Weak<T> where T: ?Sized {}