Struct Controller
pub struct Controller { /* private fields */ }Expand description
Drives one seeded study a transaction at a time.
Implementations§
§impl Controller
impl Controller
pub fn records(&self) -> &[TrialRecord]
pub fn records(&self) -> &[TrialRecord]
Completed trials, in trial-number order.
pub fn best(&self) -> Option<&TrialRecord>
pub fn best(&self) -> Option<&TrialRecord>
The trial with the lowest value so far (the first one on a tie).
pub const fn snapshot(&self) -> Option<&StudySnapshot>
pub const fn snapshot(&self) -> Option<&StudySnapshot>
The study’s latest snapshot, refreshed after every transaction.
pub const fn generation(&self) -> u64
pub const fn generation(&self) -> u64
Increments on every reset or sampler change. Callbacks scheduled for an older generation are stale and must not act.
pub const fn revision(&self) -> u64
pub const fn revision(&self) -> u64
Increments on every observable change, so views refresh only when something changed.
pub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Whether the run can still complete trials.
pub fn start(&mut self) -> bool
pub fn start(&mut self) -> bool
Starts a ready run, or resumes a paused one. Returns whether the state changed.
pub fn pause(&mut self, reason: PauseReason) -> bool
pub fn pause(&mut self, reason: PauseReason) -> bool
Pauses a running run. A PauseReason::Hidden pause still needs an
explicit Self::start to continue. Returns whether the state changed.
pub fn tick(&mut self) -> bool
pub fn tick(&mut self) -> bool
Runs one transaction if the run is Status::Running. Returns whether
a trial completed.
pub fn step(&mut self) -> bool
pub fn step(&mut self) -> bool
Runs exactly one transaction from a ready or paused run and leaves it paused. Returns whether a trial completed.
pub fn reset(&mut self) -> Result<()>
pub fn reset(&mut self) -> Result<()>
Discards the run and creates a fresh study with the same configuration.
§Errors
The study could not be created.
pub fn select_sampler(&mut self, sampler: SamplerChoice) -> Result<()>
pub fn select_sampler(&mut self, sampler: SamplerChoice) -> Result<()>
pub fn sequence_digest(&self) -> u64
pub fn sequence_digest(&self) -> u64
FNV-1a over every completed trial’s number, sampler seed, parameter bits, and value bits — a compact fingerprint of the exact sequence, so a browser build can be compared against a host run.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Controller
impl !RefUnwindSafe for Controller
impl !UnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl UnsafeUnpin for Controller
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T, U> Imply<T> for U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 more