tiny.preserves.preservePattern
Defined in tiny.preserves.
Reads a pattern written as records and returns it as pattern values.
Source
Source: lib/preserves/src/any.zig:285
zig
/// Reads a pattern written as records and returns it as pattern values. Code that holds a pattern/// parsed as records calls it for the pattern values of `Value`. The symbol `_` and the record/// `<_>` become a discard. `<bind P>` becomes a capture of `P`. `<lit V>` becomes `V` itself./// `<group <rec L> {0: P0 1: P1}>` becomes a record labeled `L` with its fields in key order./// `<group <arr> {...}>` becomes a sequence the same way, and `<group <dict> {K: P}>` becomes a/// dictionary. Other records, sequences and dictionaries are converted item by item, and every/// other value comes back unchanged. The result shares atoms, `<lit>` values, labels and dictionary/// keys with `pattern`. On a failed allocation the call returns the unconverted input in its place/// and reports nothing, and cells allocated before the failure are never freed./// `preservesToPattern` does the same conversion and reports allocation failure.pub fn preservePattern(alloc: std.mem.Allocator, pattern: AnyValue) AnyValue { return any_conversions.preservePattern(alloc, pattern);}Source: lib/preserves/src/root.zig:224
zig
pub const preservePattern = any.preservePattern;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |