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 standard library.
std › Io › Uring › Fiber › CancelProtection Private Struct CancelProtection Doc Source Private Struct std.Io.Uring.Fiber.CancelProtection
const CancelProtection = packed struct Fields user : Io .CancelProtection acknowledged : bool Values Functions File Io/Uring.zig: 213
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248 const CancelProtection = packed struct {
user : Io .CancelProtection ,
acknowledged : bool ,
const unblocked : CancelProtection = .{ .user = .unblocked , .acknowledged = false };
fn check (cancel_protection : CancelProtection ) Io .CancelProtection {
return @fromBackingInt (@intCast (@intFromBool (cancel_protection != unblocked )));
}
fn acknowledge (cancel_protection : *CancelProtection ) void {
assert (!cancel_protection .acknowledged );
cancel_protection .acknowledged = true ;
}
fn recancel (cancel_protection : *CancelProtection ) void {
assert (cancel_protection .acknowledged );
cancel_protection .acknowledged = false ;
}
test check {
try std .testing .expectEqual (Io .CancelProtection .unblocked , check (.unblocked ));
try std .testing .expectEqual (Io .CancelProtection .blocked , check (.{
.user = .unblocked ,
.acknowledged = true ,
}));
try std .testing .expectEqual (Io .CancelProtection .blocked , check (.{
.user = .blocked ,
.acknowledged = false ,
}));
try std .testing .expectEqual (Io .CancelProtection .blocked , check (.{
.user = .blocked ,
.acknowledged = true ,
}));
}
}