MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / write_to_buffer

Method write_to_buffer

block/src/vhdx/vhdx_header.rs:152–157  ·  view source on GitHub ↗

Converts the header structure into a buffer

(&self, buffer: &mut [u8; HEADER_SIZE as usize])

Source from the content-addressed store, hash-verified

150
151 /// Converts the header structure into a buffer
152 fn write_to_buffer(&self, buffer: &mut [u8; HEADER_SIZE as usize]) {
153 // SAFETY: self is a valid header.
154 let reference =
155 unsafe { std::slice::from_raw_parts((&raw const *self).cast(), HEADER_SIZE as usize) };
156 *buffer = reference.try_into().unwrap();
157 }
158
159 /// Creates and returns new updated header from the provided current header
160 fn update_header(

Callers 1

update_headerMethod · 0.80

Calls 1

try_intoMethod · 0.80

Tested by

no test coverage detected