pub trait InstanceServerHandler<___T: Transport = Channel> {
// Required methods
fn add_lines(
&mut self,
request: Request<AddLines, ___T>,
) -> impl Future<Output = ()> + Send;
fn ready(
&mut self,
responder: Responder<Ready, ___T>,
) -> impl Future<Output = ()> + Send;
// Provided method
fn on_unknown_interaction(
&mut self,
ordinal: u64,
) -> impl Future<Output = ()> + Send { ... }
}Expand description
A server handler for the Instance protocol.
See Instance for more details.
Required Methods§
Sourcefn add_lines(
&mut self,
request: Request<AddLines, ___T>,
) -> impl Future<Output = ()> + Send
fn add_lines( &mut self, request: Request<AddLines, ___T>, ) -> impl Future<Output = ()> + Send
Add multiple lines to the canvas. We are able to reduce protocol chatter and the number of
requests needed by batching instead of calling the simpler AddLine(...) one line at a
time.
Sourcefn ready(
&mut self,
responder: Responder<Ready, ___T>,
) -> impl Future<Output = ()> + Send
fn ready( &mut self, responder: Responder<Ready, ___T>, ) -> impl Future<Output = ()> + Send
Rather than the server randomly performing draws, or trying to guess when to do so, the client must explicitly ask for them. This creates a bit of extra chatter with the additional method invocation, but allows much greater client-side control of when the canvas is “ready” for a view update, thereby eliminating unnecessary draws.
This method also has the benefit of “throttling” the -> OnDrawn(...) event - rather than
allowing a potentially unlimited flood of -> OnDrawn(...) calls, we now have the runtime
enforced semantic that each -> OnDrawn(...) call must follow a unique Ready() -> () call
from the client. An unprompted -> OnDrawn(...) is invalid, and should cause the channel to
immediately close.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.