~caolan/zig-netstring

9f59b540e287f98268af7920621635b63e27f18c — Caolan McMahon 6 months ago b990d5f master
use fixed buffer in README
1 files changed, 3 insertions(+), 2 deletions(-)

M README.md
M README.md => README.md +3 -2
@@ 19,12 19,13 @@ const std = @import("std");
pub fn main() !void {
    var input = std.io.fixedBufferStream("5:hello,6:world!,");
    var parser = netstring.netStringParser(input.reader());
    var buf: [1024]u8 = undefined;

    // Repeat while the parser can find another netstring
    while (try parser.next()) |reader| {
        // Read the current netstring and print it
        const msg = try reader.readAllAlloc(std.heap.page_allocator, 4096);
        std.debug.print("{s}\n", .{msg});
        const bytes = try reader.readAll(&buf);
        std.debug.print("{s}\n", .{buf[0..bytes]});
    }
}
```