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

DefaultingBool

Public Enum
std.Build.Configuration.DefaultingBool
pub const DefaultingBool = enum(u2)

Functions

pub fn init(b: ?bool) DefaultingBool
pub fn toBool(db: DefaultingBool) ?bool

File

Build/Configuration.zig:1990
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
pub const DefaultingBool = enum(u2) {
    false,
    true,
    default,

    pub fn init(b: ?bool) DefaultingBool {
        return switch (b orelse return .default) {
            false => .false,
            true => .true,
        };
    }

    pub fn toBool(db: DefaultingBool) ?bool {
        return switch (db) {
            .false => false,
            .true => true,
            .default => null,
        };
    }
}