feat: add sync
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-25 14:04:54 +02:00
parent 843139591c
commit 545439923f
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -27,11 +27,11 @@ pub trait Component {
#[derive(Clone)]
pub struct ConcreteComponent {
inner: Arc<dyn Component + Send + 'static>,
inner: Arc<dyn Component + Sync + Send + 'static>,
}
impl std::ops::Deref for ConcreteComponent {
type Target = Arc<dyn Component + Send + 'static>;
type Target = Arc<dyn Component + Sync + Send + 'static>;
fn deref(&self) -> &Self::Target {
&self.inner
@ -39,7 +39,7 @@ impl std::ops::Deref for ConcreteComponent {
}
impl ConcreteComponent {
pub fn new<T: Component + Send + 'static>(t: T) -> Self {
pub fn new<T: Component + Sync + Send + 'static>(t: T) -> Self {
Self { inner: Arc::new(t) }
}
}
@ -54,7 +54,7 @@ impl IntoComponent for ConcreteComponent {
}
}
impl<T: Component + Send + 'static> IntoComponent for T {
impl<T: Component + Sync + Send + 'static> IntoComponent for T {
fn into_component(self) -> ConcreteComponent {
ConcreteComponent::new(self)
}