Skip to content

Commit 76ccf41

Browse files
committed
Formatting
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
1 parent 3bca23e commit 76ccf41

File tree

9 files changed

+390
-113
lines changed

9 files changed

+390
-113
lines changed

crates/compose/src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ use wac_graph::{CompositionGraph, NodeId};
2727
/// dependent component. Finally, the composer will export all exports from the
2828
/// dependent component to its dependents. The composer will then encode the
2929
/// composition graph into a byte array and return it.
30-
pub async fn compose<L: ComponentSourceLoader, Fut: std::future::Future<Output = Result<Vec<u8>, ComposeError>>>(
30+
pub async fn compose<
31+
L: ComponentSourceLoader,
32+
Fut: std::future::Future<Output = Result<Vec<u8>, ComposeError>>,
33+
>(
3134
loader: &L,
3235
component: &L::Component,
3336
complicator: impl Fn(Vec<u8>) -> Fut,
@@ -204,18 +207,20 @@ struct Composer<'a, L> {
204207
}
205208

206209
impl<'a, L: ComponentSourceLoader> Composer<'a, L> {
207-
async fn compose<Fut: std::future::Future<Output = Result<Vec<u8>, ComposeError>>>(mut self, component: &L::Component, complicator: impl Fn(Vec<u8>) -> Fut,
208-
) -> Result<Vec<u8>, ComposeError> {
210+
async fn compose<Fut: std::future::Future<Output = Result<Vec<u8>, ComposeError>>>(
211+
mut self,
212+
component: &L::Component,
213+
complicator: impl Fn(Vec<u8>) -> Fut,
214+
) -> Result<Vec<u8>, ComposeError> {
209215
let source = self
210216
.loader
211217
.load_component_source(component)
212218
.await
213219
.map_err(ComposeError::PrepareError)?;
214220

215-
let fulfilled_source = if component.dependencies().len() == 0 {
221+
let fulfilled_source = if component.dependencies().len() == 0 {
216222
source
217223
} else {
218-
219224
let (world_id, instantiation_id) = self
220225
.register_package(component.id(), None, source)
221226
.map_err(ComposeError::PrepareError)?;

crates/factors-executor/src/lib.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,35 @@ pub trait ComponentLoader<T: RuntimeFactors, U>: Sync {
127127
component: &AppComponent,
128128
complicator: &impl Complicator,
129129
) -> anyhow::Result<spin_core::InstancePre<InstanceState<T::InstanceState, U>>> {
130-
let component = self.load_component(engine.as_ref(), component, complicator).await?;
130+
let component = self
131+
.load_component(engine.as_ref(), component, complicator)
132+
.await?;
131133
engine.instantiate_pre(&component)
132134
}
133135
}
134136

135137
#[async_trait]
136138
pub trait Complicator: Send + Sync {
137-
async fn complicate(&self, complications: &HashMap<String, Vec<Complication>>, component: Vec<u8>) -> anyhow::Result<Vec<u8>>;
139+
async fn complicate(
140+
&self,
141+
complications: &HashMap<String, Vec<Complication>>,
142+
component: Vec<u8>,
143+
) -> anyhow::Result<Vec<u8>>;
138144
}
139145

140146
#[async_trait]
141147
impl Complicator for () {
142-
async fn complicate(&self, complications: &HashMap<String, Vec<Complication>>, component: Vec<u8>) -> anyhow::Result<Vec<u8>> {
148+
async fn complicate(
149+
&self,
150+
complications: &HashMap<String, Vec<Complication>>,
151+
component: Vec<u8>,
152+
) -> anyhow::Result<Vec<u8>> {
143153
if complications.is_empty() {
144154
Ok(component)
145155
} else {
146-
Err(anyhow::anyhow!("this trigger should not have complications"))
156+
Err(anyhow::anyhow!(
157+
"this trigger should not have complications"
158+
))
147159
}
148160
}
149161
}

0 commit comments

Comments
 (0)