tiny.smg.NodeFindingPlan
Defined in rules.
API (15)
Actions
Public operations.
Types and contracts
Public types and contracts.
Fields and members
Public fields and members.
Source
Source: tools/smg/src/rules.zig:196
zig
pub const NodeFindingPlan = struct { pub const Limits = struct { nodes: usize, }; pub const Capacity = struct { nodes: usize, bytes: usize, pub fn derive(limits: Limits) error{CapacityOverflow}!Capacity { return .{ .nodes = limits.nodes, .bytes = std.math.mul( usize, limits.nodes, @sizeOf([]const u8), ) catch return error.CapacityOverflow, }; } }; pub const InitError = std.mem.Allocator.Error || error{CapacityOverflow}; pub const claim: alloc_phase.capacity.Declaration = .{ .source = .{ .id = "smg.node_finding_plan", .kind = .phase_static, .limit_source = .caller, .storage = .{ .covered = &.{ .{ .id = "exact_node_finding_result", .lifetime = .transferred, .detail = "exact node finding result", }, }, .excluded = &.{ "borrowed graph nodes indexes and model strings", "parsed rule fields and finding message text", "rule aggregation rendering and terminal output", }, }, .capacity = .{ .inputs = &.{ alloc_phase.capacity.bindInput(Limits, "nodes", "nodes"), }, .type_selectors = &.{ alloc_phase.capacity.bindType([]const u8, "const_u8"), }, .nodes = &.{ .{ .input = 0 }, .{ .scale = .{ .node = 0, .coefficient = .{ .size_of_concrete_type = 0 } } }, }, .assertions = &.{.{ .scope = .closure_total, .measure = .retained, .relation = .exact, .expression = 1, }}, }, .overload = .{ .kind = .reject_before_seal, .detail = "checked survey arithmetic and exact acquisition reject before fill", }, .risks = .{ .transitive = .{ .status = .witnessed, .detail = "sealed fill and in-place ordering call no allocator-backed child", }, .foreign = .{ .status = .excluded, .detail = "rule matching and result production perform no foreign effects", }, }, .obligations = &.{ .{ .key = "smg_node_finding_plan_capacity_capacity_model", .role = .capacity_model }, .{ .key = "smg_node_finding_plan_capacity_overload", .role = .overload }, .{ .key = "smg_node_finding_plan_oom", .role = .overload }, .{ .key = "smg_node_finding_plan_sealed", .role = .transitive_risk }, .{ .key = "smg_node_finding_plan_integration", .role = .foreign_risk }, }, }, .bindings = .{ .owner = @This(), .seal = .{ .family = alloc_phase.capacity.selector(@This().activate), .premise = .{ .class = .checked_semantic_fact, .authority = .checker, }, }, .teardown = .{ .family = alloc_phase.capacity.selector(@This().deinit), .premise = .{ .class = .checked_semantic_fact, .authority = .checker, }, }, }, }; phase: alloc_phase.capacity.Phase, capacity: Capacity, nodes: [][]const u8, filled: usize = 0, pub fn init(allocator: std.mem.Allocator, limits: Limits) InitError!NodeFindingPlan { const capacity = try Capacity.derive(limits); return .{ .phase = .initialization, .capacity = capacity, .nodes = try allocFindingNodes(allocator, capacity.nodes), }; } pub fn activate(self: *NodeFindingPlan) void { std.debug.assert(self.phase == .initialization); std.debug.assert(self.filled == 0); self.phase = .steady; } pub fn append(self: *NodeFindingPlan, node: []const u8) void { std.debug.assert(self.phase == .steady); std.debug.assert(self.filled < self.nodes.len); self.nodes[self.filled] = node; self.filled += 1; } pub fn sort(self: *NodeFindingPlan) void { std.debug.assert(self.phase == .steady); std.debug.assert(self.filled == self.nodes.len); std.mem.sort([]const u8, self.nodes, {}, cmpString); } pub fn transfer(self: *NodeFindingPlan) []const []const u8 { std.debug.assert(self.phase == .steady); std.debug.assert(self.filled == self.nodes.len); const nodes = self.nodes; self.phase = .teardown; self.nodes = @constCast((&[_][]const u8{})[0..]); self.filled = 0; return nodes; } pub fn deinit(self: *NodeFindingPlan, allocator: std.mem.Allocator) void { std.debug.assert(self.phase != .teardown); self.phase = .teardown; freeFindingNodes(allocator, self.nodes); self.* = undefined; }};Source: tools/smg/src/root.zig:118
zig
pub const NodeFindingPlan = @import("rules.zig").NodeFindingPlan;Audit
| Definitions | 12 |
|---|---|
| Public names | 24 |
| Members | 7 |
| Version | 26.7.0 |
| Revision | daab053ee433 |