tiny.preserves.patternToPreserves
Defined in tiny.preserves.
Writes the pattern values of pattern as records, the reverse of preservesToPattern.
Source
Source: lib/preserves/src/any.zig:300
zig
/// Writes the pattern values of `pattern` as records, the reverse of `preservesToPattern`. `toText`/// calls it to print captures and binds, and code that sends a pattern as data calls it for the/// record form. A discard becomes `<_>`, and captures and binds both become `<bind P>`. A bind's/// name is dropped, so a bind comes back from the record form as a capture. Atoms and sets become/// `<lit V>`, and embedded values stay as they are. A record becomes `<group <rec L> {0: P0 ...}>`,/// a sequence `<group <arr> {...}>`, and a dictionary `<group <dict> {K: P}>`. A rest pattern/// becomes the sequence of its prefix, the symbol `.`, and its rest pattern, written the same way./// The result holds `pattern`'s own atoms, sets, labels and dictionary keys, and its new labels/// point to constant bytes of the package. So `Value.deinit` would free constant bytes, and/// `freeValueDeep` frees storage that `pattern` still holds. On `error.OutOfMemory` the storage/// built before the failure is never freed.pub fn patternToPreserves(alloc: std.mem.Allocator, pattern: AnyValue) !AnyValue { return any_conversions.patternToPreserves(alloc, pattern);}Source: lib/preserves/src/root.zig:225
zig
pub const patternToPreserves = any.patternToPreserves;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |