| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)] |
| |
| use bitflags::bitflags; |
| use fidl::client::QueryResponseFut; |
| use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect}; |
| use fidl::endpoints::{ControlHandle as _, Responder as _}; |
| pub use fidl_test_driverhandle__common::*; |
| use futures::future::{self, MaybeDone, TryFutureExt}; |
| use zx_status; |
| |
| #[cfg(feature = "driver")] |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct DriverProtocolMarker; |
| |
| #[cfg(feature = "driver")] |
| impl fidl_driver::endpoints::DriverProtocolMarker for DriverProtocolMarker { |
| const DEBUG_NAME: &'static str = "(anonymous) DriverProtocol"; |
| } |
| |
| #[cfg(feature = "driver")] |
| #[derive(Debug)] |
| pub enum DriverProtocolRequest {} |
| |
| #[cfg(feature = "driver")] |
| impl DriverProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn read_from(bytes: &[u8], _handles: &mut [zx::HandleInfo]) -> Result<Self, fidl::Error> { |
| let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| match header.ordinal { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: <DriverProtocolMarker as fidl_driver::endpoints::DriverProtocolMarker>::DEBUG_NAME |
| }), |
| } |
| } |
| |
| pub fn read_from_message( |
| mut message: fdf::Message<[u8]>, |
| ) -> Result<(fdf::Arena, Self), fidl::Error> { |
| let (arena, Some(body), Some(handles)) = message.take_arena_boxes() else { |
| return Err(fidl::Error::Invalid); |
| }; |
| let mut handles = arena.try_insert_from_iter( |
| handles |
| .into_iter() |
| .map(|handle| unsafe { fidl_driver::encoding::mixed_into_handle_info(handle) }), |
| ); |
| let res = match handles { |
| Ok(ref mut handles) => Self::read_from(&*body, handles)?, |
| Err(_) => return Err(fidl::Error::Invalid), |
| }; |
| std::mem::drop((body, handles)); |
| Ok((message.take_arena(), res)) |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self {} |
| } |
| } |
| |
| /// Like [`DriverProtocolRequest::read_from_message`] except it drops the [`Arena`]. |
| #[cfg(feature = "driver")] |
| impl std::convert::TryFrom<fdf::Message<[u8]>> for DriverProtocolRequest { |
| type Error = fidl::Error; |
| fn try_from(msg: fdf::Message<[u8]>) -> Result<DriverProtocolRequest, fidl::Error> { |
| Ok(DriverProtocolRequest::read_from_message(msg)?.1) |
| } |
| } |
| |
| mod internal { |
| use super::*; |
| } |