Skip to main content

InstanceLocalServerHandler

Trait InstanceLocalServerHandler 

Source
pub trait InstanceLocalServerHandler<___T = Channel>
where ___T: Transport,
{ // Required methods fn add_lines( &mut self, request: Request<AddLines, ___T>, ) -> impl Future<Output = ()>; fn ready( &mut self, responder: Responder<Ready, ___T>, ) -> impl Future<Output = ()>; // Provided method fn on_unknown_interaction( &mut self, ordinal: u64, ) -> impl Future<Output = ()> { ... } }
Expand description

A server handler for the Instance protocol.

See Instance for more details.

Required Methods§

Source

fn add_lines( &mut self, request: Request<AddLines, ___T>, ) -> impl Future<Output = ()>

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.

Source

fn ready( &mut self, responder: Responder<Ready, ___T>, ) -> impl Future<Output = ()>

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§

Source

fn on_unknown_interaction(&mut self, ordinal: u64) -> impl Future<Output = ()>

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.

Implementations on Foreign Types§

Source§

impl<___H, ___T> InstanceLocalServerHandler<___T> for Local<___H>
where ___H: InstanceServerHandler<___T>, ___T: Transport,

Source§

async fn add_lines(&mut self, request: Request<AddLines, ___T>)

Source§

async fn ready(&mut self, responder: Responder<Ready, ___T>)

Source§

async fn on_unknown_interaction(&mut self, ordinal: u64)

Implementors§