tiny.reducer.Result
Defined in bytes.reduction.
Outcome of one run, borrowing its memory from the acquired workspace.
API (6)
Actions
Public operations.
deinit: Gives up this run's lease on the workspace, returning it to steady and idle.
Fields and members
Public fields and members.
Source
Source: lib/reducer/src/bytes/reduce.zig:71
zig
/// Outcome of one run, borrowing its memory from the acquired workspace.////// ## Lifetime and Borrowing Contract////// The `bytes` slice points into the backing buffer of `storage`, and it stays/// readable while the result is still live and the workspace has been neither/// reused nor torn down.////// `deinit()` gives up this run's lease by calling `storage.release()`, which/// returns the workspace to steady and idle so a later run can acquire it, and/// it moves the workspace no closer to teardown and frees no memory.////// `deinit()` also clears the result's own fields, setting `bytes = &.{}`,/// `attempts = 0`, `reductions = 0`, and `completion = .budget_exhausted`, and/// it is called exactly once per result.////// A caller that needs the reduced bytes after the workspace is reused or torn/// down, or that wants to feed them in as the next run's input on the same/// workspace, copies them into a buffer of its own before calling `deinit()`.pub const Result = struct { /// Borrowed slice holding the reduced byte sequence, pointing into the /// workspace. bytes: []const u8, /// Count of every oracle call the run made, including the first call, which /// checks the caller's own input. On a live result, before `deinit()`, the /// count is at least 1. `deinit()` sets it to 0. attempts: usize, /// Count of the candidate deletions the oracle accepted. Each accepted /// reduction makes the witness strictly shorter. `deinit()` sets it to 0. reductions: usize, /// Search outcome status flag holding `.one_minimal` when every single-byte /// occurrence deletion was put to the oracle and rejected. It holds /// `.budget_exhausted` when the run stopped because `attempts` reached /// `max_attempts` before the single-byte sweep finished. `deinit()` sets it /// to `.budget_exhausted`. completion: model.Completion, /// Pointer to the workspace that owns the memory `bytes` refers to. storage: *storage_mod.Storage, /// Gives up this run's lease on the workspace, returning it to steady and /// idle. /// /// After the call, `bytes` is an empty slice, the counters are zero, and /// the workspace can be acquired again. /// /// ## Safety /// /// - It is called exactly once per result. /// - One owner holds a given result and makes no shallow copy of it. /// - The result's public bookkeeping fields stay as the run left them. pub fn deinit(self: *Result) void { self.storage.release(); self.bytes = &.{}; self.attempts = 0; self.reductions = 0; self.completion = .budget_exhausted; }};Source: lib/reducer/src/root.zig:341
zig
/// Outcome of a run, with bytes borrowed from the acquired workspace.pub const Result = bytes.Result;Also reachable as
Audit
| Definitions | 2 |
|---|---|
| Public names | 6 |
| Members | 5 |
| Version | 26.7.0 |
| Revision | daab053ee433 |