Skip to main content

Mountain/Binary/Initialize/RuntimeBuild/
CreateBuilder.rs

1#![allow(non_snake_case)]
2
3//! Translate a `SchedulerConfig::Struct` into a configured Echo
4//! `SchedulerBuilder`. Worker counts are clamped to `[1, 256]` so the
5//! caller can't accidentally request 0 workers or oversaturate.
6
7use Echo::Scheduler::SchedulerBuilder::SchedulerBuilder;
8
9use crate::{Binary::Initialize::RuntimeBuild::SchedulerConfig, dev_log};
10
11pub fn Fn(Config:SchedulerConfig::Struct) -> SchedulerBuilder {
12	let mut Builder = SchedulerBuilder::Create();
13
14	if let Some(Count) = Config.WorkerCount {
15		let Count = Count.clamp(1, 256);
16		Builder = Builder.WithWorkerCount(Count);
17		dev_log!("lifecycle", "[RuntimeBuild] Configuring {} worker threads", Count);
18	}
19
20	Builder
21}