Provide several deprecated functions (#2831)

This commit is contained in:
Álvaro Mondéjar Rubio 2024-08-14 03:19:52 +02:00 committed by GitHub
parent 62408d9202
commit 3469e9335c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 68 additions and 0 deletions

View file

@ -141,3 +141,48 @@ where
{
Memo::new(fun)
}
/// Creates a new memo by passing a function that computes the value.
#[inline(always)]
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `Memo::new_owning()` instead."]
pub fn create_owning_memo<T>(
fun: impl Fn(Option<T>) -> (T, bool) + Send + Sync + 'static,
) -> Memo<T>
where
T: PartialEq + Send + Sync + 'static,
{
Memo::new_owning(fun)
}
/// A conditional signal that only notifies subscribers when a change
/// in the source signals value changes whether the given function is true.
#[inline(always)]
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `Selector::new()` instead."]
pub fn create_selector<T>(
source: impl Fn() -> T + Clone + 'static,
) -> Selector<T>
where
T: PartialEq + Eq + Clone + std::hash::Hash + 'static,
{
Selector::new(source)
}
/// Creates a conditional signal that only notifies subscribers when a change
/// in the source signals value changes whether the given function is true.
#[inline(always)]
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `Selector::new_with_fn()` instead."]
pub fn create_selector_with_fn<T>(
source: impl Fn() -> T + Clone + 'static,
f: impl Fn(&T, &T) -> bool + Send + Sync + Clone + 'static,
) -> Selector<T>
where
T: PartialEq + Eq + Clone + std::hash::Hash + 'static,
{
Selector::new_with_fn(source, f)
}

View file

@ -9,3 +9,17 @@ mod render_effect;
pub use effect::*;
pub use effect_function::*;
pub use render_effect::*;
/// Creates a new render effect, which immediately runs `fun`.
#[inline(always)]
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `RenderEffect::new()` instead."]
pub fn create_render_effect<T>(
fun: impl FnMut(Option<T>) -> T + 'static,
) -> RenderEffect<T>
where
T: 'static,
{
RenderEffect::new(fun)
}

View file

@ -184,3 +184,12 @@ pub fn create_signal<T: Send + Sync + 'static>(
pub fn create_rw_signal<T: Send + Sync + 'static>(value: T) -> RwSignal<T> {
RwSignal::new(value)
}
/// A trigger is a data-less signal with the sole purpose of notifying other reactive code of a change.
#[inline(always)]
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `ArcTrigger::new()` instead."]
pub fn create_trigger() -> ArcTrigger {
ArcTrigger::new()
}