From 6a5bfe9a5d0d2e84266bdb5431a0d550017aa507 Mon Sep 17 00:00:00 2001 From: Gary Coady Date: Tue, 17 Dec 2024 01:48:13 +0000 Subject: [PATCH] feat: impl IntoSplitSignal for Field (closes #3362) (#3364) --- tachys/src/reactive_graph/bind.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tachys/src/reactive_graph/bind.rs b/tachys/src/reactive_graph/bind.rs index 0286f532df..d62a6c7bfe 100644 --- a/tachys/src/reactive_graph/bind.rs +++ b/tachys/src/reactive_graph/bind.rs @@ -9,13 +9,15 @@ use crate::{ renderer::{types::Element, RemoveEventHandler}, view::{Position, ToTemplate}, }; +#[cfg(feature = "reactive_stores")] +use reactive_graph::owner::Storage; use reactive_graph::{ signal::{ReadSignal, RwSignal, WriteSignal}, traits::{Get, Update}, wrappers::read::Signal, }; #[cfg(feature = "reactive_stores")] -use reactive_stores::{KeyedSubfield, Subfield}; +use reactive_stores::{ArcField, Field, KeyedSubfield, Subfield}; use send_wrapper::SendWrapper; use wasm_bindgen::JsValue; @@ -358,6 +360,21 @@ where } } +#[cfg(feature = "reactive_stores")] +impl IntoSplitSignal for Field +where + Self: Get + Update + Clone, + S: Storage>, +{ + type Value = T; + type Read = Self; + type Write = Self; + + fn into_split_signal(self) -> (Self::Read, Self::Write) { + (self, self) + } +} + #[cfg(feature = "reactive_stores")] impl IntoSplitSignal for KeyedSubfield where