diff --git a/ostool-server/src/api/router.rs b/ostool-server/src/api/router.rs index 32109db..bc18a84 100644 --- a/ostool-server/src/api/router.rs +++ b/ostool-server/src/api/router.rs @@ -303,7 +303,7 @@ async fn create_dtb( request: Request, ) -> Result<(StatusCode, axum::Json), ApiError> { let headers = request.headers(); - let dtb_name = dtb_name_header(&headers, "X-Dtb-Name")?; + let dtb_name = dtb_name_header(headers, "X-Dtb-Name")?; let body = read_limited_body(request, DTB_UPLOAD_MAX_MIB, "DTB").await?; if body.is_empty() { return Err(ApiError::bad_request("DTB upload body must not be empty")); diff --git a/ostool/src/build/mod.rs b/ostool/src/build/mod.rs index f4aef37..8224878 100644 --- a/ostool/src/build/mod.rs +++ b/ostool/src/build/mod.rs @@ -68,9 +68,19 @@ pub struct CargoUbootRunnerArgs { /// either through QEMU emulation or via U-Boot on real hardware. pub enum CargoRunnerKind { /// Run the built artifact in QEMU emulator. - Qemu(CargoQemuRunnerArgs), + Qemu(Box), /// Run the built artifact on real hardware via U-Boot. - Uboot(CargoUbootRunnerArgs), + Uboot(Box), +} + +impl CargoRunnerKind { + pub fn new_qemu(args: CargoQemuRunnerArgs) -> Self { + Self::Qemu(Box::new(args)) + } + + pub fn new_uboot(args: CargoUbootRunnerArgs) -> Self { + Self::Uboot(Box::new(args)) + } } impl Tool { diff --git a/ostool/src/main.rs b/ostool/src/main.rs index 48108be..9504e29 100644 --- a/ostool/src/main.rs +++ b/ostool/src/main.rs @@ -218,13 +218,13 @@ async fn try_main() -> Result<()> { ), None => None, }; - let kind = CargoRunnerKind::Qemu(CargoQemuRunnerArgs { + let kind = CargoRunnerKind::new_qemu(CargoQemuRunnerArgs { qemu: qemu_config, debug, dtb_dump, show_output: true, }); - tool.cargo_run(&config, &kind).await?; + tool.cargo_run(config, &kind).await?; } build::config::BuildSystem::Custom(custom_cfg) => { tool.build_with_config(&build_config).await?; @@ -262,11 +262,11 @@ async fn try_main() -> Result<()> { ), None => None, }; - let kind = CargoRunnerKind::Uboot(CargoUbootRunnerArgs { + let kind = CargoRunnerKind::new_uboot(CargoUbootRunnerArgs { uboot: uboot_config, show_output: true, }); - tool.cargo_run(&config, &kind).await?; + tool.cargo_run(config, &kind).await?; } build::config::BuildSystem::Custom(custom_cfg) => { tool.build_with_config(&build_config).await?; diff --git a/ostool/tests/ui/pass_tool_configs.rs b/ostool/tests/ui/pass_tool_configs.rs index f6973c5..fbe98c0 100644 --- a/ostool/tests/ui/pass_tool_configs.rs +++ b/ostool/tests/ui/pass_tool_configs.rs @@ -18,13 +18,13 @@ fn main() { let _ = RunQemuOptions::default(); let _ = RunUbootOptions::default(); let _ = board::RunBoardOptions::default(); - let _ = build::CargoRunnerKind::Qemu(build::CargoQemuRunnerArgs { + let _ = build::CargoRunnerKind::new_qemu(build::CargoQemuRunnerArgs { qemu: Some(qemu), debug: false, dtb_dump: false, show_output: true, }); - let _ = build::CargoRunnerKind::Uboot(build::CargoUbootRunnerArgs { + let _ = build::CargoRunnerKind::new_uboot(build::CargoUbootRunnerArgs { uboot: Some(uboot), show_output: true, });