async_component_components/
boxed.rs1use std::ops::{Deref, DerefMut};
2
3use async_component_core::AsyncComponent;
4
5#[derive(Debug)]
6pub struct BoxedComponent<T: ?Sized>(pub Box<T>);
7
8impl<T: ?Sized> Deref for BoxedComponent<T> {
9 type Target = T;
10
11 fn deref(&self) -> &Self::Target {
12 &*self.0
13 }
14}
15
16impl<T: ?Sized> DerefMut for BoxedComponent<T> {
17 fn deref_mut(&mut self) -> &mut Self::Target {
18 &mut *self.0
19 }
20}
21
22impl<T: ?Sized + AsyncComponent> AsyncComponent for BoxedComponent<T> {
23 fn update_component(&mut self) {
24 self.0.update_component()
25 }
26}