Format Rust code using rustfmt

This commit is contained in:
github-actions[bot] 2024-02-13 04:51:53 +00:00 committed by GitHub
parent a42c636410
commit c7e47cbae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -8,7 +8,10 @@ use zip::write::FileOptions;
// This function is assumed to be synchronous. Adjust as needed.
// Make sure it can be called in parallel without causing issues.
fn build_and_zip_package(entry_path: PathBuf, parent_pkg_path: &str) -> anyhow::Result<(String, Vec<u8>)> {
fn build_and_zip_package(
entry_path: PathBuf,
parent_pkg_path: &str,
) -> anyhow::Result<(String, Vec<u8>)> {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async {
kit::build::execute(&entry_path, false, false, false, true).await?;
@ -53,7 +56,8 @@ fn main() -> anyhow::Result<()> {
.map(|entry| entry.unwrap().path())
.collect();
let results: Vec<anyhow::Result<(String, Vec<u8>)>> = entries.par_iter()
let results: Vec<anyhow::Result<(String, Vec<u8>)>> = entries
.par_iter()
.map(|entry_path| {
let parent_pkg_path = entry_path.join("pkg");
build_and_zip_package(entry_path.clone(), parent_pkg_path.to_str().unwrap())
@ -63,7 +67,10 @@ fn main() -> anyhow::Result<()> {
// Process results, e.g., write to `bootstrapped_processes.rs`
// This part remains sequential
let mut bootstrapped_processes = vec![];
writeln!(bootstrapped_processes, "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[")?;
writeln!(
bootstrapped_processes,
"pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &["
)?;
for result in results {
match result {
@ -77,7 +84,7 @@ fn main() -> anyhow::Result<()> {
" (\"{}\", include_bytes!(\"{}\")),",
zip_filename, zip_path,
)?;
},
}
Err(e) => return Err(e),
}
}

View File

@ -9,9 +9,9 @@ use ring::signature::{self, KeyPair};
use std::collections::{HashMap, VecDeque};
use std::sync::Arc;
use tokio::task::JoinHandle;
use wasmtime::component::ResourceTable as Table;
use wasmtime::component::*;
use wasmtime::{Engine, Store};
use wasmtime::component::ResourceTable as Table;
use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, WasiCtx, WasiCtxBuilder, WasiView};
const STACK_TRACE_SIZE: usize = 5000;