很多常用模块的使用在 std 的文档中并没有给出 demo 和说明,只能靠自己看源码以及附带的测试用例,而且还不一定是最佳实践。 例如 http 模块,Client 和 Server 的使用都和其他语言差异挺大的,让 AI 去给个 demo 也会出现幻觉或者给出旧版无法编译通过的代码。 例如这段代码是我自己摸索出的 http Client 的使用,还不知道是否正确。 ```zig const client: std.http.Client = .{ .allocator = gpa, .io = io }; defer client.deinit(); const body: std.io.Writer.Allocating = .init(gpa); defer body.deinit(); const res = try client.fetch(.{ .location = .{ .url = "https://www.example.com" }, .response_writer = &body.writer }); if (res.status == .ok) { std.debug.print("body: {}", .{ body.buffered() }); } ```
Activity
jinzhongjia commentedon Jul 31, 2026
欢迎 pr,或者我本周末处理
jinzhongjia commentedon Oct 18, 2026
预计下周起会开始编写 std 的使用文档