chore: remove unnecessary default generics

This commit is contained in:
Greg Johnston 2024-07-24 07:46:35 -04:00
parent 634ac1c4a3
commit 200047a8bc
15 changed files with 34 additions and 36 deletions

View file

@ -40,7 +40,7 @@
//!
//! Use `SyncCallback` when you want the function to be `Sync` and `Send`.
use reactive_graph::owner::{StoredValue, SyncStorage};
use reactive_graph::owner::StoredValue;
use std::{fmt, rc::Rc, sync::Arc};
/// A wrapper trait for calling callbacks.
@ -169,7 +169,7 @@ impl<In, Out> Fn<(In,)> for UnsyncCallback<In, Out> {
/// }
/// ```
pub struct Callback<In, Out = ()>(
StoredValue<Arc<dyn Fn(In) -> Out + Send + Sync>, SyncStorage>,
StoredValue<Arc<dyn Fn(In) -> Out + Send + Sync>>,
)
where
In: 'static,

View file

@ -7,7 +7,7 @@ use leptos_macro::component;
use reactive_graph::{
computed::{suspense::SuspenseContext, ArcMemo},
effect::Effect,
owner::{provide_context, Owner, SyncStorage},
owner::{provide_context, Owner},
signal::ArcRwSignal,
traits::{Get, Set, Track, With},
wrappers::write::SignalSetter,
@ -25,7 +25,7 @@ pub fn Transition<Chil>(
/// the `pending` state, with its argument indicating whether it is pending (`true`)
/// or not pending (`false`).
#[prop(optional, into)]
set_pending: Option<SignalSetter<bool, SyncStorage>>,
set_pending: Option<SignalSetter<bool>>,
children: TypedChildren<Chil>,
) -> impl IntoView
where

View file

@ -172,7 +172,7 @@ where
S::Error: Send + Sync + 'static,
{
type Target =
Action<S, Result<S::Output, ServerFnError<S::Error>>, SyncStorage>;
Action<S, Result<S::Output, ServerFnError<S::Error>>>;
fn deref(&self) -> &Self::Target {
&self.inner
@ -180,7 +180,7 @@ where
}
impl<S> From<ServerAction<S>>
for Action<S, Result<S::Output, ServerFnError<S::Error>>, SyncStorage>
for Action<S, Result<S::Output, ServerFnError<S::Error>>>
where
S: ServerFn + 'static,
S::Output: 'static,

View file

@ -149,8 +149,7 @@ where
S::Output: 'static,
S::Error: 'static,
{
type Target =
MultiAction<S, Result<S::Output, ServerFnError<S::Error>>, SyncStorage>;
type Target = MultiAction<S, Result<S::Output, ServerFnError<S::Error>>>;
fn deref(&self) -> &Self::Target {
&self.inner

View file

@ -400,7 +400,7 @@ where
T: Send + Sync + 'static,
{
ser: PhantomData<Ser>,
data: AsyncDerived<T, SyncStorage>,
data: AsyncDerived<T>,
}
impl<T: Send + Sync + 'static, Ser> Copy for Resource<T, Ser> {}
@ -415,7 +415,7 @@ impl<T, Ser> Deref for Resource<T, Ser>
where
T: Send + Sync + 'static,
{
type Target = AsyncDerived<T, SyncStorage>;
type Target = AsyncDerived<T>;
fn deref(&self) -> &Self::Target {
&self.data

View file

@ -581,7 +581,7 @@ impl<I, O, S> Dispose for Action<I, O, S> {
}
}
impl<I, O> Action<I, O, SyncStorage>
impl<I, O> Action<I, O>
where
I: Send + Sync + 'static,
O: Send + Sync + 'static,
@ -735,7 +735,7 @@ where
/// # });
/// ```
#[track_caller]
pub fn version(&self) -> RwSignal<usize, SyncStorage> {
pub fn version(&self) -> RwSignal<usize> {
let inner = self
.inner
.try_with_value(|inner| inner.version())
@ -767,7 +767,7 @@ where
/// # });
/// ```
#[track_caller]
pub fn pending(&self) -> Memo<bool, SyncStorage> {
pub fn pending(&self) -> Memo<bool> {
let inner = self
.inner
.try_with_value(|inner| inner.pending())
@ -995,7 +995,7 @@ impl<I, O, S> Copy for Action<I, O, S> {}
#[track_caller]
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `Action::new()` instead."]
pub fn create_action<I, O, F, Fu>(action_fn: F) -> Action<I, O, SyncStorage>
pub fn create_action<I, O, F, Fu>(action_fn: F) -> Action<I, O>
where
I: Send + Sync + 'static,
O: Send + Sync + 'static,

View file

@ -91,7 +91,7 @@ where
}
}
impl<I, O> MultiAction<I, O, SyncStorage>
impl<I, O> MultiAction<I, O>
where
I: Send + Sync + 'static,
O: Send + Sync + 'static,
@ -315,7 +315,7 @@ where
/// assert_eq!(version.get(), 3);
/// # });
/// ```
pub fn version(&self) -> RwSignal<usize, SyncStorage> {
pub fn version(&self) -> RwSignal<usize> {
self.inner
.try_with_value(|inner| inner.version())
.unwrap_or_else(unwrap_signal!(self))
@ -719,9 +719,9 @@ where
input: RwSignal<Option<I>, S>,
/// The most recent return value of the `async` function.
value: RwSignal<Option<O>, S>,
pending: RwSignal<bool, SyncStorage>,
pending: RwSignal<bool>,
/// Controls this submission has been canceled.
canceled: RwSignal<bool, SyncStorage>,
canceled: RwSignal<bool>,
}
impl<I, O, S> From<ArcSubmission<I, O>> for Submission<I, O, S>
@ -772,13 +772,13 @@ where
impl<I, O, S> Submission<I, O, S> {
/// Whether this submision is still waiting to resolve.
#[track_caller]
pub fn pending(&self) -> ReadSignal<bool, SyncStorage> {
pub fn pending(&self) -> ReadSignal<bool> {
self.pending.read_only()
}
/// Whether this submission has been canceled.
#[track_caller]
pub fn canceled(&self) -> ReadSignal<bool, SyncStorage> {
pub fn canceled(&self) -> ReadSignal<bool> {
self.canceled.read_only()
}

View file

@ -106,7 +106,7 @@ where
}
}
impl<T> AsyncDerived<T, SyncStorage>
impl<T> AsyncDerived<T>
where
T: 'static,
{

View file

@ -123,7 +123,7 @@ where
}
}
impl<T> Memo<T, SyncStorage>
impl<T> Memo<T>
where
T: Send + Sync + 'static,
{
@ -303,7 +303,7 @@ where
}
}
impl<T> From<ArcReadSignal<T>> for Memo<T, SyncStorage>
impl<T> From<ArcReadSignal<T>> for Memo<T>
where
T: Clone + PartialEq + Send + Sync + 'static,
{

View file

@ -209,7 +209,7 @@ where
}
}
impl<T> StoredValue<T, SyncStorage>
impl<T> StoredValue<T>
where
T: Send + Sync + 'static,
{
@ -330,7 +330,7 @@ impl<T, S> Dispose for StoredValue<T, S> {
#[deprecated = "This function is being removed to conform to Rust idioms. \
Please use `StoredValue::new()` or `StoredValue::new_local()` \
instead."]
pub fn store_value<T>(value: T) -> StoredValue<T, SyncStorage>
pub fn store_value<T>(value: T) -> StoredValue<T>
where
T: Send + Sync + 'static,
{

View file

@ -11,7 +11,7 @@ mod rw;
mod subscriber_traits;
mod write;
use crate::owner::{LocalStorage, SyncStorage};
use crate::owner::LocalStorage;
pub use arc_read::*;
pub use arc_rw::*;
pub use arc_trigger::*;
@ -110,7 +110,7 @@ pub fn arc_signal<T>(value: T) -> (ArcReadSignal<T>, ArcWriteSignal<T>) {
#[track_caller]
pub fn signal<T: Send + Sync + 'static>(
value: T,
) -> (ReadSignal<T, SyncStorage>, WriteSignal<T, SyncStorage>) {
) -> (ReadSignal<T>, WriteSignal<T>) {
RwSignal::new(value).split()
}
@ -172,6 +172,6 @@ pub fn signal_local<T: 'static>(
Rust idioms."]
pub fn create_signal<T: Send + Sync + 'static>(
value: T,
) -> (ReadSignal<T, SyncStorage>, WriteSignal<T, SyncStorage>) {
) -> (ReadSignal<T>, WriteSignal<T>) {
signal(value)
}

View file

@ -111,7 +111,7 @@ impl<T, S> Dispose for RwSignal<T, S> {
}
}
impl<T> RwSignal<T, SyncStorage>
impl<T> RwSignal<T>
where
T: Send + Sync + 'static,
{

View file

@ -189,14 +189,14 @@ async fn dynamic_dependencies() {
// we forget it so it continues running
// if it's dropped, it will stop listening
println!("[Initial]");
mem::forget(Effect::new_sync({
Effect::new_sync({
let combined_count = Arc::clone(&combined_count);
move |_| {
println!("Effect running.");
_ = name.get();
*combined_count.write().unwrap() += 1;
}
}));
});
Executor::tick().await;
println!("[After 1 tick]");

View file

@ -55,7 +55,7 @@ pub fn Router<Chil>(
base: Option<Cow<'static, str>>,
/// A signal that will be set while the navigation process is underway.
#[prop(optional, into)]
set_is_routing: Option<SignalSetter<bool, SyncStorage>>,
set_is_routing: Option<SignalSetter<bool>>,
// TODO trailing slashes
///// How trailing slashes should be handled in [`Route`] paths.
//#[prop(optional)]
@ -106,7 +106,7 @@ pub(crate) struct RouterContext {
pub current_url: ArcRwSignal<Url>,
pub location: Location,
pub state: ArcRwSignal<State>,
pub set_is_routing: Option<SignalSetter<bool, SyncStorage>>,
pub set_is_routing: Option<SignalSetter<bool>>,
}
impl RouterContext {
@ -471,7 +471,7 @@ pub fn provide_server_redirect(handler: impl Fn(&str) + Send + Sync + 'static) {
pub fn RoutingProgress(
/// Whether the router is currently loading the new page.
#[prop(into)]
is_routing: Signal<bool, SyncStorage>,
is_routing: Signal<bool>,
/// The maximum expected time for loading, which is used to
/// calibrate the animation process.
#[prop(optional, into)]

View file

@ -3,7 +3,6 @@ use crate::{
renderer::{dom::Dom, Renderer},
};
use reactive_graph::{
owner::SyncStorage,
signal::RwSignal,
traits::{DefinedAt, Set, Track, WithUntracked},
};
@ -12,7 +11,7 @@ use wasm_bindgen::JsCast;
/// A reactive reference to a DOM node that can be used with the `node_ref` attribute.
#[derive(Debug)]
pub struct NodeRef<E>(RwSignal<Option<SendWrapper<E::Output>>, SyncStorage>)
pub struct NodeRef<E>(RwSignal<Option<SendWrapper<E::Output>>>)
where
E: ElementType,
E::Output: 'static;