tiny.pluck.toplevel.shared
Defined in toplevel.
API (2)
Actions
Public operations.
Source
Source: lib/pluck/src/toplevel/root.zig:5
zig
pub const shared = @import("shared.zig");Source: lib/pluck/src/toplevel/shared.zig
zig
const std = @import("std");const pluck = @import("../root.zig");const Allocator = std.mem.Allocator;const pexpr = pluck.pexpr;const Definition = pexpr.Definition;const Definitions = pexpr.Definitions;const TypeRegistry = pexpr.TypeRegistry;pub fn cloneDefinitionsShallow(allocator: Allocator, source: *const Definitions) !Definitions { var defs = std.StringHashMap(Definition).init(allocator); errdefer defs.deinit(); var iter = source.defs.iterator(); while (iter.next()) |entry| { try defs.put(entry.key_ptr.*, entry.value_ptr.*); } return Definitions{ .allocator = allocator, .defs = defs, };}pub fn cloneTypesShallow(allocator: Allocator, source: *const TypeRegistry) !TypeRegistry { var types = TypeRegistry.init(allocator); errdefer { types.type_of_constructor.deinit(); types.constructors_of_type.deinit(); types.args_of_constructor.deinit(); } var iter = source.type_of_constructor.iterator(); while (iter.next()) |entry| { try types.type_of_constructor.put(entry.key_ptr.*, entry.value_ptr.*); } var iter2 = source.constructors_of_type.iterator(); while (iter2.next()) |entry| { try types.constructors_of_type.put(entry.key_ptr.*, entry.value_ptr.*); } var iter3 = source.args_of_constructor.iterator(); while (iter3.next()) |entry| { try types.args_of_constructor.put(entry.key_ptr.*, entry.value_ptr.*); } return types;}Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |