Function readAlloc [src]
Shortcut for calling readSliceAll with a buffer provided by allocator.
Prototype
pub fn readAlloc(r: *Reader, allocator: Allocator, len: usize) ReadAllocError![]u8
Parameters
r: *Reader
allocator: Allocator
len: usize
Possible Errors
Source
pub fn readAlloc(r: *Reader, allocator: Allocator, len: usize) ReadAllocError![]u8 {
const dest = try allocator.alloc(u8, len);
errdefer allocator.free(dest);
try readSliceAll(r, dest);
return dest;
}