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 Enum

OptimizeMode

Public Enum
std.lang.OptimizeMode
pub const Optimize = enum

This data structure is used by the Zig language code generation and therefore must be kept in sync with the compiler implementation.

Values

  • pub const Debug

    Deprecated, to be removed after 0.18.0

  • pub const ReleaseSafe

    Deprecated, to be removed after 0.18.0

  • pub const ReleaseFast

    Deprecated, to be removed after 0.18.0

  • pub const ReleaseSmall

    Deprecated, to be removed after 0.18.0

Functions

pub fn fromString(s: []const u8) ?@This()

Deprecated, to be removed after 0.18.0

pub fn runtimeSafety(o: @This()) bool

Returns whether illegal behavior safety checks are enabled based on the provided optimization mode.

File

lang.zig:115
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
pub const Optimize = enum {
    /// Safety checks enabled. Optimize for bug detection, accurate debug info,
    /// and compilation speed (in that order).
    debug,
    /// Safety checks enabled. Optimize for runtime performance.
    safe,
    /// Safety checks disabled. Optimize for runtime performance.
    fast,
    /// Safety checks disabled. Optimize for machine code size, then runtime performance.
    small,

    /// Deprecated, to be removed after 0.18.0
    pub const Debug: @This() = .debug;
    /// Deprecated, to be removed after 0.18.0
    pub const ReleaseSafe: @This() = .safe;
    /// Deprecated, to be removed after 0.18.0
    pub const ReleaseFast: @This() = .fast;
    /// Deprecated, to be removed after 0.18.0
    pub const ReleaseSmall: @This() = .small;
    /// Deprecated, to be removed after 0.18.0
    pub fn fromString(s: []const u8) ?@This() {
        return std.StaticStringMap(@This()).initComptime(&.{
            .{ "Debug", .debug },
            .{ "ReleaseSafe", .safe },
            .{ "ReleaseFast", .fast },
            .{ "ReleaseSmall", .small },
            .{ "debug", .debug },
            .{ "safe", .safe },
            .{ "fast", .fast },
            .{ "small", .small },
        }).get(s);
    }

    /// Returns whether illegal behavior safety checks are enabled based on the
    /// provided optimization mode.
    pub fn runtimeSafety(o: @This()) bool {
        return switch (o) {
            .debug, .safe => true,
            .fast, .small => false,
        };
    }
}