MCPcopy Create free account
hub / github.com/aws/clock-bound / write_vmclock_content

Function write_vmclock_content

clock-bound/src/client.rs:390–402  ·  view source on GitHub ↗
(file: &mut File, vmclock_content: &VMClockContent)

Source from the content-addressed store, hash-verified

388 }
389
390 fn write_vmclock_content(file: &mut File, vmclock_content: &VMClockContent) {
391 // Convert the VMClockShmBody struct into a slice so we can write it all out, fairly magic.
392 // Definitely needs the #[repr(C)] layout.
393 let slice = unsafe {
394 ::core::slice::from_raw_parts(
395 (vmclock_content as *const VMClockContent) as *const u8,
396 ::core::mem::size_of::<VMClockContent>(),
397 )
398 };
399
400 file.write_all(slice).expect("Write failed VMClockContent");
401 file.sync_all().expect("Sync to disk failed");
402 }
403
404 /// Helper function to remove files created during unit tests.
405 fn remove_file_or_directory(path: &str) {

Calls

no outgoing calls