Uh oh!
There was an error while loading. Please reload this page.
std: make options a struct instance instead of a namespace - #18712
Conversation
e2b58fa to
62e562cCompare`fd_t` is not declared on freestanding so returning a `Dir` causes an error.
Something about the stdlib changes swapped the order?
nektro
commented
Feb 10, 2024
missed this when it first came through but imo the name of |
The async mode has been removed in ziglang/zig#18712
Arnau478
commented
Feb 11, 2024
As @nektro said, As a side proposal, maybe it would be better to create a system for generalized and consistent library options. The |
`std.io.is_async` no longer exists since ziglang/zig#18712. Removed all references for compatibility with latest Zig `master`.
`std.io.is_async` no longer exists since ziglang/zig#18712. Removed all references for compatibility with latest Zig `master`.
kristoff-it
commented
Feb 24, 2024
Release notes draft: Std OptionsPreviously, when one wanted to override defaults, such as the logging function used by pubconststd_options=struct {
pubconstlogFn=myLogFn;
};Note how This is now how the code above would look like now: pubconststd_options: std.Options= .{
.logFn=myLogFn,
};And this is the definition of TODO: explain that you can still override other stuff like the panic function in a different way because that's not a stdlib override pubconstOptions=struct {
enable_segfault_handler: bool=debug.default_enable_segfault_handler,
/// Function used to implement `std.fs.cwd` for WASI.wasiCwd: fn () os.wasi.fd_t=fs.defaultWasiCwd,
/// The current log level.log_level: log.Level=log.default_level,
log_scope_levels: []constlog.ScopeLevel= &.{},
logFn: fn (
comptimemessage_level: log.Level,
comptimescope: @TypeOf(.enum_literal),
comptimeformat: []constu8,
args: anytype,
) void=log.defaultLog,
fmt_max_depth: usize=fmt.default_max_depth,
cryptoRandomSeed: fn (buffer: []u8) void=@import("crypto/tlcsprng.zig").defaultRandomSeed,
crypto_always_getrandom: bool=false,
crypto_fork_safety: bool=true,
/// By default Zig disables SIGPIPE by setting a "no-op" handler for it. Set this option/// to `true` to prevent that.////// Note that we use a "no-op" handler instead of SIG_IGN because it will not be inherited by/// any child process.////// SIGPIPE is triggered when a process attempts to write to a broken pipe. By default, SIGPIPE/// will terminate the process instead of exiting. It doesn't trigger the panic handler so in many/// cases it's unclear why the process was terminated. By capturing SIGPIPE instead, functions that/// write to broken pipes will return the EPIPE error (error.BrokenPipe) and the program can handle/// it like any other error.keep_sigpipe: bool=false,
/// By default, std.http.Client will support HTTPS connections. Set this option to `true` to/// disable TLS support.////// This will likely reduce the size of the binary, but it will also make it impossible to/// make a HTTPS connection.http_disable_tls: bool=false,
side_channels_mitigations: crypto.SideChannelsMitigations=crypto.default_side_channels_mitigations,
}; |
std: make options a struct instance instead of a namespace
As per #18697 (comment)
Closes#14432