From 3243df204ed02f0423884193885e5ad5621ba301 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 18 Sep 2026 17:47:30 -0700 Subject: [PATCH] HashWriter: add from init --- hash_writer.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hash_writer.zig b/hash_writer.zig index eb38ee9b7a09fd4b30428b0bc43da787991ddc77..a7865808487e6186a462d80a843821fd462a83df 100644 --- a/hash_writer.zig +++ b/hash_writer.zig @@ -3,6 +3,7 @@ const std = @import("std"); const nio = @import("./nio.zig"); const builtin = @import("builtin"); +const extras = @import("extras"); const sys = switch (builtin.target.os.tag) { .linux => @import("sys-linux"), @@ -23,6 +24,10 @@ pub fn HashWriter(comptime Hash: type) type { }; } + pub fn from(hasher: anytype) HashWriter(extras.Pointee(@TypeOf(hasher))) { + return .init(hasher); + } + const W = nio.Writable(@This(), ._const); pub const writeAll = W.writeAll; pub const writevAll = W.writevAll; -- 2.54.0