vfs::file::vmo

Function read_only

Source
pub fn read_only(content: impl AsRef<[u8]>) -> Arc<VmoFile>
Expand description

Creates a new read-only VmoFile with the specified content.

§Panics

This function panics if a VMO could not be created, or if content could not be written to the VMO.

§Examples

// Using static data:
let from_str = read_only("str");
let from_bytes = read_only(b"bytes");
// Using owned data:
let from_string = read_only(String::from("owned"));
let from_vec = read_only(vec![0u8; 2]);