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: *Readerallocator: Allocatorlen: usize

Possible Errors

EndOfStream Error
OutOfMemory Error
ReadFailed Error

See the Reader implementation for detailed diagnostics.

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; }