Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IntoSplitSignal for Field. #3364

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading