Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Struct

CreateOptions

Public Struct
std.Io.File.MemoryMap.CreateOptions
pub const CreateOptions = struct

Fields

len: usize

Size of the mapping, in bytes. If this is longer than the file size, memory beyond the file end will be filled with zeroes and it is unspecified whether, after calling write, the file length will be set to len or remain unchanged.

This value has no minimum alignment requirement, but may gain efficiency benefits from being a multiple of File.Stat.block_size.

protection: std.process.MemoryProtection = .{ .read = true, .write = true }

When this has read set to false, bytes that are not modified before a sync may have the original file contents, or may be set to zero.

undefined_contents: bool = false

If set to true, allows bytes observed before calling read to be undefined, and bytes unwritten before calling write to write undefined memory to the file.

populate: bool = true

Prefault the pages. If this option is unsupported, it is silently ignored. Aside from custom Io implementations, this option is only supported on Linux.

offset: u64 = 0

Asserted to be a multiple of page size which can be obtained via std.heap.pageSize.

File

Io/File/MemoryMap.zig:39
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
pub const CreateOptions = struct {
    /// Size of the mapping, in bytes. If this is longer than the file size,
    /// `memory` beyond the file end will be filled with zeroes and it is
    /// unspecified whether, after calling `write`, the file length will be
    /// set to `len` or remain unchanged.
    ///
    /// This value has no minimum alignment requirement, but may gain
    /// efficiency benefits from being a multiple of `File.Stat.block_size`.
    len: usize,
    /// When this has read set to false, bytes that are not modified before a
    /// sync may have the original file contents, or may be set to zero.
    protection: std.process.MemoryProtection = .{ .read = true, .write = true },
    /// If set to `true`, allows bytes observed before calling `read` to be
    /// undefined, and bytes unwritten before calling `write` to write
    /// undefined memory to the file.
    undefined_contents: bool = false,
    /// Prefault the pages. If this option is unsupported, it is silently
    /// ignored. Aside from custom Io implementations, this option is only
    /// supported on Linux.
    populate: bool = true,
    /// Asserted to be a multiple of page size which can be obtained via
    /// `std.heap.pageSize`.
    offset: u64 = 0,
}