Skip to content

Commit

Permalink
feat: impl IntoSplitSignal for Field (closes #3362) (#3364)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiadliel authored Dec 17, 2024
1 parent 1661fe2 commit 6a5bfe9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tachys/src/reactive_graph/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -358,6 +360,21 @@ where
}
}

#[cfg(feature = "reactive_stores")]
impl<T, S> IntoSplitSignal for Field<T, S>
where
Self: Get<Value = T> + Update<Value = T> + Clone,
S: Storage<ArcField<T>>,
{
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<Inner, Prev, K, T> IntoSplitSignal for KeyedSubfield<Inner, Prev, K, T>
where
Expand Down

0 comments on commit 6a5bfe9

Please sign in to comment.