From 67c14e2dd0090fd3e2d4ee5542dc49d9458b7221 Mon Sep 17 00:00:00 2001 From: Luke Chu <37006668+lukechu10@users.noreply.github.com> Date: Tue, 8 Feb 2022 14:56:02 -0800 Subject: [PATCH] Remove ContextProvider --- packages/sycamore/src/context.rs | 32 -------------------------------- packages/sycamore/src/lib.rs | 1 - 2 files changed, 33 deletions(-) delete mode 100644 packages/sycamore/src/context.rs diff --git a/packages/sycamore/src/context.rs b/packages/sycamore/src/context.rs deleted file mode 100644 index cd9c52373..000000000 --- a/packages/sycamore/src/context.rs +++ /dev/null @@ -1,32 +0,0 @@ -//! Utility components for providing contexts. - -use crate::prelude::*; - -/// Props for [`ContextProvider`]. -#[derive(Prop)] -pub struct ContextProviderProps<'a, T, G: GenericNode> { - value: T, - children: Children<'a, G>, -} - -/// Provides a context. Unlike [`provide_context`](Scope::provide_context), using the component -/// instead will create a new child scope, preventing conflicts with existing contexts of the same -/// type. -#[component] -pub fn ContextProvider<'a, T: 'static, G: GenericNode>( - ctx: ScopeRef<'a>, - props: ContextProviderProps<'a, T, G>, -) -> View { - let mut view = None; - ctx.create_child_scope(|ctx| { - ctx.provide_context(props.value); - // SAFETY: `props.children` takes the same parameter as argument passed to - // ctx.create_child_scope - view = Some( - props - .children - .call_with_bounded_scope(unsafe { std::mem::transmute(ctx) }), - ); - }); - view.unwrap() -} diff --git a/packages/sycamore/src/lib.rs b/packages/sycamore/src/lib.rs index 4c37a874d..733021f48 100644 --- a/packages/sycamore/src/lib.rs +++ b/packages/sycamore/src/lib.rs @@ -36,7 +36,6 @@ extern crate self as sycamore; #[cfg(feature = "experimental-builder-agnostic")] pub mod builder; pub mod component; -pub mod context; pub mod easing; pub mod flow; #[cfg(feature = "suspense")]