Skip to content

Commit 1e3def5

Browse files
committed
Add AppState: Sync constraint to factors
Signed-off-by: Lann Martin <[email protected]>
1 parent 2cd5826 commit 1e3def5

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

crates/factors-executor/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutor<T, U> {
3434
}
3535
}
3636

37-
impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutor<T, U>
38-
where
39-
T::AppState: Sync,
40-
{
37+
impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutor<T, U> {
4138
/// Adds the given [`ExecutorHooks`] to this executor.
4239
///
4340
/// Hooks are run in the order they are added.
@@ -84,7 +81,6 @@ where
8481
pub trait ExecutorHooks<T, U>: Send + Sync
8582
where
8683
T: RuntimeFactors,
87-
T::AppState: Sync,
8884
{
8985
/// Configure app hooks run immediately after [`RuntimeFactors::configure_app`].
9086
async fn configure_app(&mut self, configured_app: &ConfiguredApp<T>) -> anyhow::Result<()> {
@@ -143,10 +139,7 @@ impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutorApp<T, U> {
143139
}
144140
}
145141

146-
impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutorApp<T, U>
147-
where
148-
T::AppState: Sync,
149-
{
142+
impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutorApp<T, U> {
150143
/// Returns an instance builder for the given component ID.
151144
pub fn prepare(&self, component_id: &str) -> anyhow::Result<FactorsInstanceBuilder<T, U>> {
152145
let app_component = self

crates/factors/src/factor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait Factor: Any + Sized {
1717
/// The application state of this factor.
1818
///
1919
/// This state *may* be cached by the runtime across multiple requests.
20-
type AppState;
20+
type AppState: Sync;
2121

2222
/// The builder of instance state for this factor.
2323
type InstanceBuilder: FactorInstanceBuilder;

crates/factors/src/runtime_factors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::{factor::FactorInstanceState, App, ConfiguredApp, Factor};
3232
/// ```
3333
pub trait RuntimeFactors: Sized + 'static {
3434
/// The per application state of all the factors.
35-
type AppState;
35+
type AppState: Sync;
3636
/// The per instance state of the factors.
3737
type InstanceState: RuntimeFactorsInstanceState;
3838
/// The collection of all the `InstanceBuilder`s of the factors.

crates/trigger/src/cli/sqlite_statements.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl SqlStatementExecutorHook {
6969
impl<F, U> ExecutorHooks<F, U> for SqlStatementExecutorHook
7070
where
7171
F: RuntimeFactors,
72-
F::AppState: Sync,
7372
{
7473
async fn configure_app(
7574
&mut self,

0 commit comments

Comments
 (0)