Skip to content

Commit 692d39f

Browse files
committed
Serialize boot config to Vec directly
1 parent 075f22d commit 692d39f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ impl DiskImageBuilder {
7575

7676
/// Configures the runtime behavior of the bootloader.
7777
pub fn set_boot_config(&mut self, boot_config: &BootConfig) -> &mut Self {
78-
let json =
79-
serde_json::to_string_pretty(boot_config).expect("failed to serialize BootConfig");
80-
let bytes = json.as_bytes();
81-
self.set_file_source(CONFIG_FILE_NAME, FileDataSource::Data(bytes.to_vec()))
78+
let json = serde_json::to_vec_pretty(boot_config).expect("failed to serialize BootConfig");
79+
self.set_file_source(CONFIG_FILE_NAME.into(), FileDataSource::Data(json))
8280
}
8381

8482
/// Add a file with the specified bytes to the disk image

0 commit comments

Comments
 (0)