Skip to main content

ServerReloadListener

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>

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§

§

impl Wire for Box<dyn ServerReloadListener>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn ServerReloadListener>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§