pub struct SolverConfig {
pub environment_mode: EnvironmentMode,
pub random_seed: Option<u64>,
pub move_thread_count: MoveThreadCount,
pub termination: Option<TerminationConfig>,
pub score_director: Option<DirectorConfig>,
pub phases: Vec<PhaseConfig>,
pub candidate_trace: Option<CandidateTraceConfig>,
}Fields§
§environment_mode: EnvironmentMode§random_seed: Option<u64>§move_thread_count: MoveThreadCount§termination: Option<TerminationConfig>§score_director: Option<DirectorConfig>§phases: Vec<PhaseConfig>§candidate_trace: Option<CandidateTraceConfig>Optional bounded candidate-pull trace for cross-runtime diagnostics.
This is deliberately opt-in: recording a trace retains one owned identity per engine-consumed candidate. A non-zero cap is required so diagnostic runs cannot accidentally retain an unbounded neighborhood.
Implementations§
Source§impl SolverConfig
impl SolverConfig
pub fn new() -> SolverConfig
Sourcepub fn load(path: impl AsRef<Path>) -> Result<SolverConfig, ConfigError>
pub fn load(path: impl AsRef<Path>) -> Result<SolverConfig, ConfigError>
Loads configuration from a TOML file.
§Errors
Returns error if file doesn’t exist or contains invalid TOML.
Sourcepub fn from_toml_file(
path: impl AsRef<Path>,
) -> Result<SolverConfig, ConfigError>
pub fn from_toml_file( path: impl AsRef<Path>, ) -> Result<SolverConfig, ConfigError>
Loads configuration from a TOML file.
Sourcepub fn from_toml_str(s: &str) -> Result<SolverConfig, ConfigError>
pub fn from_toml_str(s: &str) -> Result<SolverConfig, ConfigError>
Parses configuration from a TOML string.
Sourcepub fn from_yaml_file(
path: impl AsRef<Path>,
) -> Result<SolverConfig, ConfigError>
pub fn from_yaml_file( path: impl AsRef<Path>, ) -> Result<SolverConfig, ConfigError>
Loads configuration from a YAML file.
Sourcepub fn from_yaml_str(s: &str) -> Result<SolverConfig, ConfigError>
pub fn from_yaml_str(s: &str) -> Result<SolverConfig, ConfigError>
Parses configuration from a YAML string.
pub fn with_termination_seconds(self, seconds: u64) -> SolverConfig
pub fn with_random_seed(self, seed: u64) -> SolverConfig
pub fn with_phase(self, phase: PhaseConfig) -> SolverConfig
Sourcepub fn canonical_toml(&self) -> String
pub fn canonical_toml(&self) -> String
Returns a deterministic, complete representation of this effective configuration for diagnostic provenance.
The representation is intentionally produced by the same serde model used to load solver configuration. Consumers compare this exact value together with the resolved phase plan in the candidate trace header.
Sourcepub fn canonical_phase_toml(phase: &PhaseConfig) -> String
pub fn canonical_phase_toml(phase: &PhaseConfig) -> String
Returns the canonical solver-document representation of one phase.
Runtime provenance uses this rather than debug formatting so every configured selector, acceptor, forager, target, and termination field participates in the candidate-trace plan digest.
Sourcepub fn time_limit(&self) -> Option<Duration>
pub fn time_limit(&self) -> Option<Duration>
Returns the termination time limit, if configured.
Convenience method that delegates to termination.time_limit().
§Examples
use solverforge_config::SolverConfig;
use std::time::Duration;
let config = SolverConfig::from_toml_str(r#"
[termination]
seconds_spent_limit = 30
"#).unwrap();
assert_eq!(config.time_limit(), Some(Duration::from_secs(30)));Trait Implementations§
Source§impl Clone for SolverConfig
impl Clone for SolverConfig
Source§fn clone(&self) -> SolverConfig
fn clone(&self) -> SolverConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SolverConfig
impl Debug for SolverConfig
Source§impl Default for SolverConfig
impl Default for SolverConfig
Source§fn default() -> SolverConfig
fn default() -> SolverConfig
Source§impl<'de> Deserialize<'de> for SolverConfig
impl<'de> Deserialize<'de> for SolverConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SolverConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SolverConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for SolverConfig
impl Serialize for SolverConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SolverConfig
impl RefUnwindSafe for SolverConfig
impl Send for SolverConfig
impl Sync for SolverConfig
impl Unpin for SolverConfig
impl UnsafeUnpin for SolverConfig
impl UnwindSafe for SolverConfig
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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