#![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(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceListenerRegistryRegisterListenerRequest {
pub listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceListenerRegistryRegisterListenerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceListenerRegistryRegisterMediaButtonsListenerRequest {
pub listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DisplayBacklightSetMinimumRgbRequest {
pub minimum_rgb: u8,
}
impl fidl::Persistable for DisplayBacklightSetMinimumRgbRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct MediaButtonsListenerOnEventRequest {
pub event: fidl_fuchsia_ui_input::MediaButtonsEvent,
}
impl fidl::Persistable for MediaButtonsListenerOnEventRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct MediaButtonsListenerOnMediaButtonsEventRequest {
pub event: fidl_fuchsia_ui_input::MediaButtonsEvent,
}
impl fidl::Persistable for MediaButtonsListenerOnMediaButtonsEventRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceListenerRegistryMarker;
impl fidl::endpoints::ProtocolMarker for DeviceListenerRegistryMarker {
type Proxy = DeviceListenerRegistryProxy;
type RequestStream = DeviceListenerRegistryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceListenerRegistrySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.policy.DeviceListenerRegistry";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DeviceListenerRegistryMarker {}
pub trait DeviceListenerRegistryProxyInterface: Send + Sync {
fn r#register_media_buttons_listener(
&self,
listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Result<(), fidl::Error>;
type RegisterListenerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#register_listener(
&self,
listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Self::RegisterListenerResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceListenerRegistrySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceListenerRegistrySynchronousProxy {
type Proxy = DeviceListenerRegistryProxy;
type Protocol = DeviceListenerRegistryMarker;
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 DeviceListenerRegistrySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DeviceListenerRegistryMarker 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<DeviceListenerRegistryEvent, fidl::Error> {
DeviceListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_media_buttons_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
(listener,),
0x3826318765c72e70,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#register_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
DeviceListenerRegistryRegisterListenerRequest,
fidl::encoding::EmptyPayload,
>(
(listener,),
0x2f9e7eea89485a7b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct DeviceListenerRegistryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeviceListenerRegistryProxy {
type Protocol = DeviceListenerRegistryMarker;
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 DeviceListenerRegistryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceListenerRegistryEventStream {
DeviceListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_media_buttons_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Result<(), fidl::Error> {
DeviceListenerRegistryProxyInterface::r#register_media_buttons_listener(self, listener)
}
pub fn r#register_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceListenerRegistryProxyInterface::r#register_listener(self, listener)
}
}
impl DeviceListenerRegistryProxyInterface for DeviceListenerRegistryProxy {
fn r#register_media_buttons_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
(listener,),
0x3826318765c72e70,
fidl::encoding::DynamicFlags::empty(),
)
}
type RegisterListenerResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_listener(
&self,
mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
) -> Self::RegisterListenerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2f9e7eea89485a7b,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<DeviceListenerRegistryRegisterListenerRequest, ()>(
(listener,),
0x2f9e7eea89485a7b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeviceListenerRegistryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeviceListenerRegistryEventStream {}
impl futures::stream::FusedStream for DeviceListenerRegistryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceListenerRegistryEventStream {
type Item = Result<DeviceListenerRegistryEvent, 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(DeviceListenerRegistryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceListenerRegistryEvent {}
impl DeviceListenerRegistryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeviceListenerRegistryEvent, 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:
<DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceListenerRegistryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceListenerRegistryRequestStream {}
impl futures::stream::FusedStream for DeviceListenerRegistryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceListenerRegistryRequestStream {
type Protocol = DeviceListenerRegistryMarker;
type ControlHandle = DeviceListenerRegistryControlHandle;
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 {
DeviceListenerRegistryControlHandle { 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 DeviceListenerRegistryRequestStream {
type Item = Result<DeviceListenerRegistryRequest, 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 DeviceListenerRegistryRequestStream 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 {
0x3826318765c72e70 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterMediaButtonsListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceListenerRegistryControlHandle {
inner: this.inner.clone(),
};
Ok(DeviceListenerRegistryRequest::RegisterMediaButtonsListener {listener: req.listener,
control_handle,
})
}
0x2f9e7eea89485a7b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceListenerRegistryControlHandle {
inner: this.inner.clone(),
};
Ok(DeviceListenerRegistryRequest::RegisterListener {listener: req.listener,
responder: DeviceListenerRegistryRegisterListenerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeviceListenerRegistryRequest {
RegisterMediaButtonsListener {
listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
control_handle: DeviceListenerRegistryControlHandle,
},
RegisterListener {
listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
responder: DeviceListenerRegistryRegisterListenerResponder,
},
}
impl DeviceListenerRegistryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_media_buttons_listener(
self,
) -> Option<(
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
DeviceListenerRegistryControlHandle,
)> {
if let DeviceListenerRegistryRequest::RegisterMediaButtonsListener {
listener,
control_handle,
} = self
{
Some((listener, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_listener(
self,
) -> Option<(
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
DeviceListenerRegistryRegisterListenerResponder,
)> {
if let DeviceListenerRegistryRequest::RegisterListener { listener, responder } = self {
Some((listener, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceListenerRegistryRequest::RegisterMediaButtonsListener { .. } => {
"register_media_buttons_listener"
}
DeviceListenerRegistryRequest::RegisterListener { .. } => "register_listener",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceListenerRegistryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeviceListenerRegistryControlHandle {
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 DeviceListenerRegistryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceListenerRegistryRegisterListenerResponder {
control_handle: std::mem::ManuallyDrop<DeviceListenerRegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceListenerRegistryRegisterListenerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceListenerRegistryRegisterListenerResponder {
type ControlHandle = DeviceListenerRegistryControlHandle;
fn control_handle(&self) -> &DeviceListenerRegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceListenerRegistryRegisterListenerResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x2f9e7eea89485a7b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DisplayBacklightMarker;
impl fidl::endpoints::ProtocolMarker for DisplayBacklightMarker {
type Proxy = DisplayBacklightProxy;
type RequestStream = DisplayBacklightRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DisplayBacklightSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.policy.DisplayBacklight";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DisplayBacklightMarker {}
pub trait DisplayBacklightProxyInterface: Send + Sync {
type SetMinimumRgbResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DisplayBacklightSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DisplayBacklightSynchronousProxy {
type Proxy = DisplayBacklightProxy;
type Protocol = DisplayBacklightMarker;
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 DisplayBacklightSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DisplayBacklightMarker 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<DisplayBacklightEvent, fidl::Error> {
DisplayBacklightEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_minimum_rgb(
&self,
mut minimum_rgb: u8,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<DisplayBacklightSetMinimumRgbRequest, fidl::encoding::EmptyPayload>(
(minimum_rgb,),
0x25604347bb8a1ca3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct DisplayBacklightProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DisplayBacklightProxy {
type Protocol = DisplayBacklightMarker;
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 DisplayBacklightProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DisplayBacklightEventStream {
DisplayBacklightEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_minimum_rgb(
&self,
mut minimum_rgb: u8,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
DisplayBacklightProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
}
}
impl DisplayBacklightProxyInterface for DisplayBacklightProxy {
type SetMinimumRgbResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x25604347bb8a1ca3,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<DisplayBacklightSetMinimumRgbRequest, ()>(
(minimum_rgb,),
0x25604347bb8a1ca3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DisplayBacklightEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DisplayBacklightEventStream {}
impl futures::stream::FusedStream for DisplayBacklightEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DisplayBacklightEventStream {
type Item = Result<DisplayBacklightEvent, 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(DisplayBacklightEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DisplayBacklightEvent {}
impl DisplayBacklightEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DisplayBacklightEvent, 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:
<DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DisplayBacklightRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DisplayBacklightRequestStream {}
impl futures::stream::FusedStream for DisplayBacklightRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DisplayBacklightRequestStream {
type Protocol = DisplayBacklightMarker;
type ControlHandle = DisplayBacklightControlHandle;
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 {
DisplayBacklightControlHandle { 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 DisplayBacklightRequestStream {
type Item = Result<DisplayBacklightRequest, 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 DisplayBacklightRequestStream 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 {
0x25604347bb8a1ca3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DisplayBacklightSetMinimumRgbRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplayBacklightSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
DisplayBacklightControlHandle { inner: this.inner.clone() };
Ok(DisplayBacklightRequest::SetMinimumRgb {
minimum_rgb: req.minimum_rgb,
responder: DisplayBacklightSetMinimumRgbResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DisplayBacklightRequest {
SetMinimumRgb { minimum_rgb: u8, responder: DisplayBacklightSetMinimumRgbResponder },
}
impl DisplayBacklightRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_minimum_rgb(self) -> Option<(u8, DisplayBacklightSetMinimumRgbResponder)> {
if let DisplayBacklightRequest::SetMinimumRgb { minimum_rgb, responder } = self {
Some((minimum_rgb, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DisplayBacklightRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
}
}
}
#[derive(Debug, Clone)]
pub struct DisplayBacklightControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DisplayBacklightControlHandle {
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 DisplayBacklightControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DisplayBacklightSetMinimumRgbResponder {
control_handle: std::mem::ManuallyDrop<DisplayBacklightControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DisplayBacklightSetMinimumRgbResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DisplayBacklightSetMinimumRgbResponder {
type ControlHandle = DisplayBacklightControlHandle;
fn control_handle(&self) -> &DisplayBacklightControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DisplayBacklightSetMinimumRgbResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x25604347bb8a1ca3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MediaButtonsListenerMarker;
impl fidl::endpoints::ProtocolMarker for MediaButtonsListenerMarker {
type Proxy = MediaButtonsListenerProxy;
type RequestStream = MediaButtonsListenerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MediaButtonsListenerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MediaButtonsListener";
}
pub trait MediaButtonsListenerProxyInterface: Send + Sync {
fn r#on_media_buttons_event(
&self,
event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Result<(), fidl::Error>;
type OnEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_event(
&self,
event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Self::OnEventResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MediaButtonsListenerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MediaButtonsListenerSynchronousProxy {
type Proxy = MediaButtonsListenerProxy;
type Protocol = MediaButtonsListenerMarker;
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 MediaButtonsListenerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<MediaButtonsListenerMarker 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<MediaButtonsListenerEvent, fidl::Error> {
MediaButtonsListenerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_media_buttons_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Result<(), fidl::Error> {
self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
(event,),
0x2c2068c386964e00,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#on_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<MediaButtonsListenerOnEventRequest, fidl::encoding::EmptyPayload>(
(event,),
0x16e7130ddcaf877c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct MediaButtonsListenerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MediaButtonsListenerProxy {
type Protocol = MediaButtonsListenerMarker;
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 MediaButtonsListenerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MediaButtonsListenerEventStream {
MediaButtonsListenerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_media_buttons_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Result<(), fidl::Error> {
MediaButtonsListenerProxyInterface::r#on_media_buttons_event(self, event)
}
pub fn r#on_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
MediaButtonsListenerProxyInterface::r#on_event(self, event)
}
}
impl MediaButtonsListenerProxyInterface for MediaButtonsListenerProxy {
fn r#on_media_buttons_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Result<(), fidl::Error> {
self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
(event,),
0x2c2068c386964e00,
fidl::encoding::DynamicFlags::empty(),
)
}
type OnEventResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_event(
&self,
mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
) -> Self::OnEventResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x16e7130ddcaf877c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<MediaButtonsListenerOnEventRequest, ()>(
(event,),
0x16e7130ddcaf877c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MediaButtonsListenerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MediaButtonsListenerEventStream {}
impl futures::stream::FusedStream for MediaButtonsListenerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MediaButtonsListenerEventStream {
type Item = Result<MediaButtonsListenerEvent, 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(MediaButtonsListenerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MediaButtonsListenerEvent {}
impl MediaButtonsListenerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MediaButtonsListenerEvent, 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:
<MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MediaButtonsListenerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MediaButtonsListenerRequestStream {}
impl futures::stream::FusedStream for MediaButtonsListenerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MediaButtonsListenerRequestStream {
type Protocol = MediaButtonsListenerMarker;
type ControlHandle = MediaButtonsListenerControlHandle;
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 {
MediaButtonsListenerControlHandle { 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 MediaButtonsListenerRequestStream {
type Item = Result<MediaButtonsListenerRequest, 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 MediaButtonsListenerRequestStream 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 {
0x2c2068c386964e00 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(MediaButtonsListenerOnMediaButtonsEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnMediaButtonsEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = MediaButtonsListenerControlHandle {
inner: this.inner.clone(),
};
Ok(MediaButtonsListenerRequest::OnMediaButtonsEvent {event: req.event,
control_handle,
})
}
0x16e7130ddcaf877c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(MediaButtonsListenerOnEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = MediaButtonsListenerControlHandle {
inner: this.inner.clone(),
};
Ok(MediaButtonsListenerRequest::OnEvent {event: req.event,
responder: MediaButtonsListenerOnEventResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MediaButtonsListenerRequest {
OnMediaButtonsEvent {
event: fidl_fuchsia_ui_input::MediaButtonsEvent,
control_handle: MediaButtonsListenerControlHandle,
},
OnEvent {
event: fidl_fuchsia_ui_input::MediaButtonsEvent,
responder: MediaButtonsListenerOnEventResponder,
},
}
impl MediaButtonsListenerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_media_buttons_event(
self,
) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerControlHandle)> {
if let MediaButtonsListenerRequest::OnMediaButtonsEvent { event, control_handle } = self {
Some((event, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_event(
self,
) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerOnEventResponder)>
{
if let MediaButtonsListenerRequest::OnEvent { event, responder } = self {
Some((event, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MediaButtonsListenerRequest::OnMediaButtonsEvent { .. } => "on_media_buttons_event",
MediaButtonsListenerRequest::OnEvent { .. } => "on_event",
}
}
}
#[derive(Debug, Clone)]
pub struct MediaButtonsListenerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MediaButtonsListenerControlHandle {
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 MediaButtonsListenerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MediaButtonsListenerOnEventResponder {
control_handle: std::mem::ManuallyDrop<MediaButtonsListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MediaButtonsListenerOnEventResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MediaButtonsListenerOnEventResponder {
type ControlHandle = MediaButtonsListenerControlHandle;
fn control_handle(&self) -> &MediaButtonsListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MediaButtonsListenerOnEventResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x16e7130ddcaf877c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for DeviceListenerRegistryRegisterListenerRequest {
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 DeviceListenerRegistryRegisterListenerRequest {
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<
DeviceListenerRegistryRegisterListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DeviceListenerRegistryRegisterListenerRequest
{
#[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::<DeviceListenerRegistryRegisterListenerRequest>(offset);
fidl::encoding::Encode::<
DeviceListenerRegistryRegisterListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.listener
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DeviceListenerRegistryRegisterListenerRequest,
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::<DeviceListenerRegistryRegisterListenerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceListenerRegistryRegisterListenerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
listener: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
>,
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<MediaButtonsListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listener,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker
for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
{
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 DeviceListenerRegistryRegisterMediaButtonsListenerRequest
{
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<
DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DeviceListenerRegistryRegisterMediaButtonsListenerRequest
{
#[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::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
offset,
);
fidl::encoding::Encode::<
DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.listener
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
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::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
listener: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
>,
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<MediaButtonsListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listener,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DisplayBacklightSetMinimumRgbRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DisplayBacklightSetMinimumRgbRequest {
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
}
#[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<DisplayBacklightSetMinimumRgbRequest, D>
for &DisplayBacklightSetMinimumRgbRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DisplayBacklightSetMinimumRgbRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DisplayBacklightSetMinimumRgbRequest)
.write_unaligned((self as *const DisplayBacklightSetMinimumRgbRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DisplayBacklightSetMinimumRgbRequest, 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::<DisplayBacklightSetMinimumRgbRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DisplayBacklightSetMinimumRgbRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { minimum_rgb: fidl::new_empty!(u8, 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, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsListenerOnEventRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MediaButtonsListenerOnEventRequest {
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<MediaButtonsListenerOnEventRequest, D>
for &MediaButtonsListenerOnEventRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsListenerOnEventRequest>(offset);
fidl::encoding::Encode::<MediaButtonsListenerOnEventRequest, D>::encode(
(
<fidl_fuchsia_ui_input::MediaButtonsEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_ui_input::MediaButtonsEvent, D>,
> fidl::encoding::Encode<MediaButtonsListenerOnEventRequest, 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::<MediaButtonsListenerOnEventRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MediaButtonsListenerOnEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(fidl_fuchsia_ui_input::MediaButtonsEvent, 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_input::MediaButtonsEvent,
D,
&mut self.event,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MediaButtonsListenerOnMediaButtonsEventRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MediaButtonsListenerOnMediaButtonsEventRequest {
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<MediaButtonsListenerOnMediaButtonsEventRequest, D>
for &MediaButtonsListenerOnMediaButtonsEventRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaButtonsListenerOnMediaButtonsEventRequest>(offset);
fidl::encoding::Encode::<MediaButtonsListenerOnMediaButtonsEventRequest, D>::encode(
(
<fidl_fuchsia_ui_input::MediaButtonsEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_ui_input::MediaButtonsEvent, D>,
> fidl::encoding::Encode<MediaButtonsListenerOnMediaButtonsEventRequest, 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::<MediaButtonsListenerOnMediaButtonsEventRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MediaButtonsListenerOnMediaButtonsEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(fidl_fuchsia_ui_input::MediaButtonsEvent, 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_input::MediaButtonsEvent,
D,
&mut self.event,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}