Trait ClientReloadListener
pub trait ClientReloadListener:
Send
+ Sync
+ 'static {
// Required method
fn prepare(
&self,
context: &ClientReloadContext,
) -> Result<Box<dyn ReloadApply>, ReloadResourceError>;
}Expand description
A client-side SimplePreparableReloadListener, as ServerReloadListener
reads data: prepare reads the new pack view without changing live state;
its returned apply publishes the result. All prepares finish before any
apply, including vanilla’s, runs. Prepare cannot see another listener’s new
published state. Dependencies order both phases deterministically; they do
not remove the barrier. On any error all pending applies are dropped,
keeping every listener’s previous assets.
Required Methods§
fn prepare(
&self,
context: &ClientReloadContext,
) -> Result<Box<dyn ReloadApply>, ReloadResourceError>
fn prepare( &self, context: &ClientReloadContext, ) -> Result<Box<dyn ReloadApply>, ReloadResourceError>
Parse and validate new assets without changing the listener’s live state.
As vanilla’s SimpleJsonResourceReloadListener.scanDirectory, a
listener that parses its files logs and skips one that won’t parse,
carrying the rest through; returning Err aborts the whole reload and
keeps every listener’s previous assets. A panic in prepare or the
returned apply is not recovered: it stops the game, and the crash report
names the listener and the mod that registered it.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".