pub struct ReferenceSession { /* private fields */ }Expand description
Attends to runs that say what they were authored to say, one thing per pass.
Nothing here happens elsewhere: a run is a count of things left to say, and time passes only when a scenario says it does, so what attendance means can be read without waiting for it.
Trait Implementations§
Source§impl AttentionAlg for ReferenceSession
impl AttentionAlg for ReferenceSession
Source§impl ClockAlg for ReferenceSession
impl ClockAlg for ReferenceSession
Source§impl Debug for ReferenceSession
impl Debug for ReferenceSession
Source§impl Default for ReferenceSession
impl Default for ReferenceSession
Source§impl RunHoldAlg for ReferenceSession
impl RunHoldAlg for ReferenceSession
Source§fn holding_is_possible(&self) -> bool
fn holding_is_possible(&self) -> bool
Source§fn hold_run(&self, run: &mut ReferenceRun, held: bool)
fn hold_run(&self, run: &mut ReferenceRun, held: bool)
Source§fn abandon_run(&self, run: &mut ReferenceRun)
fn abandon_run(&self, run: &mut ReferenceRun)
Source§impl RunReadAlg for ReferenceSession
impl RunReadAlg for ReferenceSession
Source§fn run_is_over(&self, run: &ReferenceRun) -> bool
fn run_is_over(&self, run: &ReferenceRun) -> bool
Source§impl SessionLawFixture for ReferenceSession
impl SessionLawFixture for ReferenceSession
Source§fn law_wanting(&mut self, says: usize) -> usize
fn law_wanting(&mut self, says: usize) -> usize
Source§fn law_unbeginnable(&mut self) -> usize
fn law_unbeginnable(&mut self) -> usize
Source§fn law_wants(&mut self, id: &usize, wanted: Wanted)
fn law_wants(&mut self, id: &usize, wanted: Wanted)
Source§fn law_passes(&mut self, elapsed: Duration)
fn law_passes(&mut self, elapsed: Duration)
Source§fn law_told(&self, id: &usize) -> Vec<Telling>
fn law_told(&self, id: &usize) -> Vec<Telling>
Source§fn law_abandonments(&self, id: &usize) -> usize
fn law_abandonments(&self, id: &usize) -> usize
Source§impl SessionSorts for ReferenceSession
impl SessionSorts for ReferenceSession
Source§type Run = ReferenceRun
type Run = ReferenceRun
Source§impl UndertakingAlg for ReferenceSession
impl UndertakingAlg for ReferenceSession
Auto Trait Implementations§
impl !RefUnwindSafe for ReferenceSession
impl !Send for ReferenceSession
impl !Sync for ReferenceSession
impl !UnwindSafe for ReferenceSession
impl Freeze for ReferenceSession
impl Unpin for ReferenceSession
impl UnsafeUnpin for ReferenceSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<This> GaugeLaws<This> for This
impl<This> GaugeLaws<This> for This
Source§fn gauge_laws(&self) -> Result<(), Error>
fn gauge_laws(&self) -> Result<(), Error>
Checks that a gauge states a share without claiming more resolution than it has.
The laws checked are:
- a gauge occupies its stated width whatever share it states;
- no share is stated as filled before it is reached, and none is stated twice;
- nothing stated is nothing filled, and everything stated fills the whole track;
- the stated text occupies exactly one cell per counted cell.
§Errors
Returns the first violated law.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<This> IntoExt<This> for This
impl<This> IntoExt<This> for This
Source§fn to<R>(self) -> Rwhere
This: Into<R>,
fn to<R>(self) -> Rwhere
This: Into<R>,
A version of Into::into function that can be used to explicitly specify the target
conversion type.
use alux_sdk::*;
// `Into` requires context to infer the type,
let _: i64 = Into::into(42_i8);
// The opposite `From` requires context to infer the type,
let _: i64 = From::from(42_i8);
// `.to()` can be used in the same way as a postfix function (the same as `.into()`),
let _: i64 = 42_i8.to();
// but also with the type specified explicitly.
let _ = 42_i8.to::<i64>();
// Especially useful to chain multiple conversions inline.
let _: i64 = 42_i8.to::<i16>().to::<i32>().into();Source§impl<This> IntoIteratorExt<This> for This
impl<This> IntoIteratorExt<This> for This
Source§fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
A variant of the try_collect and collect_vec combined function from the Itertools
library. The materialized value is a Vec inside a Result object.
Returns the first error without collecting later values.
use alux_sdk::*;
let values = [Ok::<_, &str>(1), Ok(2), Ok(3)]
.into_iter()
.try_collect_vec();
assert_eq!(values, Ok(vec![1, 2, 3]));Source§fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
Takes exactly n elements from the iterator.
Returns Some(Vec<T>) if the iterator yields exactly n elements,
otherwise returns None.
use alux_sdk::*;
let v = [1, 2, 3];
assert_eq!(v.iter().copied().collect_exact(3), Some(vec![1, 2, 3]));
assert_eq!(v.iter().copied().collect_exact(4), None);
assert_eq!(v.iter().copied().collect_exact(2), None);Source§fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
Efficiently splits an iterator of Result<(A, B), E> into two Vecs, short-circuiting on error.
Consumes the iterator, collecting all A elements into one vector and all B elements into another,
without first allocating an intermediate vector of tuples. Returns the tuple (Vec<A>, Vec<B>) on success,
or the first error encountered.
use alux_sdk::*;
let input = vec![Ok((1, "x")), Ok((2, "y"))];
let (xs, ys) = input.try_unzip::<_, _, ()>().unwrap();
assert_eq!(xs, vec![1, 2]);
assert_eq!(ys, vec!["x", "y"]);Source§impl<This> SessionExt<This> for This
impl<This> SessionExt<This> for This
Source§fn attend(
&mut self,
running: &mut Vec<Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>>,
)
fn attend( &mut self, running: &mut Vec<Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>>, )
Attends to every run once, then begins the work nobody has begun yet.
The order is the meaning. Ending comes before beginning, so leaving never races starting; a run is seen to be over before it is read, so everything it wrote before ending is read; and what it said is stated before how it ended, so nothing it said is lost to its ending.
Source§fn attend_one(
&mut self,
attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>,
) -> bool
fn attend_one( &mut self, attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>, ) -> bool
Attends to one run, and states whether it is still running afterward.
Source§fn hold_still(
&self,
attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>,
)
fn hold_still( &self, attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>, )
Holds one run still, and remembers when, so held time is not counted as running.
Source§fn let_go(
&self,
attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>,
)
fn let_go( &self, attending: &mut Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>, )
Lets one held run go, keeping the time it was held still.
Source§fn running_for(
&self,
attending: &Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>,
) -> Duration
fn running_for( &self, attending: &Attending<<This as SessionSorts>::Id, <This as SessionSorts>::Run, <This as ClockAlg>::Moment>, ) -> Duration
States how long one run has been running, not counting the time it was held still.
Source§impl<This> SessionLaws<This> for Thiswhere
This: UndertakingAlg + RunReadAlg + RunHoldAlg + AttentionAlg + ClockAlg + SessionLawFixture,
<This as SessionSorts>::Id: Clone + Eq + Debug,
impl<This> SessionLaws<This> for Thiswhere
This: UndertakingAlg + RunReadAlg + RunHoldAlg + AttentionAlg + ClockAlg + SessionLawFixture,
<This as SessionSorts>::Id: Clone + Eq + Debug,
Source§fn session_laws(&mut self) -> Result<(), Error>
fn session_laws(&mut self) -> Result<(), Error>
Checks that one pass reconciles what is wanted with what is happening.
The laws checked are:
- one pass begins every request wanting work, and no other;
- a request whose work has begun is not begun again, however many passes run;
- everything a run said is told before how it ended, and nothing is told after;
- work refusing to begin ends once and is not begun again;
- a run nobody wants is told to end on every pass until it is over, and ends once;
- time a run is held still is not counted as time it was running;
- attending to no runs tells nothing.
§Errors
Returns the first violated law.
Source§fn check_beginning_laws(&mut self) -> Result<(), Error>
fn check_beginning_laws(&mut self) -> Result<(), Error>
Checks what one pass begins, and what it declines to begin twice.
§Errors
Returns the first violated law.
Source§fn check_saying_laws(&mut self) -> Result<(), Error>
fn check_saying_laws(&mut self) -> Result<(), Error>
Checks that what a run said reaches the request before how it ended.
§Errors
Returns the first violated law.