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

ContainerOptions

Public Struct
std.zon.Serializer.ContainerOptions
pub const ContainerOptions = struct

Options for manual serialization of container types.

Fields

whitespace_style: union(enum) { /// If true, wrap every field. If false do not. wrap: bool, /// Automatically decide whether to wrap or not based on the number of fields. Following /// the standard rule of thumb, containers with more than two fields are wrapped. fields: usize, } = .{ .wrap = true }

The whitespace style that should be used for this container. Ignored if whitespace is off.

Functions

File

zon/Serializer.zig:42
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pub const ContainerOptions = struct {
    /// The whitespace style that should be used for this container. Ignored if whitespace is off.
    whitespace_style: union(enum) {
        /// If true, wrap every field. If false do not.
        wrap: bool,
        /// Automatically decide whether to wrap or not based on the number of fields. Following
        /// the standard rule of thumb, containers with more than two fields are wrapped.
        fields: usize,
    } = .{ .wrap = true },

    fn shouldWrap(self: ContainerOptions) bool {
        return switch (self.whitespace_style) {
            .wrap => |wrap| wrap,
            .fields => |fields| fields > 2,
        };
    }
}