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 › posix › reboot Public Function reboot Doc Source 316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346 pub fn reboot (cmd : RebootCommand ) RebootError !void {
switch (native_os ) {
.linux => {
switch (linux .errno (linux .reboot (
.MAGIC1 ,
.MAGIC2 ,
cmd ,
switch (cmd ) {
.RESTART2 => |s | s ,
else => null ,
},
))) {
.SUCCESS => {},
.PERM => return error .PermissionDenied ,
else => |err | return std .posix .unexpectedErrno (err ),
}
switch (cmd ) {
.CAD_OFF => {},
.CAD_ON => {},
.SW_SUSPEND => {},
.HALT => unreachable ,
.KEXEC => unreachable ,
.POWER_OFF => unreachable ,
.RESTART => unreachable ,
.RESTART2 => unreachable ,
}
},
else => @compileError ("Unsupported OS" ),
}
}