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.

IoSource

Random.IoSource
pub const IoSource = struct

File

lib/std/Random.zig:37

Code

pub const IoSource = struct {
    io: std.Io,

    pub fn interface(this: *const @This()) std.Random {
        return .{
            .ptr = @constCast(this),
            .fillFn = fill,
        };
    }

    fn fill(ptr: *anyopaque, buffer: []u8) void {
        const this: *const @This() = @ptrCast(@alignCast(ptr));
        this.io.random(buffer);
    }
}