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 library itself.
Zig › std/ › Io/ › Reader.zig › allocRemainingAlignedSentinel
allocRemainingAlignedSentinel
Reader.allocRemainingAlignedSentinel
pub fn allocRemainingAlignedSentinel (
r : *Reader ,
gpa : Allocator ,
limit : Limit ,
comptime alignment : std .mem .Alignment ,
comptime sentinel : ?u8 ,
) LimitedAllocError !(if (sentinel ) |s | [:s ]align (alignment .toByteUnits ()) u8 else []align (alignment .toByteUnits ()) u8 )
File
Code
pub fn allocRemainingAlignedSentinel (
r : *Reader ,
gpa : Allocator ,
limit : Limit ,
comptime alignment : std .mem .Alignment ,
comptime sentinel : ?u8 ,
) LimitedAllocError !(if (sentinel ) |s | [:s ]align (alignment .toByteUnits ()) u8 else []align (alignment .toByteUnits ()) u8 ) {
var buffer : std .array_list .Aligned (u8 , alignment ) = .empty ;
defer buffer .deinit (gpa );
try appendRemainingAligned (r , gpa , alignment , &buffer , limit );
if (sentinel ) |s | {
return buffer .toOwnedSliceSentinel (gpa , s );
} else {
return buffer .toOwnedSlice (gpa );
}
}