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. Private Enum

AwaitableId

Private Enum
std.Io.Threaded.AwaitableId
const AwaitableId = enum(@Int(.unsigned, @bitSizeOf(usize) - 3))

A sequence of (ptr_bit_width - 3) bits which uniquely identifies a group or future. The bits are the MSBs of the *Io.Group or *Future. These things do not necessarily have 3 zero bits at the end (they are pointer-aligned, so on 32-bit targets only have 2), but because they both have a size of at least 8 bytes, no two groups/futures in memory at the same time will have the same value for all of these bits. In other words, given a group/future pointer, the next group or future must be at least 8 bytes later, so its address will have a different value for one of the top (ptr_bit_width - 3) bits.

Structs

Functions

File

Io/Threaded.zig:801
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
const AwaitableId = enum(@Int(.unsigned, @bitSizeOf(usize) - 3)) {
    comptime {
        assert(@sizeOf(Future) >= 8);
        assert(@sizeOf(Io.Group) >= 8);
    }
    null = 0,
    all_ones = std.math.maxInt(@Int(.unsigned, @bitSizeOf(usize) - 3)),
    _,
    const Split = packed struct(usize) { low: u3, high: AwaitableId };
    fn fromGroup(g: *Io.Group) AwaitableId {
        const split: Split = @bitCast(@intFromPtr(g));
        return split.high;
    }
    fn fromFuture(f: *Future) AwaitableId {
        const split: Split = @bitCast(@intFromPtr(f));
        return split.high;
    }
}