mirror of
https://github.com/Zenithsiz/dynatos.git
synced 2026-02-10 13:40:28 +00:00
WithDynText is now implemented for QuerySignal and WithDefault.
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
// Imports
|
||||
use {
|
||||
crate::ObjectAttachEffect,
|
||||
dynatos_reactive::{Derived, Effect, Signal, SignalWith},
|
||||
dynatos_reactive::{Derived, Effect, Signal, SignalWith, WithDefault},
|
||||
dynatos_router::QuerySignal,
|
||||
dynatos_util::{TryOrReturnExt, WeakRef},
|
||||
};
|
||||
|
||||
@@ -128,3 +129,26 @@ where
|
||||
self.with(|text| text.with_text(f))
|
||||
}
|
||||
}
|
||||
impl<T> WithDynText for QuerySignal<T>
|
||||
where
|
||||
T: WithDynText,
|
||||
{
|
||||
fn with_text<F, O>(&self, f: F) -> O
|
||||
where
|
||||
F: FnOnce(Option<&str>) -> O,
|
||||
{
|
||||
self.with(|text| text.with_text(f))
|
||||
}
|
||||
}
|
||||
impl<S, T> WithDynText for WithDefault<S, T>
|
||||
where
|
||||
S: SignalWith<Value = Option<T>>,
|
||||
T: WithDynText,
|
||||
{
|
||||
fn with_text<F, O>(&self, f: F) -> O
|
||||
where
|
||||
F: FnOnce(Option<&str>) -> O,
|
||||
{
|
||||
self.with(|text| text.with_text(f))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user