Trait ServerReloadListener
pub trait ServerReloadListener:
Send
+ Sync
+ 'static {
// Required method
fn prepare(
&self,
context: &ServerReloadContext,
) -> Result<Box<dyn ReloadApply>, ReloadResourceError>;
}Expand description
A server-side SimplePreparableReloadListener: 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 the previous data and function library.
Required Methods§
fn prepare(
&self,
context: &ServerReloadContext,
) -> Result<Box<dyn ReloadApply>, ReloadResourceError>
fn prepare( &self, context: &ServerReloadContext, ) -> Result<Box<dyn ReloadApply>, ReloadResourceError>
Parse and validate new data 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 data. A panic in prepare or the
returned apply is not recovered: it stops the server, 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".