Struct Adapter
pub struct Adapter { /* private fields */ }Expand description
The solver process: one sampler kind, and a session per live solver_id.
Feed it decoded SolverMessages with handle; it
returns the reply to send back (or None for a cast that expects none). The
startup SolverSpecCast is produced by
spec_message.
Implementations§
§impl Adapter
impl Adapter
pub fn new(kind: SamplerKind) -> Self
pub fn new(kind: SamplerKind) -> Self
A fresh adapter that will run kind for every session it is asked to
create, assuming DEFAULT_BUDGET_TRIALS.
pub const fn with_budget(self, budget: Budget) -> Self
pub const fn with_budget(self, budget: Budget) -> Self
Declares the trial budget kurobako will actually run each study for.
Only SamplerKind::Auto reads it, and only when a session is created;
live sessions keep the budget they were created with, so this is
meaningless after the first CREATE_SOLVER_CAST and is therefore a
construction-time builder step rather than a setter.
pub fn spec_message(&self) -> SolverMessage
pub fn spec_message(&self) -> SolverMessage
The startup message announcing this solver to kurobako.
pub fn handle(&mut self, message: SolverMessage) -> Option<SolverMessage>
pub fn handle(&mut self, message: SolverMessage) -> Option<SolverMessage>
Handles one inbound message, returning the reply to send (if any).
Casts (CreateSolverCast, DropSolverCast) return None; calls
(AskCall, TellCall) return their reply or an
ErrorReply. A message a solver should
never receive is logged to stderr and ignored, which is the safe choice
against a desynchronized stream.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Adapter
impl !UnwindSafe for Adapter
impl Freeze for Adapter
impl Send for Adapter
impl Sync for Adapter
impl Unpin for Adapter
impl UnsafeUnpin for Adapter
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, 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