Skip to content

Commit

Permalink
Make CODEC -> C.
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Sep 2, 2023
1 parent 6f02bb8 commit 898de87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/yew-agent/src/oneshot/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ where
///
/// This component provides its children access to an oneshot agent.
#[function_component]
pub fn OneshotProvider<T, CODEC = Bincode>(props: &WorkerProviderProps) -> Html
pub fn OneshotProvider<T, C = Bincode>(props: &WorkerProviderProps) -> Html
where
T: Oneshot + 'static,
T::Input: Serialize + for<'de> Deserialize<'de> + 'static,
T::Output: Serialize + for<'de> Deserialize<'de> + 'static,
CODEC: Codec + 'static,
C: Codec + 'static,
{
let WorkerProviderProps {
children,
Expand All @@ -99,10 +99,10 @@ where
reach,
} = props.clone();

// Creates a spawning function so CODEC is can be erased from contexts.
// Creates a spawning function so Codec is can be erased from contexts.
let spawn_bridge_fn: Rc<dyn Fn() -> OneshotBridge<T>> = {
let path = path.clone();
Rc::new(move || OneshotSpawner::<T>::new().encoding::<CODEC>().spawn(&path))
Rc::new(move || OneshotSpawner::<T>::new().encoding::<C>().spawn(&path))
};

let state = {
Expand Down
8 changes: 4 additions & 4 deletions packages/yew-agent/src/reactor/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ where
///
/// This component provides its children access to a reactor agent.
#[function_component]
pub fn ReactorProvider<R, CODEC = Bincode>(props: &WorkerProviderProps) -> Html
pub fn ReactorProvider<R, C = Bincode>(props: &WorkerProviderProps) -> Html
where
R: 'static + Reactor,
<<R as Reactor>::Scope as ReactorScoped>::Input:
Serialize + for<'de> Deserialize<'de> + 'static,
<<R as Reactor>::Scope as ReactorScoped>::Output:
Serialize + for<'de> Deserialize<'de> + 'static,
CODEC: Codec + 'static,
C: Codec + 'static,
{
let WorkerProviderProps {
children,
Expand All @@ -102,10 +102,10 @@ where
reach,
} = props.clone();

// Creates a spawning function so CODEC is can be erased from contexts.
// Creates a spawning function so Codec is can be erased from contexts.
let spawn_bridge_fn: Rc<dyn Fn() -> ReactorBridge<R>> = {
let path = path.clone();
Rc::new(move || ReactorSpawner::<R>::new().encoding::<CODEC>().spawn(&path))
Rc::new(move || ReactorSpawner::<R>::new().encoding::<C>().spawn(&path))
};

let state = {
Expand Down
8 changes: 4 additions & 4 deletions packages/yew-agent/src/worker/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ where
///
/// This component provides its children access to a worker agent.
#[function_component]
pub fn WorkerProvider<W, CODEC = Bincode>(props: &WorkerProviderProps) -> Html
pub fn WorkerProvider<W, C = Bincode>(props: &WorkerProviderProps) -> Html
where
W: Worker + 'static,
W::Input: Serialize + for<'de> Deserialize<'de> + 'static,
W::Output: Serialize + for<'de> Deserialize<'de> + 'static,
CODEC: Codec + 'static,
C: Codec + 'static,
{
let WorkerProviderProps {
children,
Expand All @@ -128,10 +128,10 @@ where
reach,
} = props.clone();

// Creates a spawning function so CODEC is can be erased from contexts.
// Creates a spawning function so Codec is can be erased from contexts.
let spawn_bridge_fn: Rc<dyn Fn() -> WorkerBridge<W>> = {
let path = path.clone();
Rc::new(move || W::spawner().encoding::<CODEC>().spawn(&path))
Rc::new(move || W::spawner().encoding::<C>().spawn(&path))
};

let state = {
Expand Down

0 comments on commit 898de87

Please sign in to comment.