Help me understand some of `io.zig` in the standard library

In Zig every value has a type, anonymous structs literals just allow you to have that type be inferred based on the type of the result location.

Zig doesn’t have constructors.

No default values, but it creates a struct instance of type AnyWriter with specific values, yes.

AnyWriter is declared as:

pub const AnyWriter = @import("io/Writer.zig");

And this imports the #src/std/io/Writer.zig struct.

related:

4 Likes