structstd.zon.stringify.SerializeContainerOptions[src]

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.

Source Code

Source code
pub const SerializeContainerOptions = 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: SerializeContainerOptions) bool {
        return switch (self.whitespace_style) {
            .wrap => |wrap| wrap,
            .fields => |fields| fields > 2,
        };
    }
}