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

Alignment

Public Enum
std.Build.Configuration.Alignment
pub const Alignment = enum(u6)

Stored as a power-of-two, with one special value to indicate none.

Functions

pub fn init(optional_alignment: ?std.mem.Alignment) @This()
pub fn toBytes(a: @This()) ?u64

File

Build/Configuration.zig:1966
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
pub const Alignment = enum(u6) {
    @"1" = 0,
    @"2" = 1,
    @"4" = 2,
    @"8" = 3,
    @"16" = 4,
    @"32" = 5,
    @"64" = 6,
    none = std.math.maxInt(u6),
    _,

    pub fn init(optional_alignment: ?std.mem.Alignment) @This() {
        const a = optional_alignment orelse return .none;
        return @fromBackingInt(@intCast(@backingInt(a)));
    }

    pub fn toBytes(a: @This()) ?u64 {
        return switch (a) {
            .none => null,
            else => @as(u64, 1) << @backingInt(a),
        };
    }
}