pub fn write_once_custom<F: FnOnce(&mut[u8])>(size: u64, name: &str, memfd_options: memfd::MemfdOptions, seals: &mfd::SealsHashSet, f: F) -> Result<mfd::Memfd, Error> {
    let memfd = memfd_options.create(name)?;
    // Sets the memory to zeroes.
    memfd.as_file().set_len(size)?;
    // We're the sole owner of the file descriptor, it's safe to create a mutable reference to the data.
    let mut m = unsafe { mmap::MmapMut::map_mut(memfd.as_file())? };
    f(&mut m);
    drop(m);
    if !seals.is_empty() {
        memfd.add_seals(&seals)?;
    }
    Ok(memfd)
}
/// Like "write_once", but allows for customisation of the memfd_options and seals added after writing.
Like "write_once", but allows for customisation of the memfd_options and seals added after writing.
Like " write_once " but allows for customisation of the memfd_options and seals added after writing .
pub fn write_once_custom<F: FnOnce(&mut[u8])>(size: u64, name: &str, memfd_options: memfd::MemfdOptions, seals: &mfd::SealsHashSet, f: F) -> Result<mfd::Memfd, Error> {
    let memfd = memfd_options.create(name)?;
    // Sets the memory to zeroes.
    memfd.as_file().set_len(size)?;
    // We're the sole owner of the file descriptor, it's safe to create a mutable reference to the data.
    let mut m = unsafe { mmap::MmapMut::map_mut(memfd.as_file())? };
    f(&mut m);
    drop(m);
    if !seals.is_empty() {
        memfd.add_seals(&seals)?;
    }
    Ok(memfd)
}
pub fn write_once_custom < F : FnOnce ( & mut [ u8 ] ) > ( size : u64 , name : & str , memfd_options : memfd :: MemfdOptions , seals : & mfd :: SealsHashSet , f : F ) -> Result < mfd :: Memfd , Error > { let memfd = memfd_options . create ( name ) ? ; // Sets the memory to zeroes. memfd . as_file ( ) . set_len ( size ) ? ; // We're the sole owner of the file descriptor, it's safe to create a mutable reference to the data. let mut m = unsafe { mmap :: MmapMut :: map_mut ( memfd . as_file ( ) ) ? } ; f ( & mut m ) ; drop ( m ) ; if ! seals . is_empty ( ) { memfd . add_seals ( & seals ) ? ; } Ok ( memfd ) }
Like "write_once", but allows for customisation of the memfd_options and seals added after writing.
Like " write_once " but allows for customisation of the memfd_options and seals added after writing .
size
u64
name
&str
memfd_options
memfd::MemfdOptions
seals
&mfd::SealsHashSet
f
F
size
u64
name
&str
memfd_options
memfd::MemfdOptions
seals
&mfd::SealsHashSet
f
F