mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
add BoxExt trait (#2036)
This commit is contained in:
@@ -141,3 +141,11 @@ pub fn weak_upgrade<T>(weak: &std::sync::Weak<T>) -> anyhow::Result<std::sync::A
|
|||||||
weak.upgrade()
|
weak.upgrade()
|
||||||
.ok_or_else(|| anyhow::anyhow!("{} not available", std::any::type_name::<T>()))
|
.ok_or_else(|| anyhow::anyhow!("{} not available", std::any::type_name::<T>()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait BoxExt: Sized {
|
||||||
|
fn boxed(self) -> Box<Self> {
|
||||||
|
Box::new(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> BoxExt for T {}
|
||||||
|
|||||||
Reference in New Issue
Block a user