Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › compiler/ › Maker/ › WebServer.zig › updateStepStatus
updateStepStatus
WebServer.updateStepStatus
pub fn updateStepStatus (
ws : *WebServer ,
step_index : Configuration .Step .Index ,
new_status : abi .StepUpdate .Status ,
) void
File
Code
pub fn updateStepStatus (
ws : *WebServer ,
step_index : Configuration .Step .Index ,
new_status : abi .StepUpdate .Status ,
) void {
const configured = &ws .configured .?;
const maker = configured .maker ;
const all_steps = maker .step_stack .keys ();
const step_idx : u32 = for (all_steps , 0 ..) |s , i | {
if (s == step_index ) break @intCast (i );
} else unreachable ;
const ptr = &configured .step_status_bits [step_idx / 4 ];
const bit_offset : u3 = @intCast ((step_idx % 4 ) * 2 );
const old_bits : u2 = @truncate (@atomicLoad (u8 , ptr , .monotonic ) >> bit_offset );
const mask = @as (u8 , @backingInt (new_status ) ^ old_bits ) << bit_offset ;
_ = @atomicRmw (u8 , ptr , .Xor , mask , .monotonic );
ws .notifyUpdate ();
}