Compare commits

..

5 Commits

Author SHA1 Message Date
Greg Johnston
a76b9d71f0 fix: type inference regression due to From<T> for Signal<T> impl (closes #3200) 2024-11-17 16:23:12 -05:00
Greg Johnston
e768617dbb Revert "feat: Option<T> read-like traits & deprecate MaybeSignal (#3098)"
This reverts commit 396327b667.
2024-11-17 16:14:05 -05:00
Greg Johnston
36132a5823 Merge pull request #3249 from metatoaster/pr3213_e2e_tests
test: aria-current end-to-end tests (#3213)
2024-11-17 15:50:13 -05:00
autofix-ci[bot]
6f35f8d197 [autofix.ci] apply automated fixes 2024-11-17 01:51:40 +00:00
Tommy Yu
3973c4f420 test: aria-current end-to-end tests (#3213) 2024-11-17 14:40:47 +13:00
22 changed files with 375 additions and 566 deletions

View File

@@ -6,7 +6,9 @@ use leptos_axum::ResponseOptions;
// A basic function to display errors served by the error boundaries.
// Feel free to do more complicated things here than just displaying them.
#[component]
pub fn ErrorTemplate(#[prop(into)] errors: Signal<Errors>) -> impl IntoView {
pub fn ErrorTemplate(
#[prop(into)] errors: MaybeSignal<Errors>,
) -> impl IntoView {
// Get Errors from Signal
// Downcast lets us take a type that implements `std::error::Error`
let errors = Memo::new(move |_| {

View File

@@ -10,7 +10,7 @@ struct Then {
// the type with Option<...> and marking the option as #[prop(optional)].
#[slot]
struct ElseIf {
cond: Signal<bool>,
cond: MaybeSignal<bool>,
children: ChildrenFn,
}
@@ -22,7 +22,7 @@ struct Fallback {
// Slots are added to components like any other prop.
#[component]
fn SlotIf(
cond: Signal<bool>,
cond: MaybeSignal<bool>,
then: Then,
#[prop(default=vec![])] else_if: Vec<ElseIf>,
#[prop(optional)] fallback: Option<Fallback>,
@@ -43,9 +43,9 @@ fn SlotIf(
#[component]
pub fn App() -> impl IntoView {
let (count, set_count) = signal(0);
let is_even = Signal::derive(move || count.get() % 2 == 0);
let is_div5 = Signal::derive(move || count.get() % 5 == 0);
let is_div7 = Signal::derive(move || count.get() % 7 == 0);
let is_even = MaybeSignal::derive(move || count.get() % 2 == 0);
let is_div5 = MaybeSignal::derive(move || count.get() % 5 == 0);
let is_div7 = MaybeSignal::derive(move || count.get() % 7 == 0);
view! {
<button on:click=move |_| set_count.update(|value| *value += 1)>"+1"</button>

View File

@@ -6,7 +6,116 @@ Feature: Check aria-current being applied to make links bolded
Given I see the app
Scenario: Should see the base case working
Then I see the link Out-of-Order being bolded
Then I see the following links being bolded
Then I see the Out-of-Order link being bolded
And I see the following links being bolded
| Out-of-Order |
| Nested |
And I see the In-Order link not being bolded
And I see the following links not being bolded
| In-Order |
| Single |
Scenario: Should see client-side render the correct bolded links
When I select the link In-Order
And I select the link Single
Then I see the following links being bolded
| In-Order |
| Single |
And I see the following links not being bolded
| Out-of-Order |
| Nested |
Scenario: Should see server-side render the correct bolded links
When I select the link In-Order
And I select the link Single
And I reload the page
Then I see the following links being bolded
| In-Order |
| Single |
And I see the following links not being bolded
| Out-of-Order |
| Nested |
Scenario: Check that the base nested route links are working
When I select the link Instrumented
Then I see the Instrumented link being bolded
And I see the Item Listing link not being bolded
Scenario: Should see going deep down into nested routes bold links
When I select the link Instrumented
And I select the link Target 421
Then I see the following links being bolded
| Instrumented |
| Item Listing |
| Target 4## |
| Target 42# |
| Target 421 |
| field1 |
Scenario: Should see going deep down into nested routes in SSR bold links
When I select the link Instrumented
And I select the link Target 421
And I reload the page
Then I see the following links being bolded
| Instrumented |
| Item Listing |
| Target 4## |
| Target 42# |
| Target 421 |
| field1 |
Scenario: Going deep down navigate around nested links bold correctly
When I select the link Instrumented
And I select the link Target 421
And I select the link Inspect path2/field3
Then I see the following links being bolded
| Instrumented |
| Item Listing |
| Target 4## |
| Target 42# |
| field3 |
And I see the following links not being bolded
| Target 421 |
| field1 |
Scenario: Going deep down navigate around nested links bold correctly, SSR
When I select the link Instrumented
And I select the link Target 421
And I select the link Inspect path2/field3
And I reload the page
Then I see the following links being bolded
| Instrumented |
| Item Listing |
| Target 4## |
| Target 42# |
| field3 |
And I see the following links not being bolded
| Target 421 |
| field1 |
Scenario: Going deep down back out nested routes reset bolded states
When I select the link Instrumented
And I select the link Target 421
And I select the link Counters
Then I see the following links being bolded
| Instrumented |
| Counters |
And I see the following links not being bolded
| Item Listing |
| Target 4## |
| Target 42# |
| Target 421 |
Scenario: Going deep down back out nested routes reset bolded states, SSR
When I select the link Instrumented
And I select the link Target 421
And I select the link Counters
And I reload the page
Then I see the following links being bolded
| Instrumented |
| Counters |
And I see the following links not being bolded
| Item Listing |
| Target 4## |
| Target 42# |
| Target 421 |

View File

@@ -90,3 +90,11 @@ pub async fn link_text_is_aria_current(client: &Client, text: &str) -> Result<()
Ok(())
}
pub async fn link_text_is_not_aria_current(client: &Client, text: &str) -> Result<()> {
let link = find::link_with_text(client, text).await?;
link.attr("aria-current").await?
.map(|_| anyhow::bail!("aria-current mistakenly set for {text}"))
.unwrap_or(Ok(()))
}

View File

@@ -80,7 +80,7 @@ async fn i_see_the_second_count_is(
Ok(())
}
#[then(regex = r"^I see the link (.*) being bolded$")]
#[then(regex = r"^I see the (.*) link being bolded$")]
async fn i_see_the_link_being_bolded(
world: &mut AppWorld,
text: String,
@@ -106,6 +106,32 @@ async fn i_see_the_following_links_being_bolded(
Ok(())
}
#[then(regex = r"^I see the (.*) link not being bolded$")]
async fn i_see_the_link_being_not_bolded(
world: &mut AppWorld,
text: String,
) -> Result<()> {
let client = &world.client;
check::link_text_is_not_aria_current(client, &text).await?;
Ok(())
}
#[then(expr = "I see the following links not being bolded")]
async fn i_see_the_following_links_not_being_bolded(
world: &mut AppWorld,
step: &Step,
) -> Result<()> {
let client = &world.client;
if let Some(table) = step.table.as_ref() {
for row in table.rows.iter() {
check::link_text_is_not_aria_current(client, &row[0]).await?;
}
}
Ok(())
}
#[then(expr = "I see the following counters under section")]
#[then(expr = "the following counters under section")]
async fn i_see_the_following_counters_under_section(

View File

@@ -38,7 +38,7 @@ pub fn TimerDemo() -> impl IntoView {
pub fn use_interval<T, F>(interval_millis: T, f: F)
where
F: Fn() + Clone + 'static,
T: Into<Signal<u64>> + 'static,
T: Into<MaybeSignal<u64>> + 'static,
{
let interval_millis = interval_millis.into();
Effect::new(move |prev_handle: Option<IntervalHandle>| {

View File

@@ -0,0 +1,22 @@
#[test]
fn generic_component_signal_inference() {
use leptos::prelude::*;
#[component]
pub fn SimpleCounter(#[prop(into)] step: Signal<i32>) -> impl IntoView {
_ = step;
view! {
<div>
</div>
}
}
let a = RwSignal::new(1);
let (b, _) = signal(1);
view! {
<SimpleCounter step=a/>
<SimpleCounter step=b/>
<SimpleCounter step=Signal::stored(1)/>
};
}

View File

@@ -84,7 +84,6 @@ pub mod owner;
#[cfg(feature = "serde")]
mod serde;
pub mod signal;
mod trait_options;
pub mod traits;
pub mod transition;
pub mod wrappers;

View File

@@ -1,5 +1,3 @@
#[allow(deprecated)]
use crate::wrappers::read::{MaybeProp, MaybeSignal};
use crate::{
computed::{ArcMemo, Memo},
owner::Storage,
@@ -9,7 +7,7 @@ use crate::{
},
traits::{Get, Set},
wrappers::{
read::{ArcSignal, Signal, SignalTypes},
read::{ArcSignal, MaybeProp, MaybeSignal, Signal},
write::SignalSetter,
},
};
@@ -114,8 +112,7 @@ macro_rules! impl_get_fn_traits_get_arena {
($($ty:ident),*) => {
$(
#[cfg(feature = "nightly")]
#[allow(deprecated)]
impl<T, S> FnOnce<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>> {
impl<T, S> FnOnce<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> {
type Output = <Self as Get>::Value;
#[inline(always)]
@@ -125,8 +122,7 @@ macro_rules! impl_get_fn_traits_get_arena {
}
#[cfg(feature = "nightly")]
#[allow(deprecated)]
impl<T, S> FnMut<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>> {
impl<T, S> FnMut<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> {
#[inline(always)]
extern "rust-call" fn call_mut(&mut self, _args: ()) -> Self::Output {
self.get()
@@ -134,8 +130,7 @@ macro_rules! impl_get_fn_traits_get_arena {
}
#[cfg(feature = "nightly")]
#[allow(deprecated)]
impl<T, S> Fn<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>> {
impl<T, S> Fn<()> for $ty<T, S> where $ty<T, S>: Get, S: Storage<T> + Storage<Option<T>> {
#[inline(always)]
extern "rust-call" fn call(&self, _args: ()) -> Self::Output {
self.get()

View File

@@ -1,11 +1,9 @@
#[allow(deprecated)]
use crate::wrappers::read::{MaybeProp, MaybeSignal};
use crate::{
computed::{ArcMemo, Memo},
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::With,
wrappers::read::{Signal, SignalTypes},
wrappers::read::{MaybeProp, MaybeSignal, Signal, SignalTypes},
};
use serde::{Deserialize, Serialize};
@@ -75,7 +73,6 @@ impl<T: Serialize + 'static, St: Storage<T>> Serialize for ArcMemo<T, St> {
}
}
#[allow(deprecated)]
impl<T, St> Serialize for MaybeSignal<T, St>
where
T: Clone + Send + Sync + Serialize,
@@ -99,8 +96,15 @@ where
S: serde::Serializer,
{
match &self.0 {
None => None::<T>.serialize(serializer),
Some(signal) => signal.with(|value| value.serialize(serializer)),
None | Some(MaybeSignal::Static(None)) => {
None::<T>.serialize(serializer)
}
Some(MaybeSignal::Static(Some(value))) => {
value.serialize(serializer)
}
Some(MaybeSignal::Dynamic(signal)) => {
signal.with(|value| value.serialize(serializer))
}
}
}
}
@@ -142,7 +146,6 @@ impl<'de, T: Deserialize<'de>> Deserialize<'de> for ArcRwSignal<T> {
}
}
#[allow(deprecated)]
impl<'de, T: Deserialize<'de>, St> Deserialize<'de> for MaybeSignal<T, St>
where
St: Storage<T>,

View File

@@ -1,238 +0,0 @@
use crate::{
traits::{
DefinedAt, Get, GetUntracked, Read, ReadUntracked, Track, With,
WithUntracked,
},
unwrap_signal,
};
use std::panic::Location;
impl<T> DefinedAt for Option<T>
where
T: DefinedAt,
{
fn defined_at(&self) -> Option<&'static Location<'static>> {
self.as_ref().map(DefinedAt::defined_at).unwrap_or(None)
}
}
impl<T> Track for Option<T>
where
T: Track,
{
fn track(&self) {
if let Some(signal) = self {
signal.track();
}
}
}
/// An alternative [`ReadUntracked`](crate) trait that works with `Option<Readable>` types.
pub trait ReadUntrackedOptional: Sized + DefinedAt {
/// The guard type that will be returned, which can be dereferenced to the value.
type Value;
/// Returns the guard, or `None` if the signal has already been disposed.
#[track_caller]
fn try_read_untracked(&self) -> Option<Self::Value>;
/// Returns the guard.
///
/// # Panics
/// Panics if you try to access a signal that has been disposed.
#[track_caller]
fn read_untracked(&self) -> Self::Value {
self.try_read_untracked()
.unwrap_or_else(unwrap_signal!(self))
}
}
impl<T> ReadUntrackedOptional for Option<T>
where
Self: DefinedAt,
T: ReadUntracked,
{
type Value = Option<<T as ReadUntracked>::Value>;
fn try_read_untracked(&self) -> Option<Self::Value> {
Some(if let Some(signal) = self {
Some(signal.try_read_untracked()?)
} else {
None
})
}
}
/// An alternative [`Read`](crate) trait that works with `Option<Readable>` types.
pub trait ReadOptional: DefinedAt {
/// The guard type that will be returned, which can be dereferenced to the value.
type Value;
/// Subscribes to the signal, and returns the guard, or `None` if the signal has already been disposed.
#[track_caller]
fn try_read(&self) -> Option<Self::Value>;
/// Subscribes to the signal, and returns the guard.
///
/// # Panics
/// Panics if you try to access a signal that has been disposed.
#[track_caller]
fn read(&self) -> Self::Value {
self.try_read().unwrap_or_else(unwrap_signal!(self))
}
}
impl<T> ReadOptional for Option<T>
where
Self: DefinedAt,
T: Read,
{
type Value = Option<<T as Read>::Value>;
fn try_read(&self) -> Option<Self::Value> {
Some(if let Some(readable) = self {
Some(readable.try_read()?)
} else {
None
})
}
}
/// An alternative [`WithUntracked`](crate) trait that works with `Option<Withable>` types.
pub trait WithUntrackedOptional: DefinedAt {
/// The type of the value contained in the signal.
type Value: ?Sized;
/// Applies the closure to the value, and returns the result,
/// or `None` if the signal has already been disposed.
#[track_caller]
fn try_with_untracked<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> Option<U>;
/// Applies the closure to the value, and returns the result.
///
/// # Panics
/// Panics if you try to access a signal that has been disposed.
#[track_caller]
fn with_untracked<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> U {
self.try_with_untracked(fun)
.unwrap_or_else(unwrap_signal!(self))
}
}
impl<T> WithUntrackedOptional for Option<T>
where
Self: DefinedAt,
T: WithUntracked,
<T as WithUntracked>::Value: Sized,
{
type Value = <T as WithUntracked>::Value;
fn try_with_untracked<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> Option<U> {
if let Some(signal) = self {
Some(signal.try_with_untracked(|val| fun(Some(val)))?)
} else {
Some(fun(None))
}
}
}
/// An alternative [`With`](crate) trait that works with `Option<Withable>` types.
pub trait WithOptional: DefinedAt {
/// The type of the value contained in the signal.
type Value: ?Sized;
/// Subscribes to the signal, applies the closure to the value, and returns the result,
/// or `None` if the signal has already been disposed.
#[track_caller]
fn try_with<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> Option<U>;
/// Subscribes to the signal, applies the closure to the value, and returns the result.
///
/// # Panics
/// Panics if you try to access a signal that has been disposed.
#[track_caller]
fn with<U>(&self, fun: impl FnOnce(Option<&Self::Value>) -> U) -> U {
self.try_with(fun).unwrap_or_else(unwrap_signal!(self))
}
}
impl<T> WithOptional for Option<T>
where
Self: DefinedAt,
T: With,
<T as With>::Value: Sized,
{
type Value = <T as With>::Value;
fn try_with<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> Option<U> {
if let Some(signal) = self {
Some(signal.try_with(|val| fun(Some(val)))?)
} else {
Some(fun(None))
}
}
}
impl<T> GetUntracked for Option<T>
where
Self: DefinedAt,
T: GetUntracked,
{
type Value = Option<<T as GetUntracked>::Value>;
fn try_get_untracked(&self) -> Option<Self::Value> {
Some(if let Some(signal) = self {
Some(signal.try_get_untracked()?)
} else {
None
})
}
}
impl<T> Get for Option<T>
where
Self: DefinedAt,
T: Get,
{
type Value = Option<<T as Get>::Value>;
fn try_get(&self) -> Option<Self::Value> {
Some(if let Some(signal) = self {
Some(signal.try_get()?)
} else {
None
})
}
}
/// Helper trait to implement flatten() on Option<&Option<T>>.
pub trait FlattenOptionRefOption {
/// The type of the value contained in the double option.
type Value;
/// Converts from `Option<&Option<T>>` to `Option<&T>`.
fn flatten(&self) -> Option<&Self::Value>;
}
impl<'a, T> FlattenOptionRefOption for Option<&'a Option<T>> {
type Value = T;
fn flatten(&self) -> Option<&'a T> {
self.map(Option::as_ref).flatten()
}
}

View File

@@ -48,7 +48,6 @@
//! there isn't an `RwLock` so you can't wrap in a [`ReadGuard`](crate::signal::guards::ReadGuard),
//! but you can still implement [`WithUntracked`] and [`Track`], the same traits will still be implemented.
pub use crate::trait_options::*;
use crate::{
effect::Effect,
graph::{Observer, Source, Subscriber, ToAnySource},

View File

@@ -606,33 +606,6 @@ pub mod read {
}
}
impl<T: Send + Sync + 'static> From<T> for ArcSignal<T, SyncStorage> {
#[track_caller]
fn from(value: T) -> Self {
ArcSignal::stored(value)
}
}
impl<T> From<T> for Signal<T>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: T) -> Self {
Self::stored(value)
}
}
impl<T> From<T> for Signal<T, LocalStorage>
where
T: 'static,
{
#[track_caller]
fn from(value: T) -> Self {
Self::stored_local(value)
}
}
impl<T> From<ArcSignal<T, SyncStorage>> for Signal<T>
where
T: Send + Sync + 'static,
@@ -708,34 +681,6 @@ pub mod read {
}
}
impl<T> From<ArcReadSignal<T>> for Signal<T>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcReadSignal<T>) -> Self {
Self {
inner: ArenaItem::new(SignalTypes::ReadSignal(value)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<ArcReadSignal<T>> for Signal<T, LocalStorage>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcReadSignal<T>) -> Self {
Self {
inner: ArenaItem::new_local(SignalTypes::ReadSignal(value)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<RwSignal<T>> for Signal<T>
where
T: Send + Sync + 'static,
@@ -768,38 +713,6 @@ pub mod read {
}
}
impl<T> From<ArcRwSignal<T>> for Signal<T>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcRwSignal<T>) -> Self {
Self {
inner: ArenaItem::new(SignalTypes::ReadSignal(
value.read_only(),
)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<ArcRwSignal<T>> for Signal<T, LocalStorage>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcRwSignal<T>) -> Self {
Self {
inner: ArenaItem::new_local(SignalTypes::ReadSignal(
value.read_only(),
)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<Memo<T>> for Signal<T>
where
T: Send + Sync + 'static,
@@ -828,74 +741,6 @@ pub mod read {
}
}
impl<T> From<ArcMemo<T>> for Signal<T>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcMemo<T>) -> Self {
Self {
inner: ArenaItem::new(SignalTypes::Memo(value)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<ArcMemo<T, LocalStorage>> for Signal<T, LocalStorage>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcMemo<T, LocalStorage>) -> Self {
Self {
inner: ArenaItem::new_local(SignalTypes::Memo(value)),
#[cfg(debug_assertions)]
defined_at: std::panic::Location::caller(),
}
}
}
impl<T> From<T> for Signal<Option<T>>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: T) -> Self {
Signal::stored(Some(value))
}
}
impl<T> From<T> for Signal<Option<T>, LocalStorage>
where
T: 'static,
{
#[track_caller]
fn from(value: T) -> Self {
Signal::stored_local(Some(value))
}
}
impl<T> From<Signal<T>> for Signal<Option<T>>
where
T: Clone + Send + Sync + 'static,
{
#[track_caller]
fn from(value: Signal<T>) -> Self {
Signal::derive(move || Some(value.get()))
}
}
impl<T> From<Signal<T, LocalStorage>> for Signal<Option<T>, LocalStorage>
where
T: Clone + 'static,
{
#[track_caller]
fn from(value: Signal<T, LocalStorage>) -> Self {
Signal::derive_local(move || Some(value.get()))
}
}
impl From<&str> for Signal<String> {
#[track_caller]
fn from(value: &str) -> Self {
@@ -968,7 +813,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<T>> for Signal<T>
where
T: Send + Sync + 'static,
@@ -982,7 +826,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<T, LocalStorage>> for Signal<T, LocalStorage>
where
T: Send + Sync + 'static,
@@ -996,7 +839,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<T>> for Signal<Option<T>>
where
T: Clone + Send + Sync + 'static,
@@ -1012,7 +854,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<T, LocalStorage>> for Signal<Option<T>, LocalStorage>
where
T: Clone + Send + Sync + 'static,
@@ -1028,27 +869,6 @@ pub mod read {
}
}
impl<T> From<MaybeProp<T>> for Option<Signal<Option<T>>>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: MaybeProp<T>) -> Self {
value.0
}
}
impl<T> From<MaybeProp<T, LocalStorage>>
for Option<Signal<Option<T>, LocalStorage>>
where
T: Send + Sync + 'static,
{
#[track_caller]
fn from(value: MaybeProp<T, LocalStorage>) -> Self {
value.0
}
}
/// A wrapper for a value that is *either* `T` or [`Signal<T>`].
///
/// This allows you to create APIs that take either a reactive or a non-reactive value
@@ -1077,12 +897,6 @@ pub mod read {
/// assert_eq!(above_3(&memoized_double_count.into()), true);
/// ```
#[derive(Debug, PartialEq, Eq)]
#[deprecated(
since = "0.7.0-rc1",
note = "`MaybeSignal<T>` is deprecated in favour of `Signal<T>` which \
is `Copy`, now has a more efficient From<T> implementation \
and other benefits in 0.7."
)]
pub enum MaybeSignal<T, S = SyncStorage>
where
T: 'static,
@@ -1094,7 +908,6 @@ pub mod read {
Dynamic(Signal<T, S>),
}
#[allow(deprecated)]
impl<T: Clone, S> Clone for MaybeSignal<T, S>
where
S: Storage<T>,
@@ -1107,10 +920,8 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T: Copy, S> Copy for MaybeSignal<T, S> where S: Storage<T> {}
#[allow(deprecated)]
impl<T: Default, S> Default for MaybeSignal<T, S>
where
S: Storage<T>,
@@ -1120,7 +931,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T, S> DefinedAt for MaybeSignal<T, S>
where
S: Storage<T>,
@@ -1132,7 +942,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T, S> Track for MaybeSignal<T, S>
where
S: Storage<T> + Storage<SignalTypes<T, S>>,
@@ -1145,7 +954,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T, S> ReadUntracked for MaybeSignal<T, S>
where
T: Clone,
@@ -1170,7 +978,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> MaybeSignal<T>
where
T: Send + Sync,
@@ -1184,7 +991,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> MaybeSignal<T, LocalStorage> {
/// Wraps a derived signal, i.e., any computation that accesses one or more
/// reactive signals.
@@ -1193,7 +999,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<T> for MaybeSignal<T, SyncStorage>
where
SyncStorage: Storage<T>,
@@ -1203,7 +1008,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> FromLocal<T> for MaybeSignal<T, LocalStorage>
where
LocalStorage: Storage<T>,
@@ -1213,7 +1017,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<ReadSignal<T>> for MaybeSignal<T>
where
T: Send + Sync,
@@ -1223,14 +1026,12 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<ReadSignal<T, LocalStorage>> for MaybeSignal<T, LocalStorage> {
fn from(value: ReadSignal<T, LocalStorage>) -> Self {
Self::Dynamic(value.into())
}
}
#[allow(deprecated)]
impl<T> From<RwSignal<T>> for MaybeSignal<T>
where
T: Send + Sync,
@@ -1240,14 +1041,12 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<RwSignal<T, LocalStorage>> for MaybeSignal<T, LocalStorage> {
fn from(value: RwSignal<T, LocalStorage>) -> Self {
Self::Dynamic(value.into())
}
}
#[allow(deprecated)]
impl<T> From<Memo<T>> for MaybeSignal<T>
where
T: Send + Sync,
@@ -1257,14 +1056,12 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<Memo<T, LocalStorage>> for MaybeSignal<T, LocalStorage> {
fn from(value: Memo<T, LocalStorage>) -> Self {
Self::Dynamic(value.into())
}
}
#[allow(deprecated)]
impl<T> From<ArcReadSignal<T>> for MaybeSignal<T>
where
T: Send + Sync,
@@ -1274,14 +1071,12 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> FromLocal<ArcReadSignal<T>> for MaybeSignal<T, LocalStorage> {
fn from_local(value: ArcReadSignal<T>) -> Self {
ReadSignal::from_local(value).into()
}
}
#[allow(deprecated)]
impl<T> From<ArcRwSignal<T>> for MaybeSignal<T>
where
T: Send + Sync + 'static,
@@ -1291,7 +1086,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> FromLocal<ArcRwSignal<T>> for MaybeSignal<T, LocalStorage>
where
T: 'static,
@@ -1301,7 +1095,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> From<ArcMemo<T>> for MaybeSignal<T>
where
T: Send + Sync,
@@ -1311,14 +1104,12 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<T> FromLocal<ArcMemo<T, LocalStorage>> for MaybeSignal<T, LocalStorage> {
fn from_local(value: ArcMemo<T, LocalStorage>) -> Self {
Memo::from_local(value).into()
}
}
#[allow(deprecated)]
impl<T, S> From<Signal<T, S>> for MaybeSignal<T, S>
where
S: Storage<T>,
@@ -1328,7 +1119,6 @@ pub mod read {
}
}
#[allow(deprecated)]
impl<S> From<&str> for MaybeSignal<String, S>
where
S: Storage<String> + Storage<Arc<RwLock<String>>>,
@@ -1372,28 +1162,25 @@ pub mod read {
/// ```
#[derive(Debug, PartialEq, Eq)]
pub struct MaybeProp<T: 'static, S = SyncStorage>(
pub(crate) Option<Signal<Option<T>, S>>,
pub(crate) Option<MaybeSignal<Option<T>, S>>,
)
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>;
S: Storage<Option<T>>;
impl<T, S> Clone for MaybeProp<T, S>
impl<T: Clone, S> Clone for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
S: Storage<Option<T>>,
{
fn clone(&self) -> Self {
*self
Self(self.0.clone())
}
}
impl<T, S> Copy for MaybeProp<T, S> where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>
{
}
impl<T: Copy, S> Copy for MaybeProp<T, S> where S: Storage<Option<T>> {}
impl<T, S> Default for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
S: Storage<Option<T>>,
{
fn default() -> Self {
Self(None)
@@ -1402,7 +1189,7 @@ pub mod read {
impl<T, S> DefinedAt for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
S: Storage<Option<T>>,
{
fn defined_at(&self) -> Option<&'static Location<'static>> {
// TODO this can be improved by adding a defined_at field
@@ -1425,7 +1212,7 @@ pub mod read {
impl<T, S> ReadUntracked for MaybeProp<T, S>
where
T: Clone,
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
S: Storage<SignalTypes<Option<T>, S>> + Storage<Option<T>>,
{
type Value = ReadGuard<Option<T>, SignalReadGuard<Option<T>, S>>;
@@ -1453,49 +1240,43 @@ pub mod read {
pub fn derive(
derived_signal: impl Fn() -> Option<T> + Send + Sync + 'static,
) -> Self {
Self(Some(Signal::derive(derived_signal)))
Self(Some(MaybeSignal::derive(derived_signal)))
}
}
impl<T> From<T> for MaybeProp<T>
where
T: Send + Sync,
SyncStorage: Storage<Option<T>>,
{
fn from(value: T) -> Self {
Self(Some(Signal::stored(Some(value))))
Self(Some(MaybeSignal::from(Some(value))))
}
}
impl<T> From<Option<T>> for MaybeProp<T>
where
T: Send + Sync,
SyncStorage: Storage<Option<T>>,
{
fn from(value: Option<T>) -> Self {
Self(Some(Signal::stored(value)))
Self(Some(MaybeSignal::from(value)))
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
SyncStorage: Storage<Option<T>>,
{
fn from(value: MaybeSignal<Option<T>>) -> Self {
Self(Some(value.into()))
Self(Some(value))
}
}
#[allow(deprecated)]
impl<T> From<Option<MaybeSignal<Option<T>>>> for MaybeProp<T>
where
T: Send + Sync,
SyncStorage: Storage<Option<T>>,
{
fn from(value: Option<MaybeSignal<Option<T>>>) -> Self {
Self(value.map(Into::into))
Self(value)
}
}
@@ -1528,11 +1309,10 @@ pub mod read {
impl<T> From<Signal<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
SyncStorage: Storage<Option<T>>,
{
fn from(value: Signal<Option<T>>) -> Self {
Self(Some(value))
Self(Some(value.into()))
}
}
@@ -1541,7 +1321,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: ReadSignal<T>) -> Self {
Self(Some(Signal::derive(move || Some(value.get()))))
Self(Some(MaybeSignal::derive(move || Some(value.get()))))
}
}
@@ -1550,7 +1330,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: RwSignal<T>) -> Self {
Self(Some(Signal::derive(move || Some(value.get()))))
Self(Some(MaybeSignal::derive(move || Some(value.get()))))
}
}
@@ -1559,7 +1339,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: Memo<T>) -> Self {
Self(Some(Signal::derive(move || Some(value.get()))))
Self(Some(MaybeSignal::derive(move || Some(value.get()))))
}
}
@@ -1568,13 +1348,13 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: Signal<T>) -> Self {
Self(Some(Signal::derive(move || Some(value.get()))))
Self(Some(MaybeSignal::derive(move || Some(value.get()))))
}
}
impl From<&str> for MaybeProp<String> {
fn from(value: &str) -> Self {
Self(Some(Signal::from(Some(value.to_string()))))
Self(Some(MaybeSignal::from(Some(value.to_string()))))
}
}
@@ -1584,41 +1364,35 @@ pub mod read {
pub fn derive_local(
derived_signal: impl Fn() -> Option<T> + 'static,
) -> Self {
Self(Some(Signal::derive_local(derived_signal)))
Self(Some(MaybeSignal::derive_local(derived_signal)))
}
}
impl<T> FromLocal<T> for MaybeProp<T, LocalStorage> {
fn from_local(value: T) -> Self {
Self(Some(Signal::stored_local(Some(value))))
Self(Some(MaybeSignal::from_local(Some(value))))
}
}
impl<T> FromLocal<Option<T>> for MaybeProp<T, LocalStorage> {
fn from_local(value: Option<T>) -> Self {
Self(Some(Signal::stored_local(value)))
Self(Some(MaybeSignal::from_local(value)))
}
}
#[allow(deprecated)]
impl<T> From<MaybeSignal<Option<T>, LocalStorage>>
for MaybeProp<T, LocalStorage>
where
T: Send + Sync,
{
fn from(value: MaybeSignal<Option<T>, LocalStorage>) -> Self {
Self(Some(value.into()))
Self(Some(value))
}
}
#[allow(deprecated)]
impl<T> From<Option<MaybeSignal<Option<T>, LocalStorage>>>
for MaybeProp<T, LocalStorage>
where
T: Send + Sync,
{
fn from(value: Option<MaybeSignal<Option<T>, LocalStorage>>) -> Self {
Self(value.map(Into::into))
Self(value)
}
}
@@ -1651,7 +1425,7 @@ pub mod read {
impl<T> From<Signal<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage> {
fn from(value: Signal<Option<T>, LocalStorage>) -> Self {
Self(Some(value))
Self(Some(value.into()))
}
}
@@ -1660,7 +1434,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: ReadSignal<T, LocalStorage>) -> Self {
Self(Some(Signal::derive_local(move || Some(value.get()))))
Self(Some(MaybeSignal::derive_local(move || Some(value.get()))))
}
}
@@ -1669,7 +1443,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: RwSignal<T, LocalStorage>) -> Self {
Self(Some(Signal::derive_local(move || Some(value.get()))))
Self(Some(MaybeSignal::derive_local(move || Some(value.get()))))
}
}
@@ -1678,7 +1452,7 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: Memo<T, LocalStorage>) -> Self {
Self(Some(Signal::derive_local(move || Some(value.get()))))
Self(Some(MaybeSignal::derive_local(move || Some(value.get()))))
}
}
@@ -1687,13 +1461,13 @@ pub mod read {
T: Send + Sync + Clone,
{
fn from(value: Signal<T, LocalStorage>) -> Self {
Self(Some(Signal::derive_local(move || Some(value.get()))))
Self(Some(MaybeSignal::derive_local(move || Some(value.get()))))
}
}
impl From<&str> for MaybeProp<String, LocalStorage> {
fn from(value: &str) -> Self {
Self(Some(Signal::stored_local(Some(value.to_string()))))
Self(Some(MaybeSignal::from_local(Some(value.to_string()))))
}
}

View File

@@ -5,11 +5,18 @@ use std::{
str::FromStr,
};
use thiserror::Error;
use throw_error::Error;
use url::Url;
/// A custom header that can be used to indicate a server function returned an error.
pub const SERVER_FN_ERROR_HEADER: &str = "serverfnerror";
impl From<ServerFnError> for Error {
fn from(e: ServerFnError) -> Self {
Error::from(ServerFnErrorErr::from(e))
}
}
/// An empty value indicating that there is no custom error type associated
/// with this server function.
#[derive(
@@ -129,39 +136,30 @@ impl<E> ViaError<E> for WrapError<E> {
/// Unlike [`ServerFnErrorErr`], this does not implement [`Error`](trait@std::error::Error).
/// This means that other error types can easily be converted into it using the
/// `?` operator.
#[derive(Debug, Error, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
)]
pub enum ServerFnError<E = NoCustomError> {
/// A user-defined custom error type, which defaults to [`NoCustomError`].
#[error("internal error: {0}")]
WrappedServerError(E),
/// Error while trying to register the server function (only occurs in case of poisoned RwLock).
#[error("error while trying to register the server function: {0}")]
Registration(String),
/// Occurs on the client if there is a network error while trying to run function on server.
#[error("error reaching server to call server function: {0}")]
Request(String),
/// Occurs on the server if there is an error creating an HTTP response.
Response(String),
/// Occurs when there is an error while actually running the function on the server.
#[error("error running server function: {0}")]
ServerError(String),
/// Occurs on the client if there is an error deserializing the server's response.
#[error("error deserializing server function results: {0}")]
Deserialization(String),
/// Occurs on the client if there is an error serializing the server function arguments.
#[error("error serializing server function arguments: {0}")]
Serialization(String),
/// Occurs on the server if there is an error deserializing one of the arguments that's been sent.
#[error("error deserializing server function arguments: {0}")]
Args(String),
/// Occurs on the server if there's a missing argument.
#[error("missing argument {0}")]
MissingArg(String),
/// Occurs on the server if there is an error creating an HTTP response.
#[error("error creating response {0}")]
Response(String),
}
impl ServerFnError<NoCustomError> {
@@ -177,6 +175,45 @@ impl<CustErr> From<CustErr> for ServerFnError<CustErr> {
}
}
impl<E: std::error::Error> From<E> for ServerFnError {
fn from(value: E) -> Self {
ServerFnError::ServerError(value.to_string())
}
}
impl<CustErr> Display for ServerFnError<CustErr>
where
CustErr: Display,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
match self {
ServerFnError::Registration(s) => format!(
"error while trying to register the server function: {s}"
),
ServerFnError::Request(s) => format!(
"error reaching server to call server function: {s}"
),
ServerFnError::ServerError(s) =>
format!("error running server function: {s}"),
ServerFnError::Deserialization(s) =>
format!("error deserializing server function results: {s}"),
ServerFnError::Serialization(s) =>
format!("error serializing server function arguments: {s}"),
ServerFnError::Args(s) => format!(
"error deserializing server function arguments: {s}"
),
ServerFnError::MissingArg(s) => format!("missing argument {s}"),
ServerFnError::Response(s) =>
format!("error generating HTTP response: {s}"),
ServerFnError::WrappedServerError(e) => format!("{e}"),
}
)
}
}
/// A serializable custom server function error type.
///
/// This is implemented for all types that implement [`FromStr`] + [`Display`].
@@ -261,6 +298,87 @@ where
}
}
impl<E> std::error::Error for ServerFnError<E>
where
E: std::error::Error + 'static,
ServerFnError<E>: std::fmt::Display,
{
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
ServerFnError::WrappedServerError(e) => Some(e),
_ => None,
}
}
}
/// Type for errors that can occur when using server functions.
///
/// Unlike [`ServerFnError`], this implements [`std::error::Error`]. This means
/// it can be used in situations in which the `Error` trait is required, but its
/// not possible to create a blanket implementation that converts other errors into
/// this type.
///
/// [`ServerFnError`] and [`ServerFnErrorErr`] mutually implement [`From`], so
/// it is easy to convert between the two types.
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum ServerFnErrorErr<E = NoCustomError> {
/// A user-defined custom error type, which defaults to [`NoCustomError`].
#[error("internal error: {0}")]
WrappedServerError(E),
/// Error while trying to register the server function (only occurs in case of poisoned RwLock).
#[error("error while trying to register the server function: {0}")]
Registration(String),
/// Occurs on the client if there is a network error while trying to run function on server.
#[error("error reaching server to call server function: {0}")]
Request(String),
/// Occurs when there is an error while actually running the function on the server.
#[error("error running server function: {0}")]
ServerError(String),
/// Occurs on the client if there is an error deserializing the server's response.
#[error("error deserializing server function results: {0}")]
Deserialization(String),
/// Occurs on the client if there is an error serializing the server function arguments.
#[error("error serializing server function arguments: {0}")]
Serialization(String),
/// Occurs on the server if there is an error deserializing one of the arguments that's been sent.
#[error("error deserializing server function arguments: {0}")]
Args(String),
/// Occurs on the server if there's a missing argument.
#[error("missing argument {0}")]
MissingArg(String),
/// Occurs on the server if there is an error creating an HTTP response.
#[error("error creating response {0}")]
Response(String),
}
impl<CustErr> From<ServerFnError<CustErr>> for ServerFnErrorErr<CustErr> {
fn from(value: ServerFnError<CustErr>) -> Self {
match value {
ServerFnError::Registration(value) => {
ServerFnErrorErr::Registration(value)
}
ServerFnError::Request(value) => ServerFnErrorErr::Request(value),
ServerFnError::ServerError(value) => {
ServerFnErrorErr::ServerError(value)
}
ServerFnError::Deserialization(value) => {
ServerFnErrorErr::Deserialization(value)
}
ServerFnError::Serialization(value) => {
ServerFnErrorErr::Serialization(value)
}
ServerFnError::Args(value) => ServerFnErrorErr::Args(value),
ServerFnError::MissingArg(value) => {
ServerFnErrorErr::MissingArg(value)
}
ServerFnError::WrappedServerError(value) => {
ServerFnErrorErr::WrappedServerError(value)
}
ServerFnError::Response(value) => ServerFnErrorErr::Response(value),
}
}
}
/// Associates a particular server function error with the server function
/// found at a particular path.
///
@@ -337,3 +455,9 @@ impl<CustErr> From<ServerFnUrlError<CustErr>> for ServerFnError<CustErr> {
error.error
}
}
impl<CustErr> From<ServerFnUrlError<CustErr>> for ServerFnErrorErr<CustErr> {
fn from(error: ServerFnUrlError<CustErr>) -> Self {
error.error.into()
}
}

View File

@@ -1,5 +1,7 @@
use super::Res;
use crate::error::{ServerFnError, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER};
use crate::error::{
ServerFnError, ServerFnErrorErr, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER,
};
use actix_web::{
http::{
header,
@@ -73,7 +75,7 @@ where
builder
.insert_header((header::CONTENT_TYPE, content_type))
.streaming(
data.map(|data| data.map_err(|e| server_fn_error!(e))),
data.map(|data| data.map_err(ServerFnErrorErr::from)),
),
)))
}

View File

@@ -13,7 +13,9 @@
//! crate under the hood.
use super::Res;
use crate::error::{ServerFnError, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER};
use crate::error::{
ServerFnError, ServerFnErrorErr, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER,
};
use bytes::Bytes;
use futures::{Stream, TryStreamExt};
use http::{header, HeaderValue, Response, StatusCode};
@@ -81,7 +83,7 @@ where
.status(200)
.header(http::header::CONTENT_TYPE, content_type)
.body(Body::Async(Box::pin(
data.map_err(|e| server_fn_error!(e)).map_err(Error::from),
data.map_err(ServerFnErrorErr::from).map_err(Error::from),
)))
.map_err(|e| ServerFnError::Response(e.to_string()))
}

View File

@@ -1,5 +1,7 @@
use super::Res;
use crate::error::{ServerFnError, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER};
use crate::error::{
ServerFnError, ServerFnErrorErr, ServerFnErrorSerde, SERVER_FN_ERROR_HEADER,
};
use axum::body::Body;
use bytes::Bytes;
use futures::{Stream, StreamExt};
@@ -44,7 +46,7 @@ where
+ 'static,
) -> Result<Self, ServerFnError<CustErr>> {
let body =
Body::from_stream(data.map(|n| n.map_err(|e| server_fn_error!(e))));
Body::from_stream(data.map(|n| n.map_err(ServerFnErrorErr::from)));
let builder = http::Response::builder();
builder
.status(200)

View File

@@ -519,7 +519,6 @@ mod stable {
macro_rules! class_signal_arena {
($sig:ident) => {
#[allow(deprecated)]
impl<C, S> IntoClass for $sig<C, S>
where
$sig<C, S>: Get<Value = C>,
@@ -589,7 +588,6 @@ mod stable {
}
}
#[allow(deprecated)]
impl<S> IntoClass for (&'static str, $sig<bool, S>)
where
$sig<bool, S>: Get<Value = bool>,
@@ -827,14 +825,12 @@ mod stable {
use super::RenderEffect;
use crate::html::class::IntoClass;
#[allow(deprecated)]
use reactive_graph::wrappers::read::MaybeSignal;
use reactive_graph::{
computed::{ArcMemo, Memo},
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::Get,
wrappers::read::{ArcSignal, Signal},
wrappers::read::{ArcSignal, MaybeSignal, Signal},
};
class_signal_arena!(RwSignal);

View File

@@ -89,15 +89,13 @@ where
#[cfg(not(feature = "nightly"))]
mod stable {
use crate::html::element::InnerHtmlValue;
#[allow(deprecated)]
use reactive_graph::wrappers::read::MaybeSignal;
use reactive_graph::{
computed::{ArcMemo, Memo},
effect::RenderEffect,
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::Get,
wrappers::read::{ArcSignal, Signal},
wrappers::read::{ArcSignal, MaybeSignal, Signal},
};
macro_rules! inner_html_signal {
@@ -161,7 +159,6 @@ mod stable {
macro_rules! inner_html_signal_arena {
($sig:ident) => {
#[allow(deprecated)]
impl<V, S> InnerHtmlValue for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,

View File

@@ -507,15 +507,13 @@ mod stable {
RenderHtml,
},
};
#[allow(deprecated)]
use reactive_graph::wrappers::read::MaybeSignal;
use reactive_graph::{
computed::{ArcMemo, Memo},
effect::RenderEffect,
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::Get,
wrappers::read::{ArcSignal, Signal},
wrappers::read::{ArcSignal, MaybeSignal, Signal},
};
macro_rules! signal_impl {
@@ -685,7 +683,6 @@ mod stable {
macro_rules! signal_impl_arena {
($sig:ident $dry_resolve:literal) => {
#[allow(deprecated)]
impl<V, S> Render for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,
@@ -710,7 +707,6 @@ mod stable {
}
}
#[allow(deprecated)]
impl<V, S> AddAnyAttr for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,
@@ -732,7 +728,6 @@ mod stable {
}
}
#[allow(deprecated)]
impl<V, S> RenderHtml for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,
@@ -798,7 +793,6 @@ mod stable {
}
}
#[allow(deprecated)]
impl<V, S> AttributeValue for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,

View File

@@ -82,15 +82,13 @@ where
#[cfg(not(feature = "nightly"))]
mod stable {
use crate::html::property::IntoProperty;
#[allow(deprecated)]
use reactive_graph::wrappers::read::MaybeSignal;
use reactive_graph::{
computed::{ArcMemo, Memo},
effect::RenderEffect,
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::Get,
wrappers::read::{ArcSignal, Signal},
wrappers::read::{ArcSignal, MaybeSignal, Signal},
};
macro_rules! property_signal {
@@ -138,7 +136,6 @@ mod stable {
macro_rules! property_signal_arena {
($sig:ident) => {
#[allow(deprecated)]
impl<V, S> IntoProperty for $sig<V, S>
where
$sig<V, S>: Get<Value = V>,

View File

@@ -393,7 +393,6 @@ mod stable {
macro_rules! style_signal_arena {
($sig:ident) => {
#[allow(deprecated)]
impl<C, S> IntoStyle for $sig<C, S>
where
$sig<C, S>: Get<Value = C>,
@@ -459,7 +458,6 @@ mod stable {
}
}
#[allow(deprecated)]
impl<S, St> IntoStyle for (&'static str, $sig<S, St>)
where
$sig<S, St>: Get<Value = S>,
@@ -536,14 +534,12 @@ mod stable {
use super::RenderEffect;
use crate::html::style::IntoStyle;
#[allow(deprecated)]
use reactive_graph::wrappers::read::MaybeSignal;
use reactive_graph::{
computed::{ArcMemo, Memo},
owner::Storage,
signal::{ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal},
traits::Get,
wrappers::read::{ArcSignal, Signal},
wrappers::read::{ArcSignal, MaybeSignal, Signal},
};
use std::borrow::Cow;