Skip to main content

QueryHandler

Trait QueryHandler 

Source
pub trait QueryHandler<Q: ProtocolQuery, R: Serialize>: Send + Sync {
    // Required method
    fn handle(&self, query: Q) -> Result<R, String>;
}
Expand description

Handler for a query type. Game project implements this.

Q is the query type (e.g., GetWorldSnapshot). R is the response type (e.g., WorldSnapshot DTO).

Required Methods§

Source

fn handle(&self, query: Q) -> Result<R, String>

Execute the query and return a response.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§