Commit 1f37b70344
Changed files (1)
lib
std
lib/std/fmt.zig
@@ -224,7 +224,6 @@ pub const Placeholder = struct {
pub fn parse(comptime str: anytype) Placeholder {
const view = std.unicode.Utf8View.initComptime(&str);
comptime var parser = Parser{
- .buf = &str,
.iter = view.iterator(),
};
@@ -311,10 +310,13 @@ pub const Specifier = union(enum) {
named: []const u8,
};
+/// A stream based parser for format strings.
+///
+/// Allows to implement formatters compatible with std.fmt without replicating
+/// the standard library behavior.
pub const Parser = struct {
- buf: []const u8,
pos: usize = 0,
- iter: std.unicode.Utf8Iterator = undefined,
+ iter: std.unicode.Utf8Iterator,
// Returns a decimal number or null if the current character is not a
// digit