#![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 futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
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>,
pub device_id: Option<u32>,
#[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::MonotonicInstant,
) -> 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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().as_ref().signal_peer(clear_mask, set_mask)
}
}
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::MonotonicInstant,
) -> 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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().as_ref().signal_peer(clear_mask, set_mask)
}
}
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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().as_ref().signal_peer(clear_mask, set_mask)
}
}
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::MonotonicInstant,
) -> 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::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().as_ref().signal_peer(clear_mask, set_mask)
}
}
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AxisScale {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisScale {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for InputMethodAction
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputMethodAction {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for KeyboardEventPhase
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEventPhase {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyboardType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for PointerEventPhase
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventPhase {
#[inline(always)]
fn new_empty() -> Self {
Self::Add
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for PointerEventType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventType {
#[inline(always)]
fn new_empty() -> Self {
Self::Touch
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorLocation {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorLocation {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TextAffinity {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextAffinity {
#[inline(always)]
fn new_empty() -> Self {
Self::Upstream
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for Axis {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Axis>(offset);
fidl::encoding::Encode::<Axis, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Range, D>,
T1: fidl::encoding::Encode<i32, D>,
T2: fidl::encoding::Encode<AxisScale, D>,
> fidl::encoding::Encode<Axis, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
#[inline(always)]
fn new_empty() -> Self {
Self {
range: fidl::new_empty!(Range, D),
resolution: fidl::new_empty!(i32, D),
scale: fidl::new_empty!(AxisScale, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
fidl::decode!(i32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AxisF {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AxisF, D> for &AxisF {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AxisF>(offset);
fidl::encoding::Encode::<AxisF, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<RangeF, D>,
T1: fidl::encoding::Encode<f32, D>,
T2: fidl::encoding::Encode<AxisScale, D>,
> fidl::encoding::Encode<AxisF, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisF {
#[inline(always)]
fn new_empty() -> Self {
Self {
range: fidl::new_empty!(RangeF, D),
resolution: fidl::new_empty!(f32, D),
scale: fidl::new_empty!(AxisScale, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(RangeF, D, &mut self.range, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
for &DeviceDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceDescriptor>(offset);
fidl::encoding::Encode::<DeviceDescriptor, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>, D>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>, D>,
T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>, D>,
T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>, D>,
T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>, D>,
> fidl::encoding::Encode<DeviceDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>, D),
keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>, D),
media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>, D),
mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>, D),
stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>, D),
touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>, D),
sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Boxed<DeviceInfo>,
D,
&mut self.device_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<KeyboardDescriptor>,
D,
&mut self.keyboard,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MediaButtonsDescriptor>,
D,
&mut self.media_buttons,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MouseDescriptor>,
D,
&mut self.mouse,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<StylusDescriptor>,
D,
&mut self.stylus,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<TouchscreenDescriptor>,
D,
&mut self.touchscreen,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<SensorDescriptor>,
D,
&mut self.sensor,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
for &DeviceInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceInfo>(offset);
fidl::encoding::Encode::<DeviceInfo, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
vendor_id: fidl::new_empty!(u32, D),
product_id: fidl::new_empty!(u32, D),
version: fidl::new_empty!(u32, D),
name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.product_id, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.version, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FocusEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FocusEvent, D>
for &FocusEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FocusEvent>(offset);
fidl::encoding::Encode::<FocusEvent, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<FocusEvent, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FocusEvent {
#[inline(always)]
fn new_empty() -> Self {
Self { event_time: fidl::new_empty!(u64, D), focused: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.focused, decoder, offset + 8, _depth)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
ImeServiceGetInputMethodEditorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ImeServiceGetInputMethodEditorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::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, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
InputMethodAction,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<TextInputState, fidl::encoding::DefaultFuchsiaResourceDialect>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T4: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ImeServiceGetInputMethodEditorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ImeServiceGetInputMethodEditorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
keyboard_type: fidl::new_empty!(
KeyboardType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
action: fidl::new_empty!(
InputMethodAction,
fidl::encoding::DefaultFuchsiaResourceDialect
),
initial_state: fidl::new_empty!(
TextInputState,
fidl::encoding::DefaultFuchsiaResourceDialect
),
client: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
editor: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
KeyboardType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.keyboard_type,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
InputMethodAction,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.action,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
TextInputState,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.initial_state,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.client,
decoder,
offset + 72,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.editor,
decoder,
offset + 76,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputDeviceDispatchReportRequest, D>
for &InputDeviceDispatchReportRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
fidl::encoding::Encode::<InputDeviceDispatchReportRequest, D>::encode(
(<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
fidl::encoding::Encode<InputDeviceDispatchReportRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputDeviceDispatchReportRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { report: fidl::new_empty!(InputReport, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D>
for &InputMethodEditorClientDidUpdateStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<TextInputState, D>,
T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>, D>,
> fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorClientDidUpdateStateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
state: fidl::new_empty!(TextInputState, D),
event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::OptionalUnion<InputEvent>,
D,
&mut self.event,
decoder,
offset + 64,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D>
for &InputMethodEditorClientOnActionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest, D>::encode(
(<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputMethodAction, D>>
fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorClientOnActionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { action: fidl::new_empty!(InputMethodAction, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
for &InputMethodEditorDispatchKey3Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
(<fidl_fuchsia_ui_input3::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(
&self.event,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3::KeyEvent, D>,
> fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorDispatchKey3Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3::KeyEvent, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_ui_input3::KeyEvent,
D,
&mut self.event,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
for &InputMethodEditorDispatchKey3Response
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorDispatchKey3Response
{
#[inline(always)]
fn new_empty() -> Self {
Self { handled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
for &InputMethodEditorInjectInputRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
(<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorInjectInputRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(InputEvent, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
for &InputMethodEditorSetKeyboardTypeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
(<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorSetKeyboardTypeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
for &InputMethodEditorSetStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
(<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InputMethodEditorSetStateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { state: fidl::new_empty!(TextInputState, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InputReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
for &InputReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputReport>(offset);
fidl::encoding::Encode::<InputReport, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
T7: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64, D),
keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
trace_id: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<KeyboardReport>,
D,
&mut self.keyboard,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MediaButtonsReport>,
D,
&mut self.media_buttons,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<MouseReport>,
D,
&mut self.mouse,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<StylusReport>,
D,
&mut self.stylus,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<TouchscreenReport>,
D,
&mut self.touchscreen,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::OptionalUnion<SensorReport>,
D,
&mut self.sensor,
decoder,
offset + 48,
_depth
)?;
fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
for &KeyboardDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
(
<fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
> fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u32>,
D,
&mut self.keys,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
for &KeyboardEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardEvent>(offset);
fidl::encoding::Encode::<KeyboardEvent, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64, D),
device_id: fidl::new_empty!(u32, D),
phase: fidl::new_empty!(KeyboardEventPhase, D),
hid_usage: fidl::new_empty!(u32, D),
code_point: fidl::new_empty!(u32, D),
modifiers: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyboardReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
for &KeyboardReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardReport>(offset);
fidl::encoding::Encode::<KeyboardReport, D>::encode(
(
<fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
> fidl::encoding::Encode<KeyboardReport, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyboardReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
#[inline(always)]
fn new_empty() -> Self {
Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u32>,
D,
&mut self.pressed_keys,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MediaButtonsDescriptor
{
#[inline(always)]
fn new_empty() -> Self {
Self { buttons: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
for &MediaButtonsReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsReport>(offset);
fidl::encoding::Encode::<MediaButtonsReport, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<bool, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<bool, D>,
T5: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
volume_up: fidl::new_empty!(bool, D),
volume_down: fidl::new_empty!(bool, D),
mic_mute: fidl::new_empty!(bool, D),
reset: fidl::new_empty!(bool, D),
pause: fidl::new_empty!(bool, D),
camera_disable: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
for &MouseDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MouseDescriptor>(offset);
fidl::encoding::Encode::<MouseDescriptor, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Axis, D>,
T1: fidl::encoding::Encode<Axis, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
T4: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
rel_x: fidl::new_empty!(Axis, D),
rel_y: fidl::new_empty!(Axis, D),
vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
buttons: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
D,
&mut self.vscroll,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
D,
&mut self.hscroll,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MouseReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
for &MouseReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<i32, D>,
T2: fidl::encoding::Encode<i32, D>,
T3: fidl::encoding::Encode<i32, D>,
T4: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
rel_x: fidl::new_empty!(i32, D),
rel_y: fidl::new_empty!(i32, D),
rel_hscroll: fidl::new_empty!(i32, D),
rel_vscroll: fidl::new_empty!(i32, D),
pressed_buttons: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for PointerEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
for &PointerEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PointerEvent>(offset);
fidl::encoding::Encode::<PointerEvent, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<PointerEventType, D>,
T4: fidl::encoding::Encode<PointerEventPhase, D>,
T5: fidl::encoding::Encode<f32, D>,
T6: fidl::encoding::Encode<f32, D>,
T7: fidl::encoding::Encode<f32, D>,
T8: fidl::encoding::Encode<f32, D>,
T9: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
#[inline(always)]
fn new_empty() -> Self {
Self {
event_time: fidl::new_empty!(u64, D),
device_id: fidl::new_empty!(u32, D),
pointer_id: fidl::new_empty!(u32, D),
type_: fidl::new_empty!(PointerEventType, D),
phase: fidl::new_empty!(PointerEventPhase, D),
x: fidl::new_empty!(f32, D),
y: fidl::new_empty!(f32, D),
radius_major: fidl::new_empty!(f32, D),
radius_minor: fidl::new_empty!(f32, D),
buttons: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.event_time, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Range {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<i32, D>,
> fidl::encoding::Encode<Range, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
#[inline(always)]
fn new_empty() -> Self {
Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for RangeF {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RangeF>(offset);
fidl::encoding::Encode::<RangeF, D>::encode(
(
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f32, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<RangeF, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
#[inline(always)]
fn new_empty() -> Self {
Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
for &SendKeyboardInputCmd
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
<KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
&self.keyboard_event,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<KeyboardEvent, D>,
> fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
#[inline(always)]
fn new_empty() -> Self {
Self {
compositor_id: fidl::new_empty!(u32, D),
keyboard_event: fidl::new_empty!(KeyboardEvent, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
for &SendPointerInputCmd
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
<PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<PointerEvent, D>,
> fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
#[inline(always)]
fn new_empty() -> Self {
Self {
compositor_id: fidl::new_empty!(u32, D),
pointer_event: fidl::new_empty!(PointerEvent, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
for &SensorDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SensorDescriptor>(offset);
fidl::encoding::Encode::<SensorDescriptor, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SensorType, D>,
T1: fidl::encoding::Encode<SensorLocation, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<i32, D>,
T6: fidl::encoding::Encode<i32, D>,
> fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
type_: fidl::new_empty!(SensorType, D),
loc: fidl::new_empty!(SensorLocation, D),
min_sampling_freq: fidl::new_empty!(u32, D),
max_sampling_freq: fidl::new_empty!(u32, D),
fifo_max_event_count: fidl::new_empty!(u32, D),
phys_min: fidl::new_empty!(i32, D),
phys_max: fidl::new_empty!(i32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SetHardKeyboardDeliveryCmd
{
#[inline(always)]
fn new_empty() -> Self {
Self { delivery_request: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SetParallelDispatchCmd
{
#[inline(always)]
fn new_empty() -> Self {
Self { parallel_dispatch: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
for &StylusDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusDescriptor>(offset);
fidl::encoding::Encode::<StylusDescriptor, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Axis, D>,
T1: fidl::encoding::Encode<Axis, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(Axis, D),
y: fidl::new_empty!(Axis, D),
pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
is_invertible: fidl::new_empty!(bool, D),
buttons: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Axis>,
D,
&mut self.pressure,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StylusReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
for &StylusReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StylusReport>(offset);
fidl::encoding::Encode::<StylusReport, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<i32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<bool, D>,
T5: fidl::encoding::Encode<bool, D>,
T6: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(i32, D),
y: fidl::new_empty!(i32, D),
pressure: fidl::new_empty!(u32, D),
is_in_contact: fidl::new_empty!(bool, D),
in_range: fidl::new_empty!(bool, D),
is_inverted: fidl::new_empty!(bool, D),
pressed_buttons: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TextInputState {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
for &TextInputState
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextInputState>(offset);
fidl::encoding::Encode::<TextInputState, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T2: fidl::encoding::Encode<TextSelection, D>,
T3: fidl::encoding::Encode<TextRange, D>,
> fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
#[inline(always)]
fn new_empty() -> Self {
Self {
revision: fidl::new_empty!(u32, D),
text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
selection: fidl::new_empty!(TextSelection, D),
composing: fidl::new_empty!(TextRange, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.revision, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.text,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TextRange {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
for &TextRange
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<TextRange, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
#[inline(always)]
fn new_empty() -> Self {
Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for TextSelection {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
for &TextSelection
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextSelection>(offset);
fidl::encoding::Encode::<TextSelection, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
T2: fidl::encoding::Encode<TextAffinity, D>,
> fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
#[inline(always)]
fn new_empty() -> Self {
Self {
base: fidl::new_empty!(i64, D),
extent: fidl::new_empty!(i64, D),
affinity: fidl::new_empty!(TextAffinity, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D, &mut self.base, decoder, offset + 0, _depth)?;
fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Touch {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<i32, D>,
T2: fidl::encoding::Encode<i32, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
#[inline(always)]
fn new_empty() -> Self {
Self {
finger_id: fidl::new_empty!(u32, D),
x: fidl::new_empty!(i32, D),
y: fidl::new_empty!(i32, D),
width: fidl::new_empty!(u32, D),
height: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
for &TouchscreenDescriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
fidl::encoding::Encode::<TouchscreenDescriptor, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Axis, D>,
T1: fidl::encoding::Encode<Axis, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
x: fidl::new_empty!(Axis, D),
y: fidl::new_empty!(Axis, D),
max_finger_id: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
for &TouchscreenReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenReport>(offset);
fidl::encoding::Encode::<TouchscreenReport, D>::encode(
(
<fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
> fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TouchscreenReport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
#[inline(always)]
fn new_empty() -> Self {
Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Touch>,
D,
&mut self.touches,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl MediaButtonsEvent {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.device_id {
return 7;
}
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
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsEvent, D>
for &MediaButtonsEvent
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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, D>(
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, D>(
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, D>(
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, D>(
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, D>(
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, D>(
self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsEvent {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D));
fidl::decode!(i8, D, 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, D));
fidl::decode!(bool, D, 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, D));
fidl::decode!(bool, D, 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, D));
fidl::decode!(bool, D, 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, D));
fidl::decode!(bool, D, 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, D));
fidl::decode!(bool, D, 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 < 7 {
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 =
<u32 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.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for Command {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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, D>(
<SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Command::SendPointerInput(ref val) => {
fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
<SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
SetHardKeyboardDeliveryCmd,
D,
>(
<SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Command::SetParallelDispatch(ref val) => {
fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
<SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
#[inline(always)]
fn new_empty() -> Self {
Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D));
}
#[allow(irrefutable_let_patterns)]
if let Command::SendKeyboardInput(ref mut val) = self {
fidl::decode!(SendKeyboardInputCmd, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Command::SendPointerInput(ref mut val) = self {
fidl::decode!(SendPointerInputCmd, D, 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,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Command::SetHardKeyboardDelivery(ref mut val) = self {
fidl::decode!(
SetHardKeyboardDeliveryCmd,
D,
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,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Command::SetParallelDispatch(ref mut val) = self {
fidl::decode!(
SetParallelDispatchCmd,
D,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for InputEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
for &InputEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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, D>(
<PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
InputEvent::Keyboard(ref val) => {
fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
<KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
<FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
#[inline(always)]
fn new_empty() -> Self {
Self::Pointer(fidl::new_empty!(PointerEvent, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Pointer(ref mut val) = self {
fidl::decode!(PointerEvent, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Keyboard(ref mut val) = self {
fidl::decode!(KeyboardEvent, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let InputEvent::Focus(ref mut val) = self {
fidl::decode!(FocusEvent, D, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for SensorReport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
for &SensorReport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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>,
D,
>(
<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, D>(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
#[inline(always)]
fn new_empty() -> Self {
Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SensorReport::Vector(ref mut val) = self {
fidl::decode!(fidl::encoding::Array<i16, 3>, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let SensorReport::Scalar(ref mut val) = self {
fidl::decode!(u16, D, 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(())
}
}
}