authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-09-18 17:47:30-07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-09-18 17:47:30-07:00
log3243df204ed02f0423884193885e5ad5621ba301
treea5094938ca9bafbe733063b65700b935cf058d69
parent786d9e1b55cc75d6e11ad5077e96efc425316512
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

HashWriter: add from init


1 files changed, 5 insertions(+), 0 deletions(-)

hash_writer.zig+5
...@@ -3,6 +3,7 @@...@@ -3,6 +3,7 @@
3const std = @import("std");3const std = @import("std");
4const nio = @import("./nio.zig");4const nio = @import("./nio.zig");
5const builtin = @import("builtin");5const builtin = @import("builtin");
6const extras = @import("extras");
67
7const sys = switch (builtin.target.os.tag) {8const sys = switch (builtin.target.os.tag) {
8 .linux => @import("sys-linux"),9 .linux => @import("sys-linux"),
...@@ -23,6 +24,10 @@ pub fn HashWriter(comptime Hash: type) type {...@@ -23,6 +24,10 @@ pub fn HashWriter(comptime Hash: type) type {
23 };24 };
24 }25 }
2526
27 pub fn from(hasher: anytype) HashWriter(extras.Pointee(@TypeOf(hasher))) {
28 return .init(hasher);
29 }
30
26 const W = nio.Writable(@This(), ._const);31 const W = nio.Writable(@This(), ._const);
27 pub const writeAll = W.writeAll;32 pub const writeAll = W.writeAll;
28 pub const writevAll = W.writevAll;33 pub const writevAll = W.writevAll;