From 7631ce3b09fd885e71e25634be902e8af00c084b Mon Sep 17 00:00:00 2001 From: Jose Quesada Date: Fri, 6 Jan 2023 08:26:10 -0600 Subject: [PATCH] Revert "added `DefaultSignal`" This reverts commit a5988c59eed0a50e2a985017d3a87926ef8f2af5. --- leptos_reactive/src/signal_wrappers_read.rs | 72 --------------------- 1 file changed, 72 deletions(-) diff --git a/leptos_reactive/src/signal_wrappers_read.rs b/leptos_reactive/src/signal_wrappers_read.rs index 9484e9b23..6fe96d075 100644 --- a/leptos_reactive/src/signal_wrappers_read.rs +++ b/leptos_reactive/src/signal_wrappers_read.rs @@ -1,5 +1,3 @@ -use std::marker::PhantomData; - use crate::{store_value, Memo, ReadSignal, RwSignal, Scope, StoredValue, UntrackedGettableSignal}; /// A wrapper for any kind of readable reactive signal: a [ReadSignal](crate::ReadSignal), @@ -486,73 +484,3 @@ where self.get() } } - -/// Signal which only emits the default value when read. -pub struct DefaultSignal(PhantomData); - -impl Default for DefaultSignal { - fn default() -> Self { - Self(Default::default()) - } -} - -impl std::fmt::Debug for DefaultSignal { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_tuple("DefaultSignal").field(&T::default()).finish() - } -} - -impl Clone for DefaultSignal { - fn clone(&self) -> Self { - Self(PhantomData) - } -} - -impl Copy for DefaultSignal {} - -impl DefaultSignal { - /// Get's the default value of `T`. - pub fn get(self) -> T { - T::default() - } -} - -impl PartialEq for DefaultSignal { - fn eq(&self, _: &Self) -> bool { - true - } -} - -impl Eq for DefaultSignal {} - -#[cfg(not(feature = "stable"))] -impl FnOnce<()> for DefaultSignal { - type Output = T; - - extern "rust-call" fn call_once(self, _: ()) -> Self::Output { - T::default() - } -} - -#[cfg(not(feature = "stable"))] -impl FnOnce<(bool,)> for DefaultSignal { - type Output = T; - - extern "rust-call" fn call_once(self, _: (bool,)) -> Self::Output { - T::default() - } -} - -#[cfg(not(feature = "stable"))] -impl FnMut<()> for DefaultSignal { - extern "rust-call" fn call_mut(&mut self, _: ()) -> Self::Output { - T::default() - } -} - -#[cfg(not(feature = "stable"))] -impl Fn<()> for DefaultSignal { - extern "rust-call" fn call(&self, _: ()) -> Self::Output { - T::default() - } -}