pub enum InstanceRequest {
AddLines {
lines: Vec<[Point; 2]>,
control_handle: InstanceControlHandle,
},
Ready {
responder: InstanceReadyResponder,
},
_UnknownMethod {
ordinal: u64,
control_handle: InstanceControlHandle,
method_type: MethodType,
},
}
Expand description
Manages a single instance of a canvas. Each session of this protocol is responsible for a new canvas.
Variants§
AddLines
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.
Ready
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.
Fields
responder: InstanceReadyResponder
_UnknownMethod
An interaction was received which does not match any known method.
Fields
This variant is marked as non-exhaustive
control_handle: InstanceControlHandle
method_type: MethodType
Implementations§
Source§impl InstanceRequest
impl InstanceRequest
pub fn into_add_lines(self) -> Option<(Vec<[Point; 2]>, InstanceControlHandle)>
pub fn into_ready(self) -> Option<InstanceReadyResponder>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL