tiny.preserves.decodeText
Defined in text_reader.
Returns the one value text holds, allocated with allocator.
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.
lib.preserves.src.text.reader.expectDuplicateWithAllocator[function] — private source atlib/preserves/src/text/reader.zig:850in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_discarded_annotations_do_not_enter_the_application_embedded_domain[function] — test source atlib/preserves/src/text/reader.zig:993in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_integer[function] — test source atlib/preserves/src/text/reader.zig:885in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_negative_big_integer[function] — test source atlib/preserves/src/text/reader.zig:893in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_quoted_symbol[function] — test source atlib/preserves/src/text/reader.zig:919in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_rejects_duplicate_dictionary_keys_and_releases_owned_entries[function] — test source atlib/preserves/src/text/reader.zig:937in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_rejects_duplicate_set_elements_and_releases_owned_values[function] — test source atlib/preserves/src/text/reader.zig:927in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_sequence_preserves_duplicate_values[function] — test source atlib/preserves/src/text/reader.zig:909in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_sequence_with_commas[function] — test source atlib/preserves/src/text/reader.zig:901in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_skips_structurally_nested_annotations[function] — test source atlib/preserves/src/text/reader.zig:955in nearest public ownertiny.preserves.text.readerlib.preserves.src.text.reader.test_parse_validates_discarded_annotations[function] — test source atlib/preserves/src/text/reader.zig:975in nearest public ownertiny.preserves.text.reader
Audit
| Definitions | 1 |
|---|---|
| Public names | 4 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |