shiny_common/pointer_utils.rs
1use std::sync::Arc;
2
3pub trait ToArc {
4 fn arc(self) -> Arc<Self>;
5}
6
7impl<T> ToArc for T {
8 fn arc(self) -> Arc<Self> {
9 Arc::new(self)
10 }
11}
12
13pub trait ToBox {
14 fn boxed(self) -> Box<Self>;
15}
16
17impl<T> ToBox for T {
18 fn boxed(self) -> Box<Self> {
19 Box::new(self)
20 }
21}