Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › compress › lzma2 › AccumBuffer › appendLz Public Function appendLz Doc Source Public Function std.compress.lzma2.AccumBuffer.appendLz
pub fn appendLz (
self : *AccumBuffer ,
allocator : Allocator ,
len : usize ,
dist : usize ,
writer : *Writer ,
) !void Params File compress/lzma2.zig: 72
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 pub fn appendLz (
self : *AccumBuffer ,
allocator : Allocator ,
len : usize ,
dist : usize ,
writer : *Writer ,
) !void {
_ = writer ;
const buf_len = self .buf .items .len ;
if (dist > buf_len ) return error .CorruptInput ;
try self .buf .ensureUnusedCapacity (allocator , len );
const buffer = self .buf .allocatedSlice ();
const src = buffer [buf_len - dist ..][0 ..len ];
const dst = buffer [buf_len ..][0 ..len ];
// This is not a @memmove; it intentionally repeats patterns caused by
// iterating one byte at a time.
for (dst , src ) |*d , s | d .* = s ;
self .buf .items .len = buf_len + len ;
self .len += len ;
}
Fetch an LZ sequence (length, distance) from inside the buffer