Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
10a56ad690
commit
af57ef6cc8
@ -1,4 +1,4 @@
|
|||||||
use std::rc::Rc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub trait Component {
|
pub trait Component {
|
||||||
fn name(&self) -> String;
|
fn name(&self) -> String;
|
||||||
@ -27,11 +27,11 @@ pub trait Component {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ConcreteComponent {
|
pub struct ConcreteComponent {
|
||||||
inner: Rc<dyn Component + 'static>,
|
inner: Arc<dyn Component + 'static>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::ops::Deref for ConcreteComponent {
|
impl std::ops::Deref for ConcreteComponent {
|
||||||
type Target = Rc<dyn Component + 'static>;
|
type Target = Arc<dyn Component + 'static>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.inner
|
&self.inner
|
||||||
@ -40,7 +40,7 @@ impl std::ops::Deref for ConcreteComponent {
|
|||||||
|
|
||||||
impl ConcreteComponent {
|
impl ConcreteComponent {
|
||||||
pub fn new<T: Component + 'static>(t: T) -> Self {
|
pub fn new<T: Component + 'static>(t: T) -> Self {
|
||||||
Self { inner: Rc::new(t) }
|
Self { inner: Arc::new(t) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user