#![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 _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DevelopmentManagerDisableDriverRequest {
pub driver_url: String,
pub package_hash: Option<String>,
}
impl fidl::Persistable for DevelopmentManagerDisableDriverRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DevelopmentManagerEnableDriverRequest {
pub driver_url: String,
pub package_hash: Option<String>,
}
impl fidl::Persistable for DevelopmentManagerEnableDriverRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DevelopmentManagerGetCompositeNodeSpecsRequest {
pub name_filter: Option<String>,
pub iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DevelopmentManagerGetCompositeNodeSpecsRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DevelopmentManagerGetDriverInfoRequest {
pub driver_filter: Vec<String>,
pub iterator:
fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DevelopmentManagerGetDriverInfoRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct DriverIndexMatchDriverRequest {
pub args: MatchDriverArgs,
}
impl fidl::Persistable for DriverIndexMatchDriverRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DriverIndexRebindCompositeNodeSpecRequest {
pub spec: String,
pub driver_url_suffix: Option<String>,
}
impl fidl::Persistable for DriverIndexRebindCompositeNodeSpecRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DriverIndexSetNotifierRequest {
pub notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DriverIndexSetNotifierRequest
{
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MatchDriverArgs {
pub properties: Option<Vec<fidl_fuchsia_driver_framework::NodeProperty>>,
pub name: Option<String>,
pub driver_url_suffix: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for MatchDriverArgs {}
#[derive(Clone, Debug)]
pub enum MatchDriverResult {
Driver(fidl_fuchsia_driver_framework::DriverInfo),
CompositeParents(Vec<fidl_fuchsia_driver_framework::CompositeParent>),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! MatchDriverResultUnknown {
() => {
_
};
}
impl PartialEq for MatchDriverResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Driver(x), Self::Driver(y)) => *x == *y,
(Self::CompositeParents(x), Self::CompositeParents(y)) => *x == *y,
_ => false,
}
}
}
impl MatchDriverResult {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Driver(_) => 1,
Self::CompositeParents(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for MatchDriverResult {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DevelopmentManagerMarker;
impl fidl::endpoints::ProtocolMarker for DevelopmentManagerMarker {
type Proxy = DevelopmentManagerProxy;
type RequestStream = DevelopmentManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DevelopmentManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.driver.index.DevelopmentManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DevelopmentManagerMarker {}
pub type DevelopmentManagerDisableDriverResult = Result<(), i32>;
pub type DevelopmentManagerEnableDriverResult = Result<(), i32>;
pub trait DevelopmentManagerProxyInterface: Send + Sync {
fn r#get_driver_info(
&self,
driver_filter: &[String],
iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
) -> Result<(), fidl::Error>;
fn r#get_composite_node_specs(
&self,
name_filter: Option<&str>,
iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
) -> Result<(), fidl::Error>;
type DisableDriverResponseFut: std::future::Future<Output = Result<DevelopmentManagerDisableDriverResult, fidl::Error>>
+ Send;
fn r#disable_driver(
&self,
driver_url: &str,
package_hash: Option<&str>,
) -> Self::DisableDriverResponseFut;
type EnableDriverResponseFut: std::future::Future<Output = Result<DevelopmentManagerEnableDriverResult, fidl::Error>>
+ Send;
fn r#enable_driver(
&self,
driver_url: &str,
package_hash: Option<&str>,
) -> Self::EnableDriverResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DevelopmentManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DevelopmentManagerSynchronousProxy {
type Proxy = DevelopmentManagerProxy;
type Protocol = DevelopmentManagerMarker;
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 DevelopmentManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DevelopmentManagerMarker 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<DevelopmentManagerEvent, fidl::Error> {
DevelopmentManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_driver_info(
&self,
mut driver_filter: &[String],
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<DevelopmentManagerGetDriverInfoRequest>(
(driver_filter, iterator),
0x80387b9999b4de2,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_composite_node_specs(
&self,
mut name_filter: Option<&str>,
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<DevelopmentManagerGetCompositeNodeSpecsRequest>(
(name_filter, iterator),
0x6fd4c2f5e0478970,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#disable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
___deadline: zx::MonotonicInstant,
) -> Result<DevelopmentManagerDisableDriverResult, fidl::Error> {
let _response = self.client.send_query::<
DevelopmentManagerDisableDriverRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(driver_url, package_hash,),
0x7a9043fc2acabf77,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#enable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
___deadline: zx::MonotonicInstant,
) -> Result<DevelopmentManagerEnableDriverResult, fidl::Error> {
let _response = self.client.send_query::<
DevelopmentManagerEnableDriverRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(driver_url, package_hash,),
0x4abba8d322e671d9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct DevelopmentManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DevelopmentManagerProxy {
type Protocol = DevelopmentManagerMarker;
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 DevelopmentManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DevelopmentManagerEventStream {
DevelopmentManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_driver_info(
&self,
mut driver_filter: &[String],
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
) -> Result<(), fidl::Error> {
DevelopmentManagerProxyInterface::r#get_driver_info(self, driver_filter, iterator)
}
pub fn r#get_composite_node_specs(
&self,
mut name_filter: Option<&str>,
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
) -> Result<(), fidl::Error> {
DevelopmentManagerProxyInterface::r#get_composite_node_specs(self, name_filter, iterator)
}
pub fn r#disable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
) -> fidl::client::QueryResponseFut<
DevelopmentManagerDisableDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DevelopmentManagerProxyInterface::r#disable_driver(self, driver_url, package_hash)
}
pub fn r#enable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
) -> fidl::client::QueryResponseFut<
DevelopmentManagerEnableDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DevelopmentManagerProxyInterface::r#enable_driver(self, driver_url, package_hash)
}
}
impl DevelopmentManagerProxyInterface for DevelopmentManagerProxy {
fn r#get_driver_info(
&self,
mut driver_filter: &[String],
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<DevelopmentManagerGetDriverInfoRequest>(
(driver_filter, iterator),
0x80387b9999b4de2,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_composite_node_specs(
&self,
mut name_filter: Option<&str>,
mut iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<DevelopmentManagerGetCompositeNodeSpecsRequest>(
(name_filter, iterator),
0x6fd4c2f5e0478970,
fidl::encoding::DynamicFlags::empty(),
)
}
type DisableDriverResponseFut = fidl::client::QueryResponseFut<
DevelopmentManagerDisableDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#disable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
) -> Self::DisableDriverResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DevelopmentManagerDisableDriverResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7a9043fc2acabf77,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
DevelopmentManagerDisableDriverRequest,
DevelopmentManagerDisableDriverResult,
>(
(driver_url, package_hash,),
0x7a9043fc2acabf77,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type EnableDriverResponseFut = fidl::client::QueryResponseFut<
DevelopmentManagerEnableDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#enable_driver(
&self,
mut driver_url: &str,
mut package_hash: Option<&str>,
) -> Self::EnableDriverResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DevelopmentManagerEnableDriverResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4abba8d322e671d9,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
DevelopmentManagerEnableDriverRequest,
DevelopmentManagerEnableDriverResult,
>(
(driver_url, package_hash,),
0x4abba8d322e671d9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DevelopmentManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DevelopmentManagerEventStream {}
impl futures::stream::FusedStream for DevelopmentManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DevelopmentManagerEventStream {
type Item = Result<DevelopmentManagerEvent, 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(DevelopmentManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DevelopmentManagerEvent {}
impl DevelopmentManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DevelopmentManagerEvent, 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:
<DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DevelopmentManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DevelopmentManagerRequestStream {}
impl futures::stream::FusedStream for DevelopmentManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DevelopmentManagerRequestStream {
type Protocol = DevelopmentManagerMarker;
type ControlHandle = DevelopmentManagerControlHandle;
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 {
DevelopmentManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DevelopmentManagerRequestStream {
type Item = Result<DevelopmentManagerRequest, 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 DevelopmentManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x80387b9999b4de2 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DevelopmentManagerGetDriverInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerGetDriverInfoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DevelopmentManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DevelopmentManagerRequest::GetDriverInfo {driver_filter: req.driver_filter,
iterator: req.iterator,
control_handle,
})
}
0x6fd4c2f5e0478970 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DevelopmentManagerGetCompositeNodeSpecsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerGetCompositeNodeSpecsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DevelopmentManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DevelopmentManagerRequest::GetCompositeNodeSpecs {name_filter: req.name_filter,
iterator: req.iterator,
control_handle,
})
}
0x7a9043fc2acabf77 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DevelopmentManagerDisableDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerDisableDriverRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DevelopmentManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DevelopmentManagerRequest::DisableDriver {driver_url: req.driver_url,
package_hash: req.package_hash,
responder: DevelopmentManagerDisableDriverResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4abba8d322e671d9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DevelopmentManagerEnableDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerEnableDriverRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DevelopmentManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DevelopmentManagerRequest::EnableDriver {driver_url: req.driver_url,
package_hash: req.package_hash,
responder: DevelopmentManagerEnableDriverResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DevelopmentManagerRequest {
GetDriverInfo {
driver_filter: Vec<String>,
iterator:
fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
control_handle: DevelopmentManagerControlHandle,
},
GetCompositeNodeSpecs {
name_filter: Option<String>,
iterator: fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
control_handle: DevelopmentManagerControlHandle,
},
DisableDriver {
driver_url: String,
package_hash: Option<String>,
responder: DevelopmentManagerDisableDriverResponder,
},
EnableDriver {
driver_url: String,
package_hash: Option<String>,
responder: DevelopmentManagerEnableDriverResponder,
},
}
impl DevelopmentManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_driver_info(
self,
) -> Option<(
Vec<String>,
fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
DevelopmentManagerControlHandle,
)> {
if let DevelopmentManagerRequest::GetDriverInfo {
driver_filter,
iterator,
control_handle,
} = self
{
Some((driver_filter, iterator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_composite_node_specs(
self,
) -> Option<(
Option<String>,
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
DevelopmentManagerControlHandle,
)> {
if let DevelopmentManagerRequest::GetCompositeNodeSpecs {
name_filter,
iterator,
control_handle,
} = self
{
Some((name_filter, iterator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_disable_driver(
self,
) -> Option<(String, Option<String>, DevelopmentManagerDisableDriverResponder)> {
if let DevelopmentManagerRequest::DisableDriver { driver_url, package_hash, responder } =
self
{
Some((driver_url, package_hash, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_driver(
self,
) -> Option<(String, Option<String>, DevelopmentManagerEnableDriverResponder)> {
if let DevelopmentManagerRequest::EnableDriver { driver_url, package_hash, responder } =
self
{
Some((driver_url, package_hash, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DevelopmentManagerRequest::GetDriverInfo { .. } => "get_driver_info",
DevelopmentManagerRequest::GetCompositeNodeSpecs { .. } => "get_composite_node_specs",
DevelopmentManagerRequest::DisableDriver { .. } => "disable_driver",
DevelopmentManagerRequest::EnableDriver { .. } => "enable_driver",
}
}
}
#[derive(Debug, Clone)]
pub struct DevelopmentManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DevelopmentManagerControlHandle {
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().signal_peer(clear_mask, set_mask)
}
}
impl DevelopmentManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DevelopmentManagerDisableDriverResponder {
control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DevelopmentManagerDisableDriverResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DevelopmentManagerDisableDriverResponder {
type ControlHandle = DevelopmentManagerControlHandle;
fn control_handle(&self) -> &DevelopmentManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DevelopmentManagerDisableDriverResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x7a9043fc2acabf77,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DevelopmentManagerEnableDriverResponder {
control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DevelopmentManagerEnableDriverResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DevelopmentManagerEnableDriverResponder {
type ControlHandle = DevelopmentManagerControlHandle;
fn control_handle(&self) -> &DevelopmentManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DevelopmentManagerEnableDriverResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x4abba8d322e671d9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DriverIndexMarker;
impl fidl::endpoints::ProtocolMarker for DriverIndexMarker {
type Proxy = DriverIndexProxy;
type RequestStream = DriverIndexRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DriverIndexSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.driver.index.DriverIndex";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DriverIndexMarker {}
pub type DriverIndexMatchDriverResult = Result<MatchDriverResult, i32>;
pub type DriverIndexAddCompositeNodeSpecResult = Result<(), i32>;
pub type DriverIndexRebindCompositeNodeSpecResult = Result<(), i32>;
pub trait DriverIndexProxyInterface: Send + Sync {
type MatchDriverResponseFut: std::future::Future<Output = Result<DriverIndexMatchDriverResult, fidl::Error>>
+ Send;
fn r#match_driver(&self, args: &MatchDriverArgs) -> Self::MatchDriverResponseFut;
type AddCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error>>
+ Send;
fn r#add_composite_node_spec(
&self,
payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
) -> Self::AddCompositeNodeSpecResponseFut;
type RebindCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error>>
+ Send;
fn r#rebind_composite_node_spec(
&self,
spec: &str,
driver_url_suffix: Option<&str>,
) -> Self::RebindCompositeNodeSpecResponseFut;
fn r#set_notifier(
&self,
notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DriverIndexSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DriverIndexSynchronousProxy {
type Proxy = DriverIndexProxy;
type Protocol = DriverIndexMarker;
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 DriverIndexSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DriverIndexMarker 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<DriverIndexEvent, fidl::Error> {
DriverIndexEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#match_driver(
&self,
mut args: &MatchDriverArgs,
___deadline: zx::MonotonicInstant,
) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
let _response = self.client.send_query::<
DriverIndexMatchDriverRequest,
fidl::encoding::ResultType<MatchDriverResult, i32>,
>(
(args,),
0x38317894f6269541,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_composite_node_spec(
&self,
mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
___deadline: zx::MonotonicInstant,
) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
let _response = self.client.send_query::<
fidl_fuchsia_driver_framework::CompositeNodeSpec,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
payload,
0x66d25a18fa46a2a2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#rebind_composite_node_spec(
&self,
mut spec: &str,
mut driver_url_suffix: Option<&str>,
___deadline: zx::MonotonicInstant,
) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
let _response = self.client.send_query::<
DriverIndexRebindCompositeNodeSpecRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(spec, driver_url_suffix,),
0x6667ac8de58b202a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#set_notifier(
&self,
mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DriverIndexSetNotifierRequest>(
(notifier,),
0x1dfdede9fcdab511,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DriverIndexProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DriverIndexProxy {
type Protocol = DriverIndexMarker;
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 DriverIndexProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DriverIndexEventStream {
DriverIndexEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#match_driver(
&self,
mut args: &MatchDriverArgs,
) -> fidl::client::QueryResponseFut<
DriverIndexMatchDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DriverIndexProxyInterface::r#match_driver(self, args)
}
pub fn r#add_composite_node_spec(
&self,
mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
) -> fidl::client::QueryResponseFut<
DriverIndexAddCompositeNodeSpecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DriverIndexProxyInterface::r#add_composite_node_spec(self, payload)
}
pub fn r#rebind_composite_node_spec(
&self,
mut spec: &str,
mut driver_url_suffix: Option<&str>,
) -> fidl::client::QueryResponseFut<
DriverIndexRebindCompositeNodeSpecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DriverIndexProxyInterface::r#rebind_composite_node_spec(self, spec, driver_url_suffix)
}
pub fn r#set_notifier(
&self,
mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
) -> Result<(), fidl::Error> {
DriverIndexProxyInterface::r#set_notifier(self, notifier)
}
}
impl DriverIndexProxyInterface for DriverIndexProxy {
type MatchDriverResponseFut = fidl::client::QueryResponseFut<
DriverIndexMatchDriverResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#match_driver(&self, mut args: &MatchDriverArgs) -> Self::MatchDriverResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<MatchDriverResult, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x38317894f6269541,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<DriverIndexMatchDriverRequest, DriverIndexMatchDriverResult>(
(args,),
0x38317894f6269541,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
DriverIndexAddCompositeNodeSpecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_composite_node_spec(
&self,
mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
) -> Self::AddCompositeNodeSpecResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x66d25a18fa46a2a2,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl_fuchsia_driver_framework::CompositeNodeSpec,
DriverIndexAddCompositeNodeSpecResult,
>(
payload,
0x66d25a18fa46a2a2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RebindCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
DriverIndexRebindCompositeNodeSpecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#rebind_composite_node_spec(
&self,
mut spec: &str,
mut driver_url_suffix: Option<&str>,
) -> Self::RebindCompositeNodeSpecResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6667ac8de58b202a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
DriverIndexRebindCompositeNodeSpecRequest,
DriverIndexRebindCompositeNodeSpecResult,
>(
(spec, driver_url_suffix,),
0x6667ac8de58b202a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_notifier(
&self,
mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DriverIndexSetNotifierRequest>(
(notifier,),
0x1dfdede9fcdab511,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DriverIndexEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DriverIndexEventStream {}
impl futures::stream::FusedStream for DriverIndexEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DriverIndexEventStream {
type Item = Result<DriverIndexEvent, 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(DriverIndexEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DriverIndexEvent {}
impl DriverIndexEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DriverIndexEvent, 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: <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DriverIndexRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DriverIndexRequestStream {}
impl futures::stream::FusedStream for DriverIndexRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DriverIndexRequestStream {
type Protocol = DriverIndexMarker;
type ControlHandle = DriverIndexControlHandle;
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 {
DriverIndexControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DriverIndexRequestStream {
type Item = Result<DriverIndexRequest, 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 DriverIndexRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x38317894f6269541 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DriverIndexMatchDriverRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexMatchDriverRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
Ok(DriverIndexRequest::MatchDriver {
args: req.args,
responder: DriverIndexMatchDriverResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x66d25a18fa46a2a2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_fuchsia_driver_framework::CompositeNodeSpec,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_driver_framework::CompositeNodeSpec>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
Ok(DriverIndexRequest::AddCompositeNodeSpec {
payload: req,
responder: DriverIndexAddCompositeNodeSpecResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6667ac8de58b202a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DriverIndexRebindCompositeNodeSpecRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexRebindCompositeNodeSpecRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
Ok(DriverIndexRequest::RebindCompositeNodeSpec {
spec: req.spec,
driver_url_suffix: req.driver_url_suffix,
responder: DriverIndexRebindCompositeNodeSpecResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1dfdede9fcdab511 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DriverIndexSetNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexSetNotifierRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
Ok(DriverIndexRequest::SetNotifier {
notifier: req.notifier,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DriverIndexRequest {
MatchDriver { args: MatchDriverArgs, responder: DriverIndexMatchDriverResponder },
AddCompositeNodeSpec {
payload: fidl_fuchsia_driver_framework::CompositeNodeSpec,
responder: DriverIndexAddCompositeNodeSpecResponder,
},
RebindCompositeNodeSpec {
spec: String,
driver_url_suffix: Option<String>,
responder: DriverIndexRebindCompositeNodeSpecResponder,
},
SetNotifier {
notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
control_handle: DriverIndexControlHandle,
},
}
impl DriverIndexRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_match_driver(self) -> Option<(MatchDriverArgs, DriverIndexMatchDriverResponder)> {
if let DriverIndexRequest::MatchDriver { args, responder } = self {
Some((args, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_composite_node_spec(
self,
) -> Option<(
fidl_fuchsia_driver_framework::CompositeNodeSpec,
DriverIndexAddCompositeNodeSpecResponder,
)> {
if let DriverIndexRequest::AddCompositeNodeSpec { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_rebind_composite_node_spec(
self,
) -> Option<(String, Option<String>, DriverIndexRebindCompositeNodeSpecResponder)> {
if let DriverIndexRequest::RebindCompositeNodeSpec { spec, driver_url_suffix, responder } =
self
{
Some((spec, driver_url_suffix, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_notifier(
self,
) -> Option<(fidl::endpoints::ClientEnd<DriverNotifierMarker>, DriverIndexControlHandle)> {
if let DriverIndexRequest::SetNotifier { notifier, control_handle } = self {
Some((notifier, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DriverIndexRequest::MatchDriver { .. } => "match_driver",
DriverIndexRequest::AddCompositeNodeSpec { .. } => "add_composite_node_spec",
DriverIndexRequest::RebindCompositeNodeSpec { .. } => "rebind_composite_node_spec",
DriverIndexRequest::SetNotifier { .. } => "set_notifier",
}
}
}
#[derive(Debug, Clone)]
pub struct DriverIndexControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DriverIndexControlHandle {
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().signal_peer(clear_mask, set_mask)
}
}
impl DriverIndexControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DriverIndexMatchDriverResponder {
control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DriverIndexMatchDriverResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DriverIndexMatchDriverResponder {
type ControlHandle = DriverIndexControlHandle;
fn control_handle(&self) -> &DriverIndexControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DriverIndexMatchDriverResponder {
pub fn send(self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&MatchDriverResult, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<MatchDriverResult, i32>>(
result,
self.tx_id,
0x38317894f6269541,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DriverIndexAddCompositeNodeSpecResponder {
control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DriverIndexAddCompositeNodeSpecResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DriverIndexAddCompositeNodeSpecResponder {
type ControlHandle = DriverIndexControlHandle;
fn control_handle(&self) -> &DriverIndexControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DriverIndexAddCompositeNodeSpecResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x66d25a18fa46a2a2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DriverIndexRebindCompositeNodeSpecResponder {
control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DriverIndexRebindCompositeNodeSpecResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DriverIndexRebindCompositeNodeSpecResponder {
type ControlHandle = DriverIndexControlHandle;
fn control_handle(&self) -> &DriverIndexControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DriverIndexRebindCompositeNodeSpecResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x6667ac8de58b202a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DriverNotifierMarker;
impl fidl::endpoints::ProtocolMarker for DriverNotifierMarker {
type Proxy = DriverNotifierProxy;
type RequestStream = DriverNotifierRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DriverNotifierSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DriverNotifier";
}
pub trait DriverNotifierProxyInterface: Send + Sync {
fn r#new_driver_available(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DriverNotifierSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DriverNotifierSynchronousProxy {
type Proxy = DriverNotifierProxy;
type Protocol = DriverNotifierMarker;
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 DriverNotifierSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DriverNotifierMarker 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<DriverNotifierEvent, fidl::Error> {
DriverNotifierEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1642ffd065b6b48e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DriverNotifierProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DriverNotifierProxy {
type Protocol = DriverNotifierMarker;
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 DriverNotifierProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DriverNotifierEventStream {
DriverNotifierEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
DriverNotifierProxyInterface::r#new_driver_available(self)
}
}
impl DriverNotifierProxyInterface for DriverNotifierProxy {
fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1642ffd065b6b48e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DriverNotifierEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DriverNotifierEventStream {}
impl futures::stream::FusedStream for DriverNotifierEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DriverNotifierEventStream {
type Item = Result<DriverNotifierEvent, 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(DriverNotifierEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DriverNotifierEvent {}
impl DriverNotifierEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DriverNotifierEvent, 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:
<DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DriverNotifierRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DriverNotifierRequestStream {}
impl futures::stream::FusedStream for DriverNotifierRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DriverNotifierRequestStream {
type Protocol = DriverNotifierMarker;
type ControlHandle = DriverNotifierControlHandle;
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 {
DriverNotifierControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DriverNotifierRequestStream {
type Item = Result<DriverNotifierRequest, 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 DriverNotifierRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x1642ffd065b6b48e => {
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 =
DriverNotifierControlHandle { inner: this.inner.clone() };
Ok(DriverNotifierRequest::NewDriverAvailable { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DriverNotifierRequest {
NewDriverAvailable { control_handle: DriverNotifierControlHandle },
}
impl DriverNotifierRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_new_driver_available(self) -> Option<(DriverNotifierControlHandle)> {
if let DriverNotifierRequest::NewDriverAvailable { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DriverNotifierRequest::NewDriverAvailable { .. } => "new_driver_available",
}
}
}
#[derive(Debug, Clone)]
pub struct DriverNotifierControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DriverNotifierControlHandle {
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().signal_peer(clear_mask, set_mask)
}
}
impl DriverNotifierControlHandle {}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for DevelopmentManagerDisableDriverRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerDisableDriverRequest {
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<DevelopmentManagerDisableDriverRequest, D>
for &DevelopmentManagerDisableDriverRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DevelopmentManagerDisableDriverRequest>(offset);
fidl::encoding::Encode::<DevelopmentManagerDisableDriverRequest, D>::encode(
(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url),
<fidl::encoding::Optional<fidl::encoding::BoundedString<64>> as fidl::encoding::ValueTypeMarker>::borrow(&self.package_hash),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<64>>, D>,
> fidl::encoding::Encode<DevelopmentManagerDisableDriverRequest, 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::<DevelopmentManagerDisableDriverRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DevelopmentManagerDisableDriverRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
package_hash: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
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::BoundedString<4096>,
D,
&mut self.driver_url,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
D,
&mut self.package_hash,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DevelopmentManagerEnableDriverRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerEnableDriverRequest {
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<DevelopmentManagerEnableDriverRequest, D>
for &DevelopmentManagerEnableDriverRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DevelopmentManagerEnableDriverRequest>(offset);
fidl::encoding::Encode::<DevelopmentManagerEnableDriverRequest, D>::encode(
(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url),
<fidl::encoding::Optional<fidl::encoding::BoundedString<64>> as fidl::encoding::ValueTypeMarker>::borrow(&self.package_hash),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<64>>, D>,
> fidl::encoding::Encode<DevelopmentManagerEnableDriverRequest, 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::<DevelopmentManagerEnableDriverRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DevelopmentManagerEnableDriverRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
package_hash: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
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::BoundedString<4096>,
D,
&mut self.driver_url,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
D,
&mut self.package_hash,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetCompositeNodeSpecsRequest {
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 DevelopmentManagerGetCompositeNodeSpecsRequest {
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
fidl::encoding::Encode<
DevelopmentManagerGetCompositeNodeSpecsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DevelopmentManagerGetCompositeNodeSpecsRequest
{
#[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::<DevelopmentManagerGetCompositeNodeSpecsRequest>(offset);
fidl::encoding::Encode::<DevelopmentManagerGetCompositeNodeSpecsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name_filter),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DevelopmentManagerGetCompositeNodeSpecsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[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::<DevelopmentManagerGetCompositeNodeSpecsRequest>(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 + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DevelopmentManagerGetCompositeNodeSpecsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
name_filter: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
iterator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
>,
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);
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!(
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name_filter,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.iterator,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetDriverInfoRequest {
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 DevelopmentManagerGetDriverInfoRequest {
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
fidl::encoding::Encode<
DevelopmentManagerGetDriverInfoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DevelopmentManagerGetDriverInfoRequest
{
#[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::<DevelopmentManagerGetDriverInfoRequest>(offset);
fidl::encoding::Encode::<DevelopmentManagerGetDriverInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_filter),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DevelopmentManagerGetDriverInfoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[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::<DevelopmentManagerGetDriverInfoRequest>(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 + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DevelopmentManagerGetDriverInfoRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
driver_filter: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
iterator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
>,
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);
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!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.driver_filter,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.iterator,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DriverIndexMatchDriverRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DriverIndexMatchDriverRequest {
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<DriverIndexMatchDriverRequest, D>
for &DriverIndexMatchDriverRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DriverIndexMatchDriverRequest>(offset);
fidl::encoding::Encode::<DriverIndexMatchDriverRequest, D>::encode(
(<MatchDriverArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MatchDriverArgs, D>>
fidl::encoding::Encode<DriverIndexMatchDriverRequest, 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::<DriverIndexMatchDriverRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DriverIndexMatchDriverRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { args: fidl::new_empty!(MatchDriverArgs, 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!(MatchDriverArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DriverIndexRebindCompositeNodeSpecRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DriverIndexRebindCompositeNodeSpecRequest {
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<DriverIndexRebindCompositeNodeSpecRequest, D>
for &DriverIndexRebindCompositeNodeSpecRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DriverIndexRebindCompositeNodeSpecRequest>(offset);
fidl::encoding::Encode::<DriverIndexRebindCompositeNodeSpecRequest, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.spec),
<fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url_suffix),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
> fidl::encoding::Encode<DriverIndexRebindCompositeNodeSpecRequest, 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::<DriverIndexRebindCompositeNodeSpecRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DriverIndexRebindCompositeNodeSpecRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
spec: fidl::new_empty!(fidl::encoding::UnboundedString, D),
driver_url_suffix: fidl::new_empty!(
fidl::encoding::Optional<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);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.spec,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
D,
&mut self.driver_url_suffix,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DriverIndexSetNotifierRequest {
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 DriverIndexSetNotifierRequest {
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
fidl::encoding::Encode<
DriverIndexSetNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DriverIndexSetNotifierRequest
{
#[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::<DriverIndexSetNotifierRequest>(offset);
fidl::encoding::Encode::<DriverIndexSetNotifierRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notifier),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DriverIndexSetNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[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::<DriverIndexSetNotifierRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DriverIndexSetNotifierRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
notifier: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
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!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.notifier,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl MatchDriverArgs {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.driver_url_suffix {
return 3;
}
if let Some(_) = self.name {
return 2;
}
if let Some(_) = self.properties {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for MatchDriverArgs {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MatchDriverArgs {
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<MatchDriverArgs, D>
for &MatchDriverArgs
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MatchDriverArgs>(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::<fidl::encoding::Vector<fidl_fuchsia_driver_framework::NodeProperty, 64>, D>(
self.properties.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_driver_framework::NodeProperty, 64> 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::<fidl::encoding::BoundedString<128>, D>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<128> 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::<fidl::encoding::UnboundedString, D>(
self.driver_url_suffix.as_ref().map(
<fidl::encoding::UnboundedString 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 MatchDriverArgs {
#[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 = <fidl::encoding::Vector<
fidl_fuchsia_driver_framework::NodeProperty,
64,
> 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.properties.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_driver_framework::NodeProperty, 64>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_driver_framework::NodeProperty, 64>, 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 =
<fidl::encoding::BoundedString<128> 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
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
fidl::decode!(
fidl::encoding::BoundedString<128>,
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 =
<fidl::encoding::UnboundedString 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
.driver_url_suffix
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
fidl::decode!(
fidl::encoding::UnboundedString,
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 MatchDriverResult {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MatchDriverResult {
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<MatchDriverResult, D>
for &MatchDriverResult
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MatchDriverResult>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
MatchDriverResult::Driver(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_driver_framework::DriverInfo, D>(
<fidl_fuchsia_driver_framework::DriverInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MatchDriverResult::CompositeParents(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework::CompositeParent>, D>(
<fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework::CompositeParent> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MatchDriverResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MatchDriverResult {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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_fuchsia_driver_framework::DriverInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework::CompositeParent> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 MatchDriverResult::Driver(_) = self {
} else {
*self = MatchDriverResult::Driver(fidl::new_empty!(
fidl_fuchsia_driver_framework::DriverInfo,
D
));
}
#[allow(irrefutable_let_patterns)]
if let MatchDriverResult::Driver(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_driver_framework::DriverInfo,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let MatchDriverResult::CompositeParents(_) = self {
} else {
*self = MatchDriverResult::CompositeParents(fidl::new_empty!(
fidl::encoding::UnboundedVector<
fidl_fuchsia_driver_framework::CompositeParent,
>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let MatchDriverResult::CompositeParents(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<
fidl_fuchsia_driver_framework::CompositeParent,
>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = MatchDriverResult::__SourceBreaking { unknown_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(())
}
}
}