Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chores #3163

Merged
merged 2 commits into from
Oct 25, 2024
Merged

chores #3163

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions reactive_graph/src/effect/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::{
};

/// Effects run a certain chunk of code whenever the signals they depend on change.
///
/// Creating an effect runs the given function once after any current synchronous work is done.
/// This tracks its reactive values read within it, and reruns the function whenever the value
/// of a dependency changes.
Expand Down
23 changes: 14 additions & 9 deletions reactive_graph/src/owner/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ pub fn provide_context<T: Send + Sync + 'static>(value: T) {
}
}

/// Extracts a context value of type `T` from the reactive system by traversing
/// it upwards, beginning from the current reactive [`Owner`] and iterating
/// through its parents, if any. When the value is found, it is cloned.
/// Extracts a context value of type `T` from the reactive system.
///
/// This traverses the reactive ownership graph, beginning from the current reactive
/// [`Owner`] and iterating through its parents, if any. When the value is found, it is cloned.
///
/// The context value should have been provided elsewhere using
/// [`provide_context`](provide_context).
Expand Down Expand Up @@ -212,9 +213,11 @@ pub fn use_context<T: Clone + 'static>() -> Option<T> {
Owner::current().and_then(|owner| owner.use_context())
}

/// Extracts a context value of type `T` from the reactive system by traversing
/// it upwards, beginning from the current reactive [`Owner`] and iterating
/// through its parents, if any. When the value is found, it is cloned.
/// Extracts a context value of type `T` from the reactive system, and
/// panics if it can't be found.
///
/// This traverses the reactive ownership graph, beginning from the current reactive
/// [`Owner`] and iterating through its parents, if any. When the value is found, it is cloned.
///
/// Panics if no value is found.
///
Expand Down Expand Up @@ -270,9 +273,11 @@ pub fn expect_context<T: Clone + 'static>() -> T {
})
}

/// Extracts a context value of type `T` from the reactive system by traversing
/// it upwards, beginning from the current reactive [`Owner`] and iterating
/// through its parents, if any. When the value is found, it is removed from the context,
/// Extracts a context value of type `T` from the reactive system, and takes ownership,
/// removing it from the context system.
///
/// This traverses the reactive ownership graph, beginning from the current reactive
/// [`Owner`] and iterating through its parents, if any. When the value is found, it is removed,
/// and is not available to any other [`use_context`] or [`take_context`] calls.
///
/// If the value is `Clone`, use [`use_context`] instead.
Expand Down
1 change: 0 additions & 1 deletion reactive_graph/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ where
}
}

#[allow(deprecated)]
impl<T, St> Serialize for MaybeProp<T, St>
where
T: Send + Sync + Serialize,
Expand Down
38 changes: 4 additions & 34 deletions reactive_graph/src/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<MaybeProp<T>> for Option<Signal<Option<T>>>
where
T: Send + Sync + 'static,
Expand All @@ -1039,7 +1038,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<MaybeProp<T, LocalStorage>>
for Option<Signal<Option<T>, LocalStorage>>
where
Expand Down Expand Up @@ -1340,9 +1338,10 @@ pub mod read {
}
}

/// A wrapping type for an optional component prop, which can either be a signal or a
/// non-reactive value, and which may or may not have a value. In other words, this is
/// an `Option<MaybeSignal<Option<T>>>` that automatically flattens its getters.
/// A wrapping type for an optional component prop.
///
/// This can either be a signal or a non-reactive value, and may or may not have a value.
/// In other words, this is an `Option<Signal<Option<T>>>`, but automatically flattens its getters.
///
/// This creates an extremely flexible type for component libraries, etc.
///
Expand Down Expand Up @@ -1372,7 +1371,6 @@ pub mod read {
/// assert_eq!(above_3(&memoized_double_count.into()), true);
/// ```
#[derive(Debug, PartialEq, Eq)]
#[allow(deprecated)]
pub struct MaybeProp<T: 'static, S = SyncStorage>(
pub(crate) Option<Signal<Option<T>, S>>,
)
Expand All @@ -1393,7 +1391,6 @@ pub mod read {
{
}

#[allow(deprecated)]
impl<T, S> Default for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
Expand All @@ -1403,7 +1400,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T, S> DefinedAt for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
Expand All @@ -1414,7 +1410,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T, S> Track for MaybeProp<T, S>
where
S: Storage<Option<T>> + Storage<SignalTypes<Option<T>, S>>,
Expand All @@ -1427,7 +1422,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T, S> ReadUntracked for MaybeProp<T, S>
where
T: Clone,
Expand All @@ -1450,7 +1444,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1464,7 +1457,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<T> for MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1475,7 +1467,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Option<T>> for MaybeProp<T>
where
T: Send + Sync,
Expand Down Expand Up @@ -1508,7 +1499,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<ReadSignal<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1518,7 +1508,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<RwSignal<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1528,7 +1517,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Memo<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1538,7 +1526,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Signal<Option<T>>> for MaybeProp<T>
where
T: Send + Sync,
Expand All @@ -1549,7 +1536,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<ReadSignal<T>> for MaybeProp<T>
where
T: Send + Sync + Clone,
Expand All @@ -1559,7 +1545,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<RwSignal<T>> for MaybeProp<T>
where
T: Send + Sync + Clone,
Expand All @@ -1569,7 +1554,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Memo<T>> for MaybeProp<T>
where
T: Send + Sync + Clone,
Expand All @@ -1579,7 +1563,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Signal<T>> for MaybeProp<T>
where
T: Send + Sync + Clone,
Expand All @@ -1589,14 +1572,12 @@ pub mod read {
}
}

#[allow(deprecated)]
impl From<&str> for MaybeProp<String> {
fn from(value: &str) -> Self {
Self(Some(Signal::from(Some(value.to_string()))))
}
}

#[allow(deprecated)]
impl<T> MaybeProp<T, LocalStorage> {
/// Wraps a derived signal, i.e., any computation that accesses one or more
/// reactive signals.
Expand All @@ -1607,14 +1588,12 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> FromLocal<T> for MaybeProp<T, LocalStorage> {
fn from_local(value: T) -> Self {
Self(Some(Signal::stored_local(Some(value))))
}
}

#[allow(deprecated)]
impl<T> FromLocal<Option<T>> for MaybeProp<T, LocalStorage> {
fn from_local(value: Option<T>) -> Self {
Self(Some(Signal::stored_local(value)))
Expand Down Expand Up @@ -1643,7 +1622,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<ReadSignal<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync,
Expand All @@ -1653,7 +1631,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<RwSignal<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync,
Expand All @@ -1663,7 +1640,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Memo<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync,
Expand All @@ -1673,14 +1649,12 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Signal<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage> {
fn from(value: Signal<Option<T>, LocalStorage>) -> Self {
Self(Some(value))
}
}

#[allow(deprecated)]
impl<T> From<ReadSignal<T, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync + Clone,
Expand All @@ -1690,7 +1664,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<RwSignal<T, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync + Clone,
Expand All @@ -1700,7 +1673,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Memo<T, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync + Clone,
Expand All @@ -1710,7 +1682,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl<T> From<Signal<T, LocalStorage>> for MaybeProp<T, LocalStorage>
where
T: Send + Sync + Clone,
Expand All @@ -1720,7 +1691,6 @@ pub mod read {
}
}

#[allow(deprecated)]
impl From<&str> for MaybeProp<String, LocalStorage> {
fn from(value: &str) -> Self {
Self(Some(Signal::stored_local(Some(value.to_string()))))
Expand Down