#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::endpoints::{ControlHandle as _, Responder as _};
use fuchsia_zircon_status as zx_status;
use futures::future::{self, MaybeDone, TryFutureExt};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const MODIFIER_ALT: u32 = 96;
pub const MODIFIER_CAPS_LOCK: u32 = 1;
pub const MODIFIER_CONTROL: u32 = 24;
pub const MODIFIER_LEFT_ALT: u32 = 32;
pub const MODIFIER_LEFT_CONTROL: u32 = 8;
pub const MODIFIER_LEFT_SHIFT: u32 = 2;
pub const MODIFIER_LEFT_SUPER: u32 = 128;
pub const MODIFIER_NONE: u32 = 0;
pub const MODIFIER_RIGHT_ALT: u32 = 64;
pub const MODIFIER_RIGHT_CONTROL: u32 = 16;
pub const MODIFIER_RIGHT_SHIFT: u32 = 4;
pub const MODIFIER_RIGHT_SUPER: u32 = 256;
pub const MODIFIER_SHIFT: u32 = 6;
pub const MODIFIER_SUPER: u32 = 384;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AxisScale {
Linear,
Logarithmic,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! AxisScaleUnknown {
() => {
_
};
}
impl AxisScale {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Linear),
1 => Some(Self::Logarithmic),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Linear,
1 => Self::Logarithmic,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Linear => 0,
Self::Logarithmic => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum InputMethodAction {
Unspecified,
None,
Go,
Search,
Send,
Next,
Done,
Previous,
Newline,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! InputMethodActionUnknown {
() => {
_
};
}
impl InputMethodAction {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unspecified),
1 => Some(Self::None),
2 => Some(Self::Go),
3 => Some(Self::Search),
4 => Some(Self::Send),
5 => Some(Self::Next),
6 => Some(Self::Done),
7 => Some(Self::Previous),
8 => Some(Self::Newline),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Go,
3 => Self::Search,
4 => Self::Send,
5 => Self::Next,
6 => Self::Done,
7 => Self::Previous,
8 => Self::Newline,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0x0 }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Unspecified => 0,
Self::None => 1,
Self::Go => 2,
Self::Search => 3,
Self::Send => 4,
Self::Next => 5,
Self::Done => 6,
Self::Previous => 7,
Self::Newline => 8,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum KeyboardEventPhase {
Pressed,
Released,
Cancelled,
Repeat,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! KeyboardEventPhaseUnknown {
() => {
_
};
}
impl KeyboardEventPhase {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Pressed),
1 => Some(Self::Released),
2 => Some(Self::Cancelled),
3 => Some(Self::Repeat),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Pressed,
1 => Self::Released,
2 => Self::Cancelled,
3 => Self::Repeat,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Pressed => 0,
Self::Released => 1,
Self::Cancelled => 2,
Self::Repeat => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum KeyboardType {
Text,
Number,
Phone,
Datetime,
Multiline,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! KeyboardTypeUnknown {
() => {
_
};
}
impl KeyboardType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Text),
1 => Some(Self::Number),
2 => Some(Self::Phone),
3 => Some(Self::Datetime),
4 => Some(Self::Multiline),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Text,
1 => Self::Number,
2 => Self::Phone,
3 => Self::Datetime,
4 => Self::Multiline,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0x0 }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Text => 0,
Self::Number => 1,
Self::Phone => 2,
Self::Datetime => 3,
Self::Multiline => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PointerEventPhase {
Add = 0,
Hover = 1,
Down = 2,
Move = 3,
Up = 4,
Remove = 5,
Cancel = 6,
}
impl PointerEventPhase {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Add),
1 => Some(Self::Hover),
2 => Some(Self::Down),
3 => Some(Self::Move),
4 => Some(Self::Up),
5 => Some(Self::Remove),
6 => Some(Self::Cancel),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PointerEventType {
Touch = 0,
Stylus = 1,
InvertedStylus = 2,
Mouse = 3,
}
impl PointerEventType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Touch),
1 => Some(Self::Stylus),
2 => Some(Self::InvertedStylus),
3 => Some(Self::Mouse),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum SensorLocation {
Unknown,
Base,
Lid,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! SensorLocationUnknown {
() => {
_
};
}
impl SensorLocation {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unknown),
1 => Some(Self::Base),
2 => Some(Self::Lid),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Unknown,
1 => Self::Base,
2 => Self::Lid,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Unknown => 0,
Self::Base => 1,
Self::Lid => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum SensorType {
Accelerometer,
Gyroscope,
Magnetometer,
Lightmeter,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! SensorTypeUnknown {
() => {
_
};
}
impl SensorType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Accelerometer),
1 => Some(Self::Gyroscope),
2 => Some(Self::Magnetometer),
3 => Some(Self::Lightmeter),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Accelerometer,
1 => Self::Gyroscope,
2 => Self::Magnetometer,
3 => Self::Lightmeter,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Accelerometer => 0,
Self::Gyroscope => 1,
Self::Magnetometer => 2,
Self::Lightmeter => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum TextAffinity {
Upstream = 0,
Downstream = 1,
}
impl TextAffinity {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Upstream),
1 => Some(Self::Downstream),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Axis {
pub range: Range,
pub resolution: i32,
pub scale: AxisScale,
}
impl fidl::Persistable for Axis {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AxisF {
pub range: RangeF,
pub resolution: f32,
pub scale: AxisScale,
}
impl fidl::Persistable for AxisF {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceDescriptor {
pub device_info: Option<Box<DeviceInfo>>,
pub keyboard: Option<Box<KeyboardDescriptor>>,
pub media_buttons: Option<Box<MediaButtonsDescriptor>>,
pub mouse: Option<Box<MouseDescriptor>>,
pub stylus: Option<Box<StylusDescriptor>>,
pub touchscreen: Option<Box<TouchscreenDescriptor>>,
pub sensor: Option<Box<SensorDescriptor>>,
}
impl fidl::Persistable for DeviceDescriptor {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceInfo {
pub vendor_id: u32,
pub product_id: u32,
pub version: u32,
pub name: String,
}
impl fidl::Persistable for DeviceInfo {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FocusEvent {
pub event_time: u64,
pub focused: bool,
}
impl fidl::Persistable for FocusEvent {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ImeServiceGetInputMethodEditorRequest {
pub keyboard_type: KeyboardType,
pub action: InputMethodAction,
pub initial_state: TextInputState,
pub client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
pub editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
}
impl fidl::Standalone for ImeServiceGetInputMethodEditorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputDeviceDispatchReportRequest {
pub report: InputReport,
}
impl fidl::Persistable for InputDeviceDispatchReportRequest {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct InputMethodEditorClientDidUpdateStateRequest {
pub state: TextInputState,
pub event: Option<Box<InputEvent>>,
}
impl fidl::Persistable for InputMethodEditorClientDidUpdateStateRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputMethodEditorClientOnActionRequest {
pub action: InputMethodAction,
}
impl fidl::Persistable for InputMethodEditorClientOnActionRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct InputMethodEditorDispatchKey3Request {
pub event: fidl_fuchsia_ui_input3::KeyEvent,
}
impl fidl::Persistable for InputMethodEditorDispatchKey3Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputMethodEditorDispatchKey3Response {
pub handled: bool,
}
impl fidl::Persistable for InputMethodEditorDispatchKey3Response {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct InputMethodEditorInjectInputRequest {
pub event: InputEvent,
}
impl fidl::Persistable for InputMethodEditorInjectInputRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputMethodEditorSetKeyboardTypeRequest {
pub keyboard_type: KeyboardType,
}
impl fidl::Persistable for InputMethodEditorSetKeyboardTypeRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputMethodEditorSetStateRequest {
pub state: TextInputState,
}
impl fidl::Persistable for InputMethodEditorSetStateRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputReport {
pub event_time: u64,
pub keyboard: Option<Box<KeyboardReport>>,
pub media_buttons: Option<Box<MediaButtonsReport>>,
pub mouse: Option<Box<MouseReport>>,
pub stylus: Option<Box<StylusReport>>,
pub touchscreen: Option<Box<TouchscreenReport>>,
pub sensor: Option<Box<SensorReport>>,
pub trace_id: u64,
}
impl fidl::Persistable for InputReport {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyboardDescriptor {
pub keys: Vec<u32>,
}
impl fidl::Persistable for KeyboardDescriptor {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyboardEvent {
pub event_time: u64,
pub device_id: u32,
pub phase: KeyboardEventPhase,
pub hid_usage: u32,
pub code_point: u32,
pub modifiers: u32,
}
impl fidl::Persistable for KeyboardEvent {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyboardReport {
pub pressed_keys: Vec<u32>,
}
impl fidl::Persistable for KeyboardReport {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MediaButtonsDescriptor {
pub buttons: u32,
}
impl fidl::Persistable for MediaButtonsDescriptor {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MediaButtonsReport {
pub volume_up: bool,
pub volume_down: bool,
pub mic_mute: bool,
pub reset: bool,
pub pause: bool,
pub camera_disable: bool,
}
impl fidl::Persistable for MediaButtonsReport {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MouseDescriptor {
pub rel_x: Axis,
pub rel_y: Axis,
pub vscroll: Option<Box<Axis>>,
pub hscroll: Option<Box<Axis>>,
pub buttons: u32,
}
impl fidl::Persistable for MouseDescriptor {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MouseReport {
pub rel_x: i32,
pub rel_y: i32,
pub rel_hscroll: i32,
pub rel_vscroll: i32,
pub pressed_buttons: u32,
}
impl fidl::Persistable for MouseReport {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct PointerEvent {
pub event_time: u64,
pub device_id: u32,
pub pointer_id: u32,
pub type_: PointerEventType,
pub phase: PointerEventPhase,
pub x: f32,
pub y: f32,
pub radius_major: f32,
pub radius_minor: f32,
pub buttons: u32,
}
impl fidl::Persistable for PointerEvent {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Range {
pub min: i32,
pub max: i32,
}
impl fidl::Persistable for Range {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct RangeF {
pub min: f32,
pub max: f32,
}
impl fidl::Persistable for RangeF {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SendKeyboardInputCmd {
pub compositor_id: u32,
pub keyboard_event: KeyboardEvent,
}
impl fidl::Persistable for SendKeyboardInputCmd {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct SendPointerInputCmd {
pub compositor_id: u32,
pub pointer_event: PointerEvent,
}
impl fidl::Persistable for SendPointerInputCmd {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SensorDescriptor {
pub type_: SensorType,
pub loc: SensorLocation,
pub min_sampling_freq: u32,
pub max_sampling_freq: u32,
pub fifo_max_event_count: u32,
pub phys_min: i32,
pub phys_max: i32,
}
impl fidl::Persistable for SensorDescriptor {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SetHardKeyboardDeliveryCmd {
pub delivery_request: bool,
}
impl fidl::Persistable for SetHardKeyboardDeliveryCmd {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SetParallelDispatchCmd {
pub parallel_dispatch: bool,
}
impl fidl::Persistable for SetParallelDispatchCmd {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StylusDescriptor {
pub x: Axis,
pub y: Axis,
pub pressure: Option<Box<Axis>>,
pub is_invertible: bool,
pub buttons: u32,
}
impl fidl::Persistable for StylusDescriptor {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StylusReport {
pub x: i32,
pub y: i32,
pub pressure: u32,
pub is_in_contact: bool,
pub in_range: bool,
pub is_inverted: bool,
pub pressed_buttons: u32,
}
impl fidl::Persistable for StylusReport {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TextInputState {
pub revision: u32,
pub text: String,
pub selection: TextSelection,
pub composing: TextRange,
}
impl fidl::Persistable for TextInputState {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct TextRange {
pub start: i64,
pub end: i64,
}
impl fidl::Persistable for TextRange {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TextSelection {
pub base: i64,
pub extent: i64,
pub affinity: TextAffinity,
}
impl fidl::Persistable for TextSelection {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Touch {
pub finger_id: u32,
pub x: i32,
pub y: i32,
pub width: u32,
pub height: u32,
}
impl fidl::Persistable for Touch {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TouchscreenDescriptor {
pub x: Axis,
pub y: Axis,
pub max_finger_id: u32,
}
impl fidl::Persistable for TouchscreenDescriptor {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TouchscreenReport {
pub touches: Vec<Touch>,
}
impl fidl::Persistable for TouchscreenReport {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MediaButtonsEvent {
pub volume: Option<i8>,
pub mic_mute: Option<bool>,
pub pause: Option<bool>,
pub camera_disable: Option<bool>,
pub power: Option<bool>,
pub function: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for MediaButtonsEvent {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub enum Command {
SendKeyboardInput(SendKeyboardInputCmd),
SendPointerInput(SendPointerInputCmd),
SetHardKeyboardDelivery(SetHardKeyboardDeliveryCmd),
SetParallelDispatch(SetParallelDispatchCmd),
}
impl Command {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::SendKeyboardInput(_) => 1,
Self::SendPointerInput(_) => 2,
Self::SetHardKeyboardDelivery(_) => 3,
Self::SetParallelDispatch(_) => 4,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Command {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub enum InputEvent {
Pointer(PointerEvent),
Keyboard(KeyboardEvent),
Focus(FocusEvent),
}
impl InputEvent {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Pointer(_) => 1,
Self::Keyboard(_) => 2,
Self::Focus(_) => 3,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for InputEvent {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum SensorReport {
Vector([i16; 3]),
Scalar(u16),
}
impl SensorReport {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Vector(_) => 1,
Self::Scalar(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for SensorReport {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ImeServiceMarker;
impl fidl::endpoints::ProtocolMarker for ImeServiceMarker {
type Proxy = ImeServiceProxy;
type RequestStream = ImeServiceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ImeServiceSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.input.ImeService";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ImeServiceMarker {}
pub trait ImeServiceProxyInterface: Send + Sync {
fn r#get_input_method_editor(
&self,
keyboard_type: KeyboardType,
action: InputMethodAction,
initial_state: &TextInputState,
client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
) -> Result<(), fidl::Error>;
fn r#show_keyboard(&self) -> Result<(), fidl::Error>;
fn r#hide_keyboard(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ImeServiceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ImeServiceSynchronousProxy {
type Proxy = ImeServiceProxy;
type Protocol = ImeServiceMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ImeServiceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<ImeServiceEvent, fidl::Error> {
ImeServiceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_input_method_editor(
&self,
mut keyboard_type: KeyboardType,
mut action: InputMethodAction,
mut initial_state: &TextInputState,
mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ImeServiceGetInputMethodEditorRequest>(
(keyboard_type, action, initial_state, client, editor),
0x148d2e42a1f461fc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x38ed2a1de28cfcf0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7667f098198d09fd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ImeServiceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ImeServiceProxy {
type Protocol = ImeServiceMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ImeServiceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ImeServiceEventStream {
ImeServiceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_input_method_editor(
&self,
mut keyboard_type: KeyboardType,
mut action: InputMethodAction,
mut initial_state: &TextInputState,
mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
) -> Result<(), fidl::Error> {
ImeServiceProxyInterface::r#get_input_method_editor(
self,
keyboard_type,
action,
initial_state,
client,
editor,
)
}
pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
ImeServiceProxyInterface::r#show_keyboard(self)
}
pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
ImeServiceProxyInterface::r#hide_keyboard(self)
}
}
impl ImeServiceProxyInterface for ImeServiceProxy {
fn r#get_input_method_editor(
&self,
mut keyboard_type: KeyboardType,
mut action: InputMethodAction,
mut initial_state: &TextInputState,
mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ImeServiceGetInputMethodEditorRequest>(
(keyboard_type, action, initial_state, client, editor),
0x148d2e42a1f461fc,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x38ed2a1de28cfcf0,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7667f098198d09fd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ImeServiceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ImeServiceEventStream {}
impl futures::stream::FusedStream for ImeServiceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ImeServiceEventStream {
type Item = Result<ImeServiceEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ImeServiceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ImeServiceEvent {}
impl ImeServiceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ImeServiceEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ImeServiceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ImeServiceRequestStream {}
impl futures::stream::FusedStream for ImeServiceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ImeServiceRequestStream {
type Protocol = ImeServiceMarker;
type ControlHandle = ImeServiceControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ImeServiceControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ImeServiceRequestStream {
type Item = Result<ImeServiceRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ImeServiceRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x148d2e42a1f461fc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ImeServiceGetInputMethodEditorRequest);
fidl::encoding::Decoder::decode_into::<ImeServiceGetInputMethodEditorRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
Ok(ImeServiceRequest::GetInputMethodEditor {
keyboard_type: req.keyboard_type,
action: req.action,
initial_state: req.initial_state,
client: req.client,
editor: req.editor,
control_handle,
})
}
0x38ed2a1de28cfcf0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
Ok(ImeServiceRequest::ShowKeyboard { control_handle })
}
0x7667f098198d09fd => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
Ok(ImeServiceRequest::HideKeyboard { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ImeServiceRequest {
GetInputMethodEditor {
keyboard_type: KeyboardType,
action: InputMethodAction,
initial_state: TextInputState,
client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
control_handle: ImeServiceControlHandle,
},
ShowKeyboard {
control_handle: ImeServiceControlHandle,
},
HideKeyboard {
control_handle: ImeServiceControlHandle,
},
}
impl ImeServiceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_input_method_editor(
self,
) -> Option<(
KeyboardType,
InputMethodAction,
TextInputState,
fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
ImeServiceControlHandle,
)> {
if let ImeServiceRequest::GetInputMethodEditor {
keyboard_type,
action,
initial_state,
client,
editor,
control_handle,
} = self
{
Some((keyboard_type, action, initial_state, client, editor, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_show_keyboard(self) -> Option<(ImeServiceControlHandle)> {
if let ImeServiceRequest::ShowKeyboard { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_hide_keyboard(self) -> Option<(ImeServiceControlHandle)> {
if let ImeServiceRequest::HideKeyboard { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ImeServiceRequest::GetInputMethodEditor { .. } => "get_input_method_editor",
ImeServiceRequest::ShowKeyboard { .. } => "show_keyboard",
ImeServiceRequest::HideKeyboard { .. } => "hide_keyboard",
}
}
}
#[derive(Debug, Clone)]
pub struct ImeServiceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ImeServiceControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl ImeServiceControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InputDeviceMarker;
impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
type Proxy = InputDeviceProxy;
type RequestStream = InputDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InputDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) InputDevice";
}
pub trait InputDeviceProxyInterface: Send + Sync {
fn r#dispatch_report(&self, report: &InputReport) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InputDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
type Proxy = InputDeviceProxy;
type Protocol = InputDeviceMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl InputDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<InputDeviceEvent, fidl::Error> {
InputDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
self.client.send::<InputDeviceDispatchReportRequest>(
(report,),
0x7ee375d01c8e149f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct InputDeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for InputDeviceProxy {
type Protocol = InputDeviceMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl InputDeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InputDeviceEventStream {
InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
InputDeviceProxyInterface::r#dispatch_report(self, report)
}
}
impl InputDeviceProxyInterface for InputDeviceProxy {
fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
self.client.send::<InputDeviceDispatchReportRequest>(
(report,),
0x7ee375d01c8e149f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct InputDeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for InputDeviceEventStream {}
impl futures::stream::FusedStream for InputDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InputDeviceEventStream {
type Item = Result<InputDeviceEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InputDeviceEvent {}
impl InputDeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<InputDeviceEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InputDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for InputDeviceRequestStream {}
impl futures::stream::FusedStream for InputDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
type Protocol = InputDeviceMarker;
type ControlHandle = InputDeviceControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
InputDeviceControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for InputDeviceRequestStream {
type Item = Result<InputDeviceRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled InputDeviceRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7ee375d01c8e149f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputDeviceDispatchReportRequest);
fidl::encoding::Decoder::decode_into::<InputDeviceDispatchReportRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
Ok(InputDeviceRequest::DispatchReport { report: req.report, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum InputDeviceRequest {
DispatchReport { report: InputReport, control_handle: InputDeviceControlHandle },
}
impl InputDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_dispatch_report(self) -> Option<(InputReport, InputDeviceControlHandle)> {
if let InputDeviceRequest::DispatchReport { report, control_handle } = self {
Some((report, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InputDeviceRequest::DispatchReport { .. } => "dispatch_report",
}
}
}
#[derive(Debug, Clone)]
pub struct InputDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl InputDeviceControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InputMethodEditorMarker;
impl fidl::endpoints::ProtocolMarker for InputMethodEditorMarker {
type Proxy = InputMethodEditorProxy;
type RequestStream = InputMethodEditorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InputMethodEditorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditor";
}
pub trait InputMethodEditorProxyInterface: Send + Sync {
fn r#set_keyboard_type(&self, keyboard_type: KeyboardType) -> Result<(), fidl::Error>;
fn r#set_state(&self, state: &TextInputState) -> Result<(), fidl::Error>;
fn r#inject_input(&self, event: &InputEvent) -> Result<(), fidl::Error>;
type DispatchKey3ResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
fn r#dispatch_key3(
&self,
event: &fidl_fuchsia_ui_input3::KeyEvent,
) -> Self::DispatchKey3ResponseFut;
fn r#show(&self) -> Result<(), fidl::Error>;
fn r#hide(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InputMethodEditorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InputMethodEditorSynchronousProxy {
type Proxy = InputMethodEditorProxy;
type Protocol = InputMethodEditorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl InputMethodEditorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<InputMethodEditorEvent, fidl::Error> {
InputMethodEditorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
(keyboard_type,),
0x14fe60e927d7d487,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorSetStateRequest>(
(state,),
0x12b477b779818f45,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorInjectInputRequest>(
(event,),
0x34af74618a4f82b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#dispatch_key3(
&self,
mut event: &fidl_fuchsia_ui_input3::KeyEvent,
___deadline: zx::MonotonicTime,
) -> Result<bool, fidl::Error> {
let _response = self.client.send_query::<
InputMethodEditorDispatchKey3Request,
InputMethodEditorDispatchKey3Response,
>(
(event,),
0x2e13667c827209ac,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.handled)
}
pub fn r#show(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x19ba00ba1beb002e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#hide(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x283e0cd73f0d6d9e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct InputMethodEditorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for InputMethodEditorProxy {
type Protocol = InputMethodEditorMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl InputMethodEditorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InputMethodEditorEventStream {
InputMethodEditorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
InputMethodEditorProxyInterface::r#set_keyboard_type(self, keyboard_type)
}
pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
InputMethodEditorProxyInterface::r#set_state(self, state)
}
pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
InputMethodEditorProxyInterface::r#inject_input(self, event)
}
pub fn r#dispatch_key3(
&self,
mut event: &fidl_fuchsia_ui_input3::KeyEvent,
) -> fidl::client::QueryResponseFut<bool> {
InputMethodEditorProxyInterface::r#dispatch_key3(self, event)
}
pub fn r#show(&self) -> Result<(), fidl::Error> {
InputMethodEditorProxyInterface::r#show(self)
}
pub fn r#hide(&self) -> Result<(), fidl::Error> {
InputMethodEditorProxyInterface::r#hide(self)
}
}
impl InputMethodEditorProxyInterface for InputMethodEditorProxy {
fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
(keyboard_type,),
0x14fe60e927d7d487,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorSetStateRequest>(
(state,),
0x12b477b779818f45,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorInjectInputRequest>(
(event,),
0x34af74618a4f82b,
fidl::encoding::DynamicFlags::empty(),
)
}
type DispatchKey3ResponseFut = fidl::client::QueryResponseFut<bool>;
fn r#dispatch_key3(
&self,
mut event: &fidl_fuchsia_ui_input3::KeyEvent,
) -> Self::DispatchKey3ResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
InputMethodEditorDispatchKey3Response,
0x2e13667c827209ac,
>(_buf?)?;
Ok(_response.handled)
}
self.client.send_query_and_decode::<InputMethodEditorDispatchKey3Request, bool>(
(event,),
0x2e13667c827209ac,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#show(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x19ba00ba1beb002e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#hide(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x283e0cd73f0d6d9e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct InputMethodEditorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for InputMethodEditorEventStream {}
impl futures::stream::FusedStream for InputMethodEditorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InputMethodEditorEventStream {
type Item = Result<InputMethodEditorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InputMethodEditorEvent {}
impl InputMethodEditorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<InputMethodEditorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InputMethodEditorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for InputMethodEditorRequestStream {}
impl futures::stream::FusedStream for InputMethodEditorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InputMethodEditorRequestStream {
type Protocol = InputMethodEditorMarker;
type ControlHandle = InputMethodEditorControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
InputMethodEditorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for InputMethodEditorRequestStream {
type Item = Result<InputMethodEditorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled InputMethodEditorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x14fe60e927d7d487 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputMethodEditorSetKeyboardTypeRequest);
fidl::encoding::Decoder::decode_into::<InputMethodEditorSetKeyboardTypeRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::SetKeyboardType {
keyboard_type: req.keyboard_type,
control_handle,
})
}
0x12b477b779818f45 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputMethodEditorSetStateRequest);
fidl::encoding::Decoder::decode_into::<InputMethodEditorSetStateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::SetState { state: req.state, control_handle })
}
0x34af74618a4f82b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputMethodEditorInjectInputRequest);
fidl::encoding::Decoder::decode_into::<InputMethodEditorInjectInputRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::InjectInput { event: req.event, control_handle })
}
0x2e13667c827209ac => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(InputMethodEditorDispatchKey3Request);
fidl::encoding::Decoder::decode_into::<InputMethodEditorDispatchKey3Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::DispatchKey3 {
event: req.event,
responder: InputMethodEditorDispatchKey3Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x19ba00ba1beb002e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::Show { control_handle })
}
0x283e0cd73f0d6d9e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InputMethodEditorControlHandle { inner: this.inner.clone() };
Ok(InputMethodEditorRequest::Hide { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum InputMethodEditorRequest {
SetKeyboardType {
keyboard_type: KeyboardType,
control_handle: InputMethodEditorControlHandle,
},
SetState {
state: TextInputState,
control_handle: InputMethodEditorControlHandle,
},
InjectInput {
event: InputEvent,
control_handle: InputMethodEditorControlHandle,
},
DispatchKey3 {
event: fidl_fuchsia_ui_input3::KeyEvent,
responder: InputMethodEditorDispatchKey3Responder,
},
Show {
control_handle: InputMethodEditorControlHandle,
},
Hide {
control_handle: InputMethodEditorControlHandle,
},
}
impl InputMethodEditorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_keyboard_type(self) -> Option<(KeyboardType, InputMethodEditorControlHandle)> {
if let InputMethodEditorRequest::SetKeyboardType { keyboard_type, control_handle } = self {
Some((keyboard_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_state(self) -> Option<(TextInputState, InputMethodEditorControlHandle)> {
if let InputMethodEditorRequest::SetState { state, control_handle } = self {
Some((state, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_inject_input(self) -> Option<(InputEvent, InputMethodEditorControlHandle)> {
if let InputMethodEditorRequest::InjectInput { event, control_handle } = self {
Some((event, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_dispatch_key3(
self,
) -> Option<(fidl_fuchsia_ui_input3::KeyEvent, InputMethodEditorDispatchKey3Responder)> {
if let InputMethodEditorRequest::DispatchKey3 { event, responder } = self {
Some((event, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_show(self) -> Option<(InputMethodEditorControlHandle)> {
if let InputMethodEditorRequest::Show { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_hide(self) -> Option<(InputMethodEditorControlHandle)> {
if let InputMethodEditorRequest::Hide { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InputMethodEditorRequest::SetKeyboardType { .. } => "set_keyboard_type",
InputMethodEditorRequest::SetState { .. } => "set_state",
InputMethodEditorRequest::InjectInput { .. } => "inject_input",
InputMethodEditorRequest::DispatchKey3 { .. } => "dispatch_key3",
InputMethodEditorRequest::Show { .. } => "show",
InputMethodEditorRequest::Hide { .. } => "hide",
}
}
}
#[derive(Debug, Clone)]
pub struct InputMethodEditorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for InputMethodEditorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl InputMethodEditorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InputMethodEditorDispatchKey3Responder {
control_handle: std::mem::ManuallyDrop<InputMethodEditorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InputMethodEditorDispatchKey3Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InputMethodEditorDispatchKey3Responder {
type ControlHandle = InputMethodEditorControlHandle;
fn control_handle(&self) -> &InputMethodEditorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InputMethodEditorDispatchKey3Responder {
pub fn send(self, mut handled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(handled);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut handled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(handled);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut handled: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<InputMethodEditorDispatchKey3Response>(
(handled,),
self.tx_id,
0x2e13667c827209ac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InputMethodEditorClientMarker;
impl fidl::endpoints::ProtocolMarker for InputMethodEditorClientMarker {
type Proxy = InputMethodEditorClientProxy;
type RequestStream = InputMethodEditorClientRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InputMethodEditorClientSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditorClient";
}
pub trait InputMethodEditorClientProxyInterface: Send + Sync {
fn r#did_update_state(
&self,
state: &TextInputState,
event: Option<&InputEvent>,
) -> Result<(), fidl::Error>;
fn r#on_action(&self, action: InputMethodAction) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InputMethodEditorClientSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InputMethodEditorClientSynchronousProxy {
type Proxy = InputMethodEditorClientProxy;
type Protocol = InputMethodEditorClientMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl InputMethodEditorClientSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<InputMethodEditorClientEvent, fidl::Error> {
InputMethodEditorClientEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#did_update_state(
&self,
mut state: &TextInputState,
mut event: Option<&InputEvent>,
) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
(state, event),
0x26681a6b204b679d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorClientOnActionRequest>(
(action,),
0x19c420f173275398,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct InputMethodEditorClientProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for InputMethodEditorClientProxy {
type Protocol = InputMethodEditorClientMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl InputMethodEditorClientProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InputMethodEditorClientEventStream {
InputMethodEditorClientEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#did_update_state(
&self,
mut state: &TextInputState,
mut event: Option<&InputEvent>,
) -> Result<(), fidl::Error> {
InputMethodEditorClientProxyInterface::r#did_update_state(self, state, event)
}
pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
InputMethodEditorClientProxyInterface::r#on_action(self, action)
}
}
impl InputMethodEditorClientProxyInterface for InputMethodEditorClientProxy {
fn r#did_update_state(
&self,
mut state: &TextInputState,
mut event: Option<&InputEvent>,
) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
(state, event),
0x26681a6b204b679d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
self.client.send::<InputMethodEditorClientOnActionRequest>(
(action,),
0x19c420f173275398,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct InputMethodEditorClientEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for InputMethodEditorClientEventStream {}
impl futures::stream::FusedStream for InputMethodEditorClientEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InputMethodEditorClientEventStream {
type Item = Result<InputMethodEditorClientEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorClientEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InputMethodEditorClientEvent {}
impl InputMethodEditorClientEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<InputMethodEditorClientEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InputMethodEditorClientRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for InputMethodEditorClientRequestStream {}
impl futures::stream::FusedStream for InputMethodEditorClientRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InputMethodEditorClientRequestStream {
type Protocol = InputMethodEditorClientMarker;
type ControlHandle = InputMethodEditorClientControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
InputMethodEditorClientControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for InputMethodEditorClientRequestStream {
type Item = Result<InputMethodEditorClientRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled InputMethodEditorClientRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x26681a6b204b679d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputMethodEditorClientDidUpdateStateRequest);
fidl::encoding::Decoder::decode_into::<InputMethodEditorClientDidUpdateStateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InputMethodEditorClientControlHandle {
inner: this.inner.clone(),
};
Ok(InputMethodEditorClientRequest::DidUpdateState {state: req.state,
event: req.event,
control_handle,
})
}
0x19c420f173275398 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(InputMethodEditorClientOnActionRequest);
fidl::encoding::Decoder::decode_into::<InputMethodEditorClientOnActionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InputMethodEditorClientControlHandle {
inner: this.inner.clone(),
};
Ok(InputMethodEditorClientRequest::OnAction {action: req.action,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum InputMethodEditorClientRequest {
DidUpdateState {
state: TextInputState,
event: Option<Box<InputEvent>>,
control_handle: InputMethodEditorClientControlHandle,
},
OnAction {
action: InputMethodAction,
control_handle: InputMethodEditorClientControlHandle,
},
}
impl InputMethodEditorClientRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_did_update_state(
self,
) -> Option<(TextInputState, Option<Box<InputEvent>>, InputMethodEditorClientControlHandle)>
{
if let InputMethodEditorClientRequest::DidUpdateState { state, event, control_handle } =
self
{
Some((state, event, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_action(
self,
) -> Option<(InputMethodAction, InputMethodEditorClientControlHandle)> {
if let InputMethodEditorClientRequest::OnAction { action, control_handle } = self {
Some((action, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InputMethodEditorClientRequest::DidUpdateState { .. } => "did_update_state",
InputMethodEditorClientRequest::OnAction { .. } => "on_action",
}
}
}
#[derive(Debug, Clone)]
pub struct InputMethodEditorClientControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for InputMethodEditorClientControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl InputMethodEditorClientControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AxisScale {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AxisScale {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AxisScale {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AxisScale {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodAction {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodAction {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for InputMethodAction {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodAction {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyboardEventPhase {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardEventPhase {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for KeyboardEventPhase {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyboardEventPhase {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyboardType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for KeyboardType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyboardType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PointerEventPhase {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PointerEventPhase {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for PointerEventPhase {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PointerEventPhase {
#[inline(always)]
fn new_empty() -> Self {
Self::Add
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PointerEventType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PointerEventType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for PointerEventType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PointerEventType {
#[inline(always)]
fn new_empty() -> Self {
Self::Touch
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SensorLocation {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for SensorLocation {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for SensorLocation {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SensorLocation {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SensorType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for SensorType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for SensorType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SensorType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TextAffinity {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for TextAffinity {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for TextAffinity {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TextAffinity {
#[inline(always)]
fn new_empty() -> Self {
Self::Upstream
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Axis {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Axis {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Axis> for &Axis {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Axis>(offset);
fidl::encoding::Encode::<Axis>::encode(
(
<Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
<AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Range>,
T1: fidl::encoding::Encode<i32>,
T2: fidl::encoding::Encode<AxisScale>,
> fidl::encoding::Encode<Axis> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Axis>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Axis {
#[inline(always)]
fn new_empty() -> Self {
Self {
range: fidl::new_empty!(Range),
resolution: fidl::new_empty!(i32),
scale: fidl::new_empty!(AxisScale),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Range, &mut self.range, decoder, offset + 0, _depth)?;
fidl::decode!(i32, &mut self.resolution, decoder, offset + 8, _depth)?;
fidl::decode!(AxisScale, &mut self.scale, decoder, offset + 12, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AxisF {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for AxisF {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AxisF> for &AxisF {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AxisF>(offset);
fidl::encoding::Encode::<AxisF>::encode(
(
<RangeF as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
<AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<RangeF>,
T1: fidl::encoding::Encode<f32>,
T2: fidl::encoding::Encode<AxisScale>,
> fidl::encoding::Encode<AxisF> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AxisF>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AxisF {
#[inline(always)]
fn new_empty() -> Self {
Self {
range: fidl::new_empty!(RangeF),
resolution: fidl::new_empty!(f32),
scale: fidl::new_empty!(AxisScale),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(RangeF, &mut self.range, decoder, offset + 0, _depth)?;
fidl::decode!(f32, &mut self.resolution, decoder, offset + 8, _depth)?;
fidl::decode!(AxisScale, &mut self.scale, decoder, offset + 12, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DeviceDescriptor> for &DeviceDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceDescriptor>(offset);
fidl::encoding::Encode::<DeviceDescriptor>::encode(
(
<fidl::encoding::Boxed<DeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_info),
<fidl::encoding::Boxed<KeyboardDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
<fidl::encoding::Boxed<MediaButtonsDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
<fidl::encoding::Boxed<MouseDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
<fidl::encoding::Boxed<StylusDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
<fidl::encoding::Boxed<TouchscreenDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
<fidl::encoding::Boxed<SensorDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>>,
T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>>,
T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>>,
T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>>,
> fidl::encoding::Encode<DeviceDescriptor> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
self.5.encode(encoder, offset + 40, depth)?;
self.6.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>),
keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>),
media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>),
mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>),
stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>),
touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>),
sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Boxed<DeviceInfo>,
&mut self.device_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<KeyboardDescriptor>,
&mut self.keyboard,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MediaButtonsDescriptor>,
&mut self.media_buttons,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MouseDescriptor>,
&mut self.mouse,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<StylusDescriptor>,
&mut self.stylus,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<TouchscreenDescriptor>,
&mut self.touchscreen,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<SensorDescriptor>,
&mut self.sensor,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ValueTypeMarker for DeviceInfo {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DeviceInfo> for &DeviceInfo {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceInfo>(offset);
fidl::encoding::Encode::<DeviceInfo>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.product_id),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<u32>,
T2: fidl::encoding::Encode<u32>,
T3: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
> fidl::encoding::Encode<DeviceInfo> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceInfo>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
vendor_id: fidl::new_empty!(u32),
product_id: fidl::new_empty!(u32),
version: fidl::new_empty!(u32),
name: fidl::new_empty!(fidl::encoding::UnboundedString),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, &mut self.vendor_id, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.product_id, decoder, offset + 4, _depth)?;
fidl::decode!(u32, &mut self.version, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FocusEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for FocusEvent {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FocusEvent> for &FocusEvent {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FocusEvent>(offset);
fidl::encoding::Encode::<FocusEvent>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>, T1: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<FocusEvent> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FocusEvent>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FocusEvent {
#[inline(always)]
fn new_empty() -> Self {
Self { event_time: fidl::new_empty!(u64), focused: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(bool, &mut self.focused, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ImeServiceGetInputMethodEditorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
80
}
}
impl fidl::encoding::ResourceTypeMarker for ImeServiceGetInputMethodEditorRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ImeServiceGetInputMethodEditorRequest>
for &mut ImeServiceGetInputMethodEditorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest>::encode(
(
<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),
<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_state),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.editor),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<KeyboardType>,
T1: fidl::encoding::Encode<InputMethodAction>,
T2: fidl::encoding::Encode<TextInputState>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
>,
T4: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
>,
> fidl::encoding::Encode<ImeServiceGetInputMethodEditorRequest> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 72, depth)?;
self.4.encode(encoder, offset + 76, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ImeServiceGetInputMethodEditorRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
keyboard_type: fidl::new_empty!(KeyboardType),
action: fidl::new_empty!(InputMethodAction),
initial_state: fidl::new_empty!(TextInputState),
client: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
>
),
editor: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(KeyboardType, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
fidl::decode!(InputMethodAction, &mut self.action, decoder, offset + 4, _depth)?;
fidl::decode!(TextInputState, &mut self.initial_state, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
&mut self.client,
decoder,
offset + 72,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
&mut self.editor,
decoder,
offset + 76,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputDeviceDispatchReportRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputDeviceDispatchReportRequest>
for &InputDeviceDispatchReportRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
fidl::encoding::Encode::<InputDeviceDispatchReportRequest>::encode(
(<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<InputReport>>
fidl::encoding::Encode<InputDeviceDispatchReportRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputDeviceDispatchReportRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { report: fidl::new_empty!(InputReport) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputReport, &mut self.report, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientDidUpdateStateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
80
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest>
for &InputMethodEditorClientDidUpdateStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest>::encode(
(
<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
<fidl::encoding::OptionalUnion<InputEvent> as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<TextInputState>,
T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>>,
> fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 64, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorClientDidUpdateStateRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
state: fidl::new_empty!(TextInputState),
event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(TextInputState, &mut self.state, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::OptionalUnion<InputEvent>,
&mut self.event,
decoder,
offset + 64,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientOnActionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorClientOnActionRequest>
for &InputMethodEditorClientOnActionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest>::encode(
(<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<InputMethodAction>>
fidl::encoding::Encode<InputMethodEditorClientOnActionRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorClientOnActionRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { action: fidl::new_empty!(InputMethodAction) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputMethodAction, &mut self.action, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorDispatchKey3Request>
for &InputMethodEditorDispatchKey3Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request>::encode(
(<fidl_fuchsia_ui_input3::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(
&self.event,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3::KeyEvent>>
fidl::encoding::Encode<InputMethodEditorDispatchKey3Request> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorDispatchKey3Request {
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3::KeyEvent) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_ui_input3::KeyEvent,
&mut self.event,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorDispatchKey3Response>
for &InputMethodEditorDispatchKey3Response
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<InputMethodEditorDispatchKey3Response> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorDispatchKey3Response {
#[inline(always)]
fn new_empty() -> Self {
Self { handled: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.handled, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorInjectInputRequest>
for &InputMethodEditorInjectInputRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorInjectInputRequest>::encode(
(<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<InputEvent>>
fidl::encoding::Encode<InputMethodEditorInjectInputRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorInjectInputRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(InputEvent) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputEvent, &mut self.event, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest>
for &InputMethodEditorSetKeyboardTypeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest>::encode(
(<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<KeyboardType>>
fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorSetKeyboardTypeRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { keyboard_type: fidl::new_empty!(KeyboardType) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(KeyboardType, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputMethodEditorSetStateRequest>
for &InputMethodEditorSetStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorSetStateRequest>::encode(
(<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<TextInputState>>
fidl::encoding::Encode<InputMethodEditorSetStateRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputMethodEditorSetStateRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { state: fidl::new_empty!(TextInputState) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(TextInputState, &mut self.state, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
impl fidl::encoding::ValueTypeMarker for InputReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputReport> for &InputReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputReport>(offset);
fidl::encoding::Encode::<InputReport>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
<fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
<fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
<fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
<fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
<fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
<fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>>,
T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>>,
T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>>,
T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>>,
T7: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<InputReport> for (T0, T1, T2, T3, T4, T5, T6, T7)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
self.5.encode(encoder, offset + 40, depth)?;
self.6.encode(encoder, offset + 48, depth)?;
self.7.encode(encoder, offset + 64, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InputReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64),
keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>),
media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>),
mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>),
stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>),
touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>),
sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>),
trace_id: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<KeyboardReport>,
&mut self.keyboard,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MediaButtonsReport>,
&mut self.media_buttons,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MouseReport>,
&mut self.mouse,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<StylusReport>,
&mut self.stylus,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<TouchscreenReport>,
&mut self.touchscreen,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::OptionalUnion<SensorReport>,
&mut self.sensor,
decoder,
offset + 48,
_depth
)?;
fidl::decode!(u64, &mut self.trace_id, decoder, offset + 64, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<KeyboardDescriptor> for &KeyboardDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
fidl::encoding::Encode::<KeyboardDescriptor>::encode(
(
<fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>>>
fidl::encoding::Encode<KeyboardDescriptor> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyboardDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u32>,
&mut self.keys,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<KeyboardEvent> for &KeyboardEvent {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardEvent>(offset);
fidl::encoding::Encode::<KeyboardEvent>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
<KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u32>,
T2: fidl::encoding::Encode<KeyboardEventPhase>,
T3: fidl::encoding::Encode<u32>,
T4: fidl::encoding::Encode<u32>,
T5: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<KeyboardEvent> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardEvent>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
self.4.encode(encoder, offset + 20, depth)?;
self.5.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyboardEvent {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64),
device_id: fidl::new_empty!(u32),
phase: fidl::new_empty!(KeyboardEventPhase),
hid_usage: fidl::new_empty!(u32),
code_point: fidl::new_empty!(u32),
modifiers: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.device_id, decoder, offset + 8, _depth)?;
fidl::decode!(KeyboardEventPhase, &mut self.phase, decoder, offset + 12, _depth)?;
fidl::decode!(u32, &mut self.hid_usage, decoder, offset + 16, _depth)?;
fidl::decode!(u32, &mut self.code_point, decoder, offset + 20, _depth)?;
fidl::decode!(u32, &mut self.modifiers, decoder, offset + 24, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<KeyboardReport> for &KeyboardReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardReport>(offset);
fidl::encoding::Encode::<KeyboardReport>::encode(
(
<fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>>>
fidl::encoding::Encode<KeyboardReport> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyboardReport {
#[inline(always)]
fn new_empty() -> Self {
Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u32>,
&mut self.pressed_keys,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MediaButtonsDescriptor> for &MediaButtonsDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MediaButtonsDescriptor)
.write_unaligned((self as *const MediaButtonsDescriptor).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>> fidl::encoding::Encode<MediaButtonsDescriptor>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MediaButtonsDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self { buttons: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
6
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MediaButtonsReport> for &MediaButtonsReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsReport>(offset);
fidl::encoding::Encode::<MediaButtonsReport>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<bool>,
T1: fidl::encoding::Encode<bool>,
T2: fidl::encoding::Encode<bool>,
T3: fidl::encoding::Encode<bool>,
T4: fidl::encoding::Encode<bool>,
T5: fidl::encoding::Encode<bool>,
> fidl::encoding::Encode<MediaButtonsReport> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
self.3.encode(encoder, offset + 3, depth)?;
self.4.encode(encoder, offset + 4, depth)?;
self.5.encode(encoder, offset + 5, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MediaButtonsReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
volume_up: fidl::new_empty!(bool),
volume_down: fidl::new_empty!(bool),
mic_mute: fidl::new_empty!(bool),
reset: fidl::new_empty!(bool),
pause: fidl::new_empty!(bool),
camera_disable: fidl::new_empty!(bool),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.volume_up, decoder, offset + 0, _depth)?;
fidl::decode!(bool, &mut self.volume_down, decoder, offset + 1, _depth)?;
fidl::decode!(bool, &mut self.mic_mute, decoder, offset + 2, _depth)?;
fidl::decode!(bool, &mut self.reset, decoder, offset + 3, _depth)?;
fidl::decode!(bool, &mut self.pause, decoder, offset + 4, _depth)?;
fidl::decode!(bool, &mut self.camera_disable, decoder, offset + 5, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MouseDescriptor> for &MouseDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MouseDescriptor>(offset);
fidl::encoding::Encode::<MouseDescriptor>::encode(
(
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
<fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
&self.vscroll,
),
<fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
&self.hscroll,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Axis>,
T1: fidl::encoding::Encode<Axis>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>>,
T4: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<MouseDescriptor> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MouseDescriptor>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MouseDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
rel_x: fidl::new_empty!(Axis),
rel_y: fidl::new_empty!(Axis),
vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>),
hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>),
buttons: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Axis, &mut self.rel_x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, &mut self.rel_y, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
&mut self.vscroll,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
&mut self.hscroll,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(u32, &mut self.buttons, decoder, offset + 48, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MouseReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
20
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MouseReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MouseReport> for &MouseReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MouseReport>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<i32>,
T2: fidl::encoding::Encode<i32>,
T3: fidl::encoding::Encode<i32>,
T4: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<MouseReport> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MouseReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MouseReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
rel_x: fidl::new_empty!(i32),
rel_y: fidl::new_empty!(i32),
rel_hscroll: fidl::new_empty!(i32),
rel_vscroll: fidl::new_empty!(i32),
pressed_buttons: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PointerEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for PointerEvent {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<PointerEvent> for &PointerEvent {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PointerEvent>(offset);
fidl::encoding::Encode::<PointerEvent>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
<PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u32>,
T2: fidl::encoding::Encode<u32>,
T3: fidl::encoding::Encode<PointerEventType>,
T4: fidl::encoding::Encode<PointerEventPhase>,
T5: fidl::encoding::Encode<f32>,
T6: fidl::encoding::Encode<f32>,
T7: fidl::encoding::Encode<f32>,
T8: fidl::encoding::Encode<f32>,
T9: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<PointerEvent> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PointerEvent>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
self.4.encode(encoder, offset + 20, depth)?;
self.5.encode(encoder, offset + 24, depth)?;
self.6.encode(encoder, offset + 28, depth)?;
self.7.encode(encoder, offset + 32, depth)?;
self.8.encode(encoder, offset + 36, depth)?;
self.9.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PointerEvent {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64),
device_id: fidl::new_empty!(u32),
pointer_id: fidl::new_empty!(u32),
type_: fidl::new_empty!(PointerEventType),
phase: fidl::new_empty!(PointerEventPhase),
x: fidl::new_empty!(f32),
y: fidl::new_empty!(f32),
radius_major: fidl::new_empty!(f32),
radius_minor: fidl::new_empty!(f32),
buttons: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.device_id, decoder, offset + 8, _depth)?;
fidl::decode!(u32, &mut self.pointer_id, decoder, offset + 12, _depth)?;
fidl::decode!(PointerEventType, &mut self.type_, decoder, offset + 16, _depth)?;
fidl::decode!(PointerEventPhase, &mut self.phase, decoder, offset + 20, _depth)?;
fidl::decode!(f32, &mut self.x, decoder, offset + 24, _depth)?;
fidl::decode!(f32, &mut self.y, decoder, offset + 28, _depth)?;
fidl::decode!(f32, &mut self.radius_major, decoder, offset + 32, _depth)?;
fidl::decode!(f32, &mut self.radius_minor, decoder, offset + 36, _depth)?;
fidl::decode!(u32, &mut self.buttons, decoder, offset + 40, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Range {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for Range {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Range> for &Range {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Range>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>, T1: fidl::encoding::Encode<i32>>
fidl::encoding::Encode<Range> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Range>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Range {
#[inline(always)]
fn new_empty() -> Self {
Self { min: fidl::new_empty!(i32), max: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RangeF {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ValueTypeMarker for RangeF {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RangeF> for &RangeF {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RangeF>(offset);
fidl::encoding::Encode::<RangeF>::encode(
(
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f32>, T1: fidl::encoding::Encode<f32>>
fidl::encoding::Encode<RangeF> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RangeF>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RangeF {
#[inline(always)]
fn new_empty() -> Self {
Self { min: fidl::new_empty!(f32), max: fidl::new_empty!(f32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, &mut self.min, decoder, offset + 0, _depth)?;
fidl::decode!(f32, &mut self.max, decoder, offset + 4, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SendKeyboardInputCmd> for &SendKeyboardInputCmd {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
fidl::encoding::Encode::<SendKeyboardInputCmd>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
<KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
&self.keyboard_event,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<KeyboardEvent>>
fidl::encoding::Encode<SendKeyboardInputCmd> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SendKeyboardInputCmd {
#[inline(always)]
fn new_empty() -> Self {
Self {
compositor_id: fidl::new_empty!(u32),
keyboard_event: fidl::new_empty!(KeyboardEvent),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, &mut self.compositor_id, decoder, offset + 0, _depth)?;
fidl::decode!(KeyboardEvent, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SendPointerInputCmd> for &SendPointerInputCmd {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
fidl::encoding::Encode::<SendPointerInputCmd>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
<PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<PointerEvent>>
fidl::encoding::Encode<SendPointerInputCmd> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SendPointerInputCmd {
#[inline(always)]
fn new_empty() -> Self {
Self {
compositor_id: fidl::new_empty!(u32),
pointer_event: fidl::new_empty!(PointerEvent),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, &mut self.compositor_id, decoder, offset + 0, _depth)?;
fidl::decode!(PointerEvent, &mut self.pointer_event, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
28
}
}
impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SensorDescriptor> for &SensorDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SensorDescriptor>(offset);
fidl::encoding::Encode::<SensorDescriptor>::encode(
(
<SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<SensorType>,
T1: fidl::encoding::Encode<SensorLocation>,
T2: fidl::encoding::Encode<u32>,
T3: fidl::encoding::Encode<u32>,
T4: fidl::encoding::Encode<u32>,
T5: fidl::encoding::Encode<i32>,
T6: fidl::encoding::Encode<i32>,
> fidl::encoding::Encode<SensorDescriptor> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SensorDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
self.5.encode(encoder, offset + 20, depth)?;
self.6.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SensorDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
type_: fidl::new_empty!(SensorType),
loc: fidl::new_empty!(SensorLocation),
min_sampling_freq: fidl::new_empty!(u32),
max_sampling_freq: fidl::new_empty!(u32),
fifo_max_event_count: fidl::new_empty!(u32),
phys_min: fidl::new_empty!(i32),
phys_max: fidl::new_empty!(i32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SensorType, &mut self.type_, decoder, offset + 0, _depth)?;
fidl::decode!(SensorLocation, &mut self.loc, decoder, offset + 4, _depth)?;
fidl::decode!(u32, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
fidl::decode!(u32, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
fidl::decode!(u32, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
fidl::decode!(i32, &mut self.phys_min, decoder, offset + 20, _depth)?;
fidl::decode!(i32, &mut self.phys_max, decoder, offset + 24, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SetHardKeyboardDeliveryCmd> for &SetHardKeyboardDeliveryCmd {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>> fidl::encoding::Encode<SetHardKeyboardDeliveryCmd>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SetHardKeyboardDeliveryCmd {
#[inline(always)]
fn new_empty() -> Self {
Self { delivery_request: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.delivery_request, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SetParallelDispatchCmd> for &SetParallelDispatchCmd {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
fidl::encoding::Encode::<SetParallelDispatchCmd>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>> fidl::encoding::Encode<SetParallelDispatchCmd>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SetParallelDispatchCmd {
#[inline(always)]
fn new_empty() -> Self {
Self { parallel_dispatch: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StylusDescriptor> for &StylusDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusDescriptor>(offset);
fidl::encoding::Encode::<StylusDescriptor>::encode(
(
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
<fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
&self.pressure,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Axis>,
T1: fidl::encoding::Encode<Axis>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>>,
T3: fidl::encoding::Encode<bool>,
T4: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<StylusDescriptor> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusDescriptor>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 44, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StylusDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(Axis),
y: fidl::new_empty!(Axis),
pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>),
is_invertible: fidl::new_empty!(bool),
buttons: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Axis, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, &mut self.y, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
&mut self.pressure,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(bool, &mut self.is_invertible, decoder, offset + 40, _depth)?;
fidl::decode!(u32, &mut self.buttons, decoder, offset + 44, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StylusReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
20
}
}
impl fidl::encoding::ValueTypeMarker for StylusReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StylusReport> for &StylusReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusReport>(offset);
fidl::encoding::Encode::<StylusReport>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<i32>,
T2: fidl::encoding::Encode<u32>,
T3: fidl::encoding::Encode<bool>,
T4: fidl::encoding::Encode<bool>,
T5: fidl::encoding::Encode<bool>,
T6: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<StylusReport> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusReport>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 13, depth)?;
self.5.encode(encoder, offset + 14, depth)?;
self.6.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StylusReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(i32),
y: fidl::new_empty!(i32),
pressure: fidl::new_empty!(u32),
is_in_contact: fidl::new_empty!(bool),
in_range: fidl::new_empty!(bool),
is_inverted: fidl::new_empty!(bool),
pressed_buttons: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xff000000u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(i32, &mut self.y, decoder, offset + 4, _depth)?;
fidl::decode!(u32, &mut self.pressure, decoder, offset + 8, _depth)?;
fidl::decode!(bool, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
fidl::decode!(bool, &mut self.in_range, decoder, offset + 13, _depth)?;
fidl::decode!(bool, &mut self.is_inverted, decoder, offset + 14, _depth)?;
fidl::decode!(u32, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TextInputState {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
}
impl fidl::encoding::ValueTypeMarker for TextInputState {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<TextInputState> for &TextInputState {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextInputState>(offset);
fidl::encoding::Encode::<TextInputState>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.text,
),
<TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
<TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
T2: fidl::encoding::Encode<TextSelection>,
T3: fidl::encoding::Encode<TextRange>,
> fidl::encoding::Encode<TextInputState> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextInputState>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TextInputState {
#[inline(always)]
fn new_empty() -> Self {
Self {
revision: fidl::new_empty!(u32),
text: fidl::new_empty!(fidl::encoding::UnboundedString),
selection: fidl::new_empty!(TextSelection),
composing: fidl::new_empty!(TextRange),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, &mut self.revision, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.text,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(TextSelection, &mut self.selection, decoder, offset + 24, _depth)?;
fidl::decode!(TextRange, &mut self.composing, decoder, offset + 48, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TextRange {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for TextRange {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<TextRange> for &TextRange {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextRange>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i64>, T1: fidl::encoding::Encode<i64>>
fidl::encoding::Encode<TextRange> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TextRange {
#[inline(always)]
fn new_empty() -> Self {
Self { start: fidl::new_empty!(i64), end: fidl::new_empty!(i64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TextSelection {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for TextSelection {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<TextSelection> for &TextSelection {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextSelection>(offset);
fidl::encoding::Encode::<TextSelection>::encode(
(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
<TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i64>,
T1: fidl::encoding::Encode<i64>,
T2: fidl::encoding::Encode<TextAffinity>,
> fidl::encoding::Encode<TextSelection> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextSelection>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TextSelection {
#[inline(always)]
fn new_empty() -> Self {
Self {
base: fidl::new_empty!(i64),
extent: fidl::new_empty!(i64),
affinity: fidl::new_empty!(TextAffinity),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i64, &mut self.base, decoder, offset + 0, _depth)?;
fidl::decode!(i64, &mut self.extent, decoder, offset + 8, _depth)?;
fidl::decode!(TextAffinity, &mut self.affinity, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Touch {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
20
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for Touch {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Touch> for &Touch {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Touch>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<i32>,
T2: fidl::encoding::Encode<i32>,
T3: fidl::encoding::Encode<u32>,
T4: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<Touch> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Touch>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Touch {
#[inline(always)]
fn new_empty() -> Self {
Self {
finger_id: fidl::new_empty!(u32),
x: fidl::new_empty!(i32),
y: fidl::new_empty!(i32),
width: fidl::new_empty!(u32),
height: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
36
}
}
impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<TouchscreenDescriptor> for &TouchscreenDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
fidl::encoding::Encode::<TouchscreenDescriptor>::encode(
(
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
<Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Axis>,
T1: fidl::encoding::Encode<Axis>,
T2: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<TouchscreenDescriptor> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TouchscreenDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(Axis),
y: fidl::new_empty!(Axis),
max_finger_id: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Axis, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, &mut self.y, decoder, offset + 16, _depth)?;
fidl::decode!(u32, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<TouchscreenReport> for &TouchscreenReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenReport>(offset);
fidl::encoding::Encode::<TouchscreenReport>::encode(
(
<fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>>>
fidl::encoding::Encode<TouchscreenReport> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TouchscreenReport {
#[inline(always)]
fn new_empty() -> Self {
Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Touch>,
&mut self.touches,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl MediaButtonsEvent {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.function {
return 6;
}
if let Some(_) = self.power {
return 5;
}
if let Some(_) = self.camera_disable {
return 4;
}
if let Some(_) = self.pause {
return 3;
}
if let Some(_) = self.mic_mute {
return 2;
}
if let Some(_) = self.volume {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MediaButtonsEvent> for &MediaButtonsEvent {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i8>(
self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MediaButtonsEvent {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.volume.get_or_insert_with(|| fidl::new_empty!(i8));
fidl::decode!(i8, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.mic_mute.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.pause.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.camera_disable.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.power.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.function.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Command {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Command {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Command> for &Command {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Command>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Command::SendKeyboardInput(ref val) => {
fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd>(
<SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Command::SendPointerInput(ref val) => {
fidl::encoding::encode_in_envelope::<SendPointerInputCmd>(
<SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
SetHardKeyboardDeliveryCmd,
>(
<SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Command::SetParallelDispatch(ref val) => {
fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd>(
<SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl fidl::encoding::Decode<Self> for Command {
#[inline(always)]
fn new_empty() -> Self {
Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Command::SendKeyboardInput(_) = self {
} else {
*self = Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd));
}
#[allow(irrefutable_let_patterns)]
if let Command::SendKeyboardInput(ref mut val) = self {
fidl::decode!(SendKeyboardInputCmd, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Command::SendPointerInput(_) = self {
} else {
*self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd));
}
#[allow(irrefutable_let_patterns)]
if let Command::SendPointerInput(ref mut val) = self {
fidl::decode!(SendPointerInputCmd, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Command::SetHardKeyboardDelivery(_) = self {
} else {
*self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
SetHardKeyboardDeliveryCmd
));
}
#[allow(irrefutable_let_patterns)]
if let Command::SetHardKeyboardDelivery(ref mut val) = self {
fidl::decode!(
SetHardKeyboardDeliveryCmd,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Command::SetParallelDispatch(_) = self {
} else {
*self =
Command::SetParallelDispatch(fidl::new_empty!(SetParallelDispatchCmd));
}
#[allow(irrefutable_let_patterns)]
if let Command::SetParallelDispatch(ref mut val) = self {
fidl::decode!(SetParallelDispatchCmd, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for InputEvent {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InputEvent> for &InputEvent {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputEvent>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
InputEvent::Pointer(ref val) => fidl::encoding::encode_in_envelope::<PointerEvent>(
<PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
InputEvent::Keyboard(ref val) => {
fidl::encoding::encode_in_envelope::<KeyboardEvent>(
<KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent>(
<FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self> for InputEvent {
#[inline(always)]
fn new_empty() -> Self {
Self::Pointer(fidl::new_empty!(PointerEvent))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let InputEvent::Pointer(_) = self {
} else {
*self = InputEvent::Pointer(fidl::new_empty!(PointerEvent));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Pointer(ref mut val) = self {
fidl::decode!(PointerEvent, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let InputEvent::Keyboard(_) = self {
} else {
*self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Keyboard(ref mut val) = self {
fidl::decode!(KeyboardEvent, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let InputEvent::Focus(_) = self {
} else {
*self = InputEvent::Focus(fidl::new_empty!(FocusEvent));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Focus(ref mut val) = self {
fidl::decode!(FocusEvent, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SensorReport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for SensorReport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SensorReport> for &SensorReport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SensorReport>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Array<i16, 3>,
>(
<fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16>(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self> for SensorReport {
#[inline(always)]
fn new_empty() -> Self {
Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let SensorReport::Vector(_) = self {
} else {
*self =
SensorReport::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>));
}
#[allow(irrefutable_let_patterns)]
if let SensorReport::Vector(ref mut val) = self {
fidl::decode!(fidl::encoding::Array<i16, 3>, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let SensorReport::Scalar(_) = self {
} else {
*self = SensorReport::Scalar(fidl::new_empty!(u16));
}
#[allow(irrefutable_let_patterns)]
if let SensorReport::Scalar(ref mut val) = self {
fidl::decode!(u16, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}