Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions specs/port/trios-railway/crates/trios-igla-race/src/asha.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// trios-igla-race ASHA scheduler — the stateless unit constructor.
// Port of gHashTag/trios-railway:crates/trios-igla-race/src/asha.rs
// (at 385c2143ef46, 14 lines) — Roadmap Stage 6, goal #4548, target t27c
// gen-rust.
//
// The original is the ASHA scheduler's zero-sized unit: a struct with no
// fields, `new` building it, and `Default` delegating to `new`. The two
// decisions the file carries are its statelessness — the scheduler is a
// unit with no configuration, which the race tunes elsewhere — and the
// delegation: the default value IS the constructed one. Both are ported
// as pure functions and tested: the constructor builds the unit, the
// default calls the constructor (the delegation is this port's body),
// and the field-count pin asserts the zero-field design against a
// regression that would grow hidden state onto the scheduler. No
// transport exists in this port (issue #9659, "Port the decision, not
// the plumbing").

module port::trios_igla_race_asha;

// Original line 1: `pub struct AshaScheduler;` — the zero-sized unit.
pub struct AshaScheduler { }

// The scheduler's design decision, countable: it carries no state — no
// configuration, no rung table, no tunables. The race reads its knobs
// elsewhere; anything grown onto this struct would be hidden state.
pub fn scheduler_field_count() -> usize {
return 0;
}

// Original lines 3-8: `impl AshaScheduler { pub fn new() -> Self }` — the
// constructor builds the unit.
pub fn AshaScheduler_new() -> AshaScheduler {
return AshaScheduler { };
}

// Original lines 10-14: `impl Default for AshaScheduler { fn default()
// -> Self { Self::new() } }` — the default value delegates to the
// constructor: the delegation is this port's body.
pub fn AshaScheduler_default() -> AshaScheduler {
return AshaScheduler_new();
}

// ---------------------------------------------------------------------------
// Tests: the unit's decisions asserted — construction, delegation, and
// the zero-field pin.
// ---------------------------------------------------------------------------

test new_builds_the_stateless_scheduler {
const s = AshaScheduler_new();
assert(scheduler_field_count() == 0);
}

test default_delegates_to_the_constructor {
const d = AshaScheduler_default();
assert(scheduler_field_count() == 0);
}
Loading