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:
parent
1e0fb082e5
commit
a4445d2c15
9 changed files with 44 additions and 27 deletions
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue