From 2e175babd168c28db7f3f0a2aec168baba044149 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Fri, 16 Feb 2024 19:02:47 +0000 Subject: [PATCH] Added `SignalCloned`. --- dynatos-reactive/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dynatos-reactive/src/lib.rs b/dynatos-reactive/src/lib.rs index 00c9ccd..40c07c8 100644 --- a/dynatos-reactive/src/lib.rs +++ b/dynatos-reactive/src/lib.rs @@ -28,6 +28,18 @@ pub trait SignalGet { fn get(&self) -> Self::Value; } +/// Signal cloned +#[extend::ext(name = SignalCloned)] +pub impl S +where + S: SignalWith, + S::Value: Clone, +{ + fn cloned(&self) -> S::Value { + self.with(|value| value.clone()) + } +} + /// Signal with pub trait SignalWith { /// Value type