#how to set the type of a fn arg that is any Reader?
1 messages · Page 1 of 1 (latest)
Because std.mem.Allocator is a struct but std.io.Reader is a function.
Unfortunately zig doesn't support this kind of generic trait parameters.
Different ways of doing interfaces: generics with duck typing, or a struct with a type erased pointer. It seems that the newer io.AnyReader is done in the type erased style of Allocator, but most sutff in the standard library is written around the generic style.