Crates for the browser: trainer and play on web-time, Judge everywhere, files closed by scope

trainer keeps its deadline in web_time::Instant (std's panics in a browser; on a
computer it is std's). play: the Judge type is on every target, only starting
it (an engine process) is native. chess-import: files are closed by the end of
their block before a rename instead of drop(), which a browser's File (no
destructor) makes a lint there. rustfmt of the earlier changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-30 15:09:17 +03:00
parent 1e0fb082e5
commit a4445d2c15
9 changed files with 44 additions and 27 deletions

View file

@ -31,9 +31,9 @@ pub use error::EngineError;
pub use events::{EngineEvent, TerminationReason, Waker};
#[cfg(not(target_family = "wasm"))]
pub use process::{Engine, EngineConfig, EngineHandle};
#[cfg(target_family = "wasm")]
pub use worker::{Engine, EngineHandle, Starting, WorkerConfig};
pub use types::{
EngineInfo, EngineOption, EnginePosition, EngineScore, OptionKind, PositionBase, Score,
ScoreBound, SearchId, SearchInfo, SearchLimits, Side, Timeouts, WhiteEval, WhiteScore,
};
#[cfg(target_family = "wasm")]
pub use worker::{Engine, EngineHandle, Starting, WorkerConfig};

View file

@ -202,7 +202,9 @@ impl Inner {
self.port.worker.terminate();
self.phase = Phase::Ended;
self.port
.emit(EngineEvent::Terminated(TerminationReason::Quit { status: None }));
.emit(EngineEvent::Terminated(TerminationReason::Quit {
status: None,
}));
} else {
self.port.worker.terminate();
self.phase = Phase::Ended;