pub const Optimize = enum Deprecated, to be removed after 0.18.0
Deprecated, to be removed after 0.18.0
Deprecated, to be removed after 0.18.0
Deprecated, to be removed after 0.18.0
pub fn fromString(s: []const u8) ?@This()Deprecated, to be removed after 0.18.0
pub fn runtimeSafety(o: @This()) boolReturns whether illegal behavior safety checks are enabled based on the provided optimization mode.
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
156pub 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,
};
}
}
This data structure is used by the Zig language code generation and therefore must be kept in sync with the compiler implementation.