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 › lzma › Decode › Vec2d Public Struct Vec2d Doc Source Public Struct std.compress.lzma.Decode.Vec2d
pub const Vec2d = struct Fields Functions File compress/lzma.zig: 503
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531 pub const Vec2d = struct {
data : []u16 ,
cols : usize ,
pub fn init (gpa : Allocator , value : u16 , w : usize , h : usize ) !Vec2d {
const len = try math .mul (usize , w , h );
const data = try gpa .alloc (u16 , len );
@memset (data , value );
return .{
.data = data ,
.cols = h ,
};
}
pub fn deinit (v : *Vec2d , gpa : Allocator ) void {
gpa .free (v .data );
v .* = undefined ;
}
pub fn fill (v : *Vec2d , value : u16 ) void {
@memset (v .data , value );
}
fn get (v : Vec2d , row : usize ) ![]u16 {
const start_row = try math .mul (usize , row , v .cols );
const end_row = try math .add (usize , start_row , v .cols );
return v .data [start_row ..end_row ];
}
}