Skip to documentation
SLOP

tiny.preserves.decodeText

Reference tiny.preserves decodeText

Defined in text_reader.

Returns the one value text holds, allocated with allocator.

Called byCallsprivate sourcelib.preserves.src.text.readerexpectDuplicateWithAllocatortest sourcelib.preserves.src.text.readertest: discarded annotations do not en...test sourcelib.preserves.src.text.readertest: parse integertest sourcelib.preserves.src.text.readertest: parse negative big integertest sourcelib.preserves.src.text.readertest: parse quoted symbol+6 moreprivate sourcelib.preserves.src.text.readerreadValueAtprivate sourcelib.preserves.src.text.readerskipTrailingtext_readerdecode
Static calls · unresolved targets: 0 · external targets: 2.

Source

Source: lib/preserves/src/text/reader.zig:114

zig
/// Returns the one value `text` holds, allocated with `allocator`. Code that reads a whole data/// file calls it, so each file yields one owned value. The value's embedded values have the type/// `D`. Whitespace and commas separate values. `decode` reads no comments, so `# ` fails as an/// unknown `#` form. A bare token that is all digits, with an optional sign, becomes an integer of/// any size, a token in decimal or exponent form becomes a double, and any other token becomes a/// symbol.////// The value owns all its memory, so `text` may be freed at once, and the caller frees the value/// with `deinit`. On any error the call frees everything it allocated. Its repeated-item checks/// compare each element or key with every earlier one, so their cost grows with the square of the/// count.pub fn decode(comptime D: type, allocator: Allocator, text: []const u8) DecodeError!value_mod.Value(D) {    var index: usize = 0;    var v = try readValueAt(D, allocator, text, &index, nesting.root);    errdefer v.deinit(allocator);    skipTrailing(text, &index);    if (index != text.len) return error.UnexpectedTrailingBytes;    return v;}

Source: lib/preserves/src/root.zig:301

zig
pub const decodeText = text.decode;

Also reachable as

text.decode, text.reader.decode.

Complete caller list

11 direct callers.

Audit

Definitions1
Public names4
Members0
Version26.7.0
Revisiondaab053ee433