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 › zstd › Decompress › Frame › init Public Function init Doc Source Public Function std.compress.zstd.Decompress.Frame.init
pub fn init (
frame_header : Frame .Zstandard .Header ,
window_size_max : usize ,
verify_checksum : bool ,
) InitError !Frame Params File compress/zstd/Decompress.zig: 926
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955 pub fn init (
frame_header : Frame .Zstandard .Header ,
window_size_max : usize ,
verify_checksum : bool ,
) InitError !Frame {
if (frame_header .descriptor .dictionary_id_flag != 0 )
return error .DictionaryIdFlagUnsupported ;
const window_size_raw = frame_header .windowSize () orelse return error .WindowSizeUnknown ;
const window_size = if (window_size_raw > window_size_max )
return error .WindowOversize
else
std .math .cast (usize , window_size_raw ) orelse return error .WindowOversize ;
const should_compute_checksum =
frame_header .descriptor .content_checksum_flag and verify_checksum ;
const content_size = if (frame_header .content_size ) |size |
std .math .cast (usize , size ) orelse return error .ContentOversize
else
null ;
return .{
.hasher_opt = if (should_compute_checksum ) std .hash .XxHash64 .init (0 ) else null ,
.window_size = window_size ,
.has_checksum = frame_header .descriptor .content_checksum_flag ,
.block_size_max = @min (zstd .block_size_max , window_size ),
.content_size = content_size ,
};
}
Validates
frame_headerand returns the associatedFrame.