#![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;
pub type Brightness = f32;
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct BrightnessPoint {
pub ambient_lux: f32,
pub display_nits: f32,
}
impl fidl::Persistable for BrightnessPoint {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct BrightnessTable {
pub points: Vec<BrightnessPoint>,
}
impl fidl::Persistable for BrightnessTable {}
#[derive(Clone, Debug, PartialEq)]
pub struct ColorAdjustmentHandlerSetColorAdjustmentRequest {
pub color_adjustment: ColorAdjustmentTable,
}
impl fidl::Persistable for ColorAdjustmentHandlerSetColorAdjustmentRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ColorAdjustmentSetDiscreteColorAdjustmentRequest {
pub color_adjustment: ColorAdjustmentTable,
}
impl fidl::Persistable for ColorAdjustmentSetDiscreteColorAdjustmentRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlSetAutoBrightnessAdjustmentRequest {
pub adjustment: f32,
}
impl fidl::Persistable for ControlSetAutoBrightnessAdjustmentRequest {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct ControlSetBrightnessTableRequest {
pub table: BrightnessTable,
}
impl fidl::Persistable for ControlSetBrightnessTableRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlSetManualBrightnessRequest {
pub value: f32,
}
impl fidl::Persistable for ControlSetManualBrightnessRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlSetManualBrightnessSmoothRequest {
pub value: f32,
pub duration: i64,
}
impl fidl::Persistable for ControlSetManualBrightnessSmoothRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlWatchAutoBrightnessAdjustmentResponse {
pub adjustment: f32,
}
impl fidl::Persistable for ControlWatchAutoBrightnessAdjustmentResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControlWatchAutoBrightnessResponse {
pub enabled: bool,
}
impl fidl::Persistable for ControlWatchAutoBrightnessResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlWatchCurrentBrightnessResponse {
pub value: f32,
}
impl fidl::Persistable for ControlWatchCurrentBrightnessResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct ControlGetMaxAbsoluteBrightnessResponse {
pub max_brightness: f64,
}
impl fidl::Persistable for ControlGetMaxAbsoluteBrightnessResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ColorAdjustmentTable {
pub matrix: Option<[f32; 9]>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ColorAdjustmentTable {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ColorAdjustmentMarker;
impl fidl::endpoints::ProtocolMarker for ColorAdjustmentMarker {
type Proxy = ColorAdjustmentProxy;
type RequestStream = ColorAdjustmentRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ColorAdjustmentSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustment";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentMarker {}
pub trait ColorAdjustmentProxyInterface: Send + Sync {
type SetDiscreteColorAdjustmentResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#set_discrete_color_adjustment(
&self,
color_adjustment: &ColorAdjustmentTable,
) -> Self::SetDiscreteColorAdjustmentResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ColorAdjustmentSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ColorAdjustmentSynchronousProxy {
type Proxy = ColorAdjustmentProxy;
type Protocol = ColorAdjustmentMarker;
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 ColorAdjustmentSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ColorAdjustmentMarker 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<ColorAdjustmentEvent, fidl::Error> {
ColorAdjustmentEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_discrete_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ColorAdjustmentSetDiscreteColorAdjustmentRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(color_adjustment,),
0x48d90d2e62d451c4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ColorAdjustmentProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ColorAdjustmentProxy {
type Protocol = ColorAdjustmentMarker;
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 ColorAdjustmentProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ColorAdjustmentEventStream {
ColorAdjustmentEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_discrete_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ColorAdjustmentProxyInterface::r#set_discrete_color_adjustment(self, color_adjustment)
}
}
impl ColorAdjustmentProxyInterface for ColorAdjustmentProxy {
type SetDiscreteColorAdjustmentResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_discrete_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
) -> Self::SetDiscreteColorAdjustmentResponseFut {
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::FlexibleType<fidl::encoding::EmptyStruct>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x48d90d2e62d451c4,
>(_buf?)?
.into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
Ok(_response)
}
self.client.send_query_and_decode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, ()>(
(color_adjustment,),
0x48d90d2e62d451c4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ColorAdjustmentEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ColorAdjustmentEventStream {}
impl futures::stream::FusedStream for ColorAdjustmentEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ColorAdjustmentEventStream {
type Item = Result<ColorAdjustmentEvent, 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(ColorAdjustmentEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ColorAdjustmentEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ColorAdjustmentEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ColorAdjustmentEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ColorAdjustmentEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ColorAdjustmentRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ColorAdjustmentRequestStream {}
impl futures::stream::FusedStream for ColorAdjustmentRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ColorAdjustmentRequestStream {
type Protocol = ColorAdjustmentMarker;
type ControlHandle = ColorAdjustmentControlHandle;
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 {
ColorAdjustmentControlHandle { 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 ColorAdjustmentRequestStream {
type Item = Result<ColorAdjustmentRequest, 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 ColorAdjustmentRequestStream 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 {
0x48d90d2e62d451c4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ColorAdjustmentSetDiscreteColorAdjustmentRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ColorAdjustmentControlHandle { inner: this.inner.clone() };
Ok(ColorAdjustmentRequest::SetDiscreteColorAdjustment {
color_adjustment: req.color_adjustment,
responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ColorAdjustmentRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ColorAdjustmentControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ColorAdjustmentRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ColorAdjustmentControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ColorAdjustmentRequest {
SetDiscreteColorAdjustment {
color_adjustment: ColorAdjustmentTable,
responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ColorAdjustmentControlHandle,
method_type: fidl::MethodType,
},
}
impl ColorAdjustmentRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_discrete_color_adjustment(
self,
) -> Option<(ColorAdjustmentTable, ColorAdjustmentSetDiscreteColorAdjustmentResponder)> {
if let ColorAdjustmentRequest::SetDiscreteColorAdjustment { color_adjustment, responder } =
self
{
Some((color_adjustment, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ColorAdjustmentRequest::SetDiscreteColorAdjustment { .. } => {
"set_discrete_color_adjustment"
}
ColorAdjustmentRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
ColorAdjustmentRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ColorAdjustmentControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ColorAdjustmentControlHandle {
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 ColorAdjustmentControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ColorAdjustmentSetDiscreteColorAdjustmentResponder {
control_handle: std::mem::ManuallyDrop<ColorAdjustmentControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
type ControlHandle = ColorAdjustmentControlHandle;
fn control_handle(&self) -> &ColorAdjustmentControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ColorAdjustmentSetDiscreteColorAdjustmentResponder {
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::FlexibleType<fidl::encoding::EmptyStruct>>(
fidl::encoding::Flexible::new(()),
self.tx_id,
0x48d90d2e62d451c4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ColorAdjustmentHandlerMarker;
impl fidl::endpoints::ProtocolMarker for ColorAdjustmentHandlerMarker {
type Proxy = ColorAdjustmentHandlerProxy;
type RequestStream = ColorAdjustmentHandlerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ColorAdjustmentHandlerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustmentHandler";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentHandlerMarker {}
pub trait ColorAdjustmentHandlerProxyInterface: Send + Sync {
fn r#set_color_adjustment(
&self,
color_adjustment: &ColorAdjustmentTable,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ColorAdjustmentHandlerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ColorAdjustmentHandlerSynchronousProxy {
type Proxy = ColorAdjustmentHandlerProxy;
type Protocol = ColorAdjustmentHandlerMarker;
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 ColorAdjustmentHandlerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ColorAdjustmentHandlerMarker 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<ColorAdjustmentHandlerEvent, fidl::Error> {
ColorAdjustmentHandlerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
) -> Result<(), fidl::Error> {
self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
(color_adjustment,),
0x6277992fee8aea3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ColorAdjustmentHandlerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ColorAdjustmentHandlerProxy {
type Protocol = ColorAdjustmentHandlerMarker;
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 ColorAdjustmentHandlerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ColorAdjustmentHandlerEventStream {
ColorAdjustmentHandlerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
) -> Result<(), fidl::Error> {
ColorAdjustmentHandlerProxyInterface::r#set_color_adjustment(self, color_adjustment)
}
}
impl ColorAdjustmentHandlerProxyInterface for ColorAdjustmentHandlerProxy {
fn r#set_color_adjustment(
&self,
mut color_adjustment: &ColorAdjustmentTable,
) -> Result<(), fidl::Error> {
self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
(color_adjustment,),
0x6277992fee8aea3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ColorAdjustmentHandlerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ColorAdjustmentHandlerEventStream {}
impl futures::stream::FusedStream for ColorAdjustmentHandlerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ColorAdjustmentHandlerEventStream {
type Item = Result<ColorAdjustmentHandlerEvent, 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(ColorAdjustmentHandlerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ColorAdjustmentHandlerEvent {}
impl ColorAdjustmentHandlerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ColorAdjustmentHandlerEvent, 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:
<ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ColorAdjustmentHandlerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ColorAdjustmentHandlerRequestStream {}
impl futures::stream::FusedStream for ColorAdjustmentHandlerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ColorAdjustmentHandlerRequestStream {
type Protocol = ColorAdjustmentHandlerMarker;
type ControlHandle = ColorAdjustmentHandlerControlHandle;
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 {
ColorAdjustmentHandlerControlHandle { 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 ColorAdjustmentHandlerRequestStream {
type Item = Result<ColorAdjustmentHandlerRequest, 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 ColorAdjustmentHandlerRequestStream 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 {
0x6277992fee8aea3d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ColorAdjustmentHandlerSetColorAdjustmentRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ColorAdjustmentHandlerControlHandle {
inner: this.inner.clone(),
};
Ok(ColorAdjustmentHandlerRequest::SetColorAdjustment {color_adjustment: req.color_adjustment,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ColorAdjustmentHandlerRequest {
SetColorAdjustment {
color_adjustment: ColorAdjustmentTable,
control_handle: ColorAdjustmentHandlerControlHandle,
},
}
impl ColorAdjustmentHandlerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_color_adjustment(
self,
) -> Option<(ColorAdjustmentTable, ColorAdjustmentHandlerControlHandle)> {
if let ColorAdjustmentHandlerRequest::SetColorAdjustment {
color_adjustment,
control_handle,
} = self
{
Some((color_adjustment, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ColorAdjustmentHandlerRequest::SetColorAdjustment { .. } => "set_color_adjustment",
}
}
}
#[derive(Debug, Clone)]
pub struct ColorAdjustmentHandlerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ColorAdjustmentHandlerControlHandle {
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 ColorAdjustmentHandlerControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ControlMarker;
impl fidl::endpoints::ProtocolMarker for ControlMarker {
type Proxy = ControlProxy;
type RequestStream = ControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.Control";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
pub type ControlGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
pub trait ControlProxyInterface: Send + Sync {
fn r#set_auto_brightness(&self) -> Result<(), fidl::Error>;
type WatchAutoBrightnessResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
+ Send;
fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut;
fn r#set_manual_brightness(&self, value: f32) -> Result<(), fidl::Error>;
fn r#set_manual_brightness_smooth(&self, value: f32, duration: i64) -> Result<(), fidl::Error>;
type WatchCurrentBrightnessResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
+ Send;
fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut;
fn r#set_auto_brightness_adjustment(&self, adjustment: f32) -> Result<(), fidl::Error>;
type WatchAutoBrightnessAdjustmentResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
+ Send;
fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut;
fn r#set_brightness_table(&self, table: &BrightnessTable) -> Result<(), fidl::Error>;
type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error>>
+ Send;
fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
type Proxy = ControlProxy;
type Protocol = ControlMarker;
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 ControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ControlMarker 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<ControlEvent, fidl::Error> {
ControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x46b623a7fa77a979,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_auto_brightness(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<bool, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ControlWatchAutoBrightnessResponse>(
(),
0xd956a90c115186b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.enabled)
}
pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
self.client.send::<ControlSetManualBrightnessRequest>(
(value,),
0x1e333aa49771e1eb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_manual_brightness_smooth(
&self,
mut value: f32,
mut duration: i64,
) -> Result<(), fidl::Error> {
self.client.send::<ControlSetManualBrightnessSmoothRequest>(
(value, duration),
0x7b7d273c20a61d0c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_current_brightness(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<f32, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ControlWatchCurrentBrightnessResponse>(
(),
0x2cc3011e2326d4d8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.value)
}
pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
(adjustment,),
0x678ee26bc217d996,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_auto_brightness_adjustment(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<f32, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
ControlWatchAutoBrightnessAdjustmentResponse,
>(
(),
0x7c373aafe0058135,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.adjustment)
}
pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
self.client.send::<ControlSetBrightnessTableRequest>(
(table,),
0x11d419413129dcee,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_max_absolute_brightness(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
>(
(),
0x73055a8d6422caf8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.max_brightness))
}
}
#[derive(Debug, Clone)]
pub struct ControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ControlProxy {
type Protocol = ControlMarker;
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 ControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ControlEventStream {
ControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
ControlProxyInterface::r#set_auto_brightness(self)
}
pub fn r#watch_auto_brightness(
&self,
) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
ControlProxyInterface::r#watch_auto_brightness(self)
}
pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
ControlProxyInterface::r#set_manual_brightness(self, value)
}
pub fn r#set_manual_brightness_smooth(
&self,
mut value: f32,
mut duration: i64,
) -> Result<(), fidl::Error> {
ControlProxyInterface::r#set_manual_brightness_smooth(self, value, duration)
}
pub fn r#watch_current_brightness(
&self,
) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
ControlProxyInterface::r#watch_current_brightness(self)
}
pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
ControlProxyInterface::r#set_auto_brightness_adjustment(self, adjustment)
}
pub fn r#watch_auto_brightness_adjustment(
&self,
) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
ControlProxyInterface::r#watch_auto_brightness_adjustment(self)
}
pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
ControlProxyInterface::r#set_brightness_table(self, table)
}
pub fn r#get_max_absolute_brightness(
&self,
) -> fidl::client::QueryResponseFut<
ControlGetMaxAbsoluteBrightnessResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControlProxyInterface::r#get_max_absolute_brightness(self)
}
}
impl ControlProxyInterface for ControlProxy {
fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x46b623a7fa77a979,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchAutoBrightnessResponseFut =
fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ControlWatchAutoBrightnessResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xd956a90c115186b,
>(_buf?)?;
Ok(_response.enabled)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
(),
0xd956a90c115186b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
self.client.send::<ControlSetManualBrightnessRequest>(
(value,),
0x1e333aa49771e1eb,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_manual_brightness_smooth(
&self,
mut value: f32,
mut duration: i64,
) -> Result<(), fidl::Error> {
self.client.send::<ControlSetManualBrightnessSmoothRequest>(
(value, duration),
0x7b7d273c20a61d0c,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchCurrentBrightnessResponseFut =
fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ControlWatchCurrentBrightnessResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2cc3011e2326d4d8,
>(_buf?)?;
Ok(_response.value)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
(),
0x2cc3011e2326d4d8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
(adjustment,),
0x678ee26bc217d996,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchAutoBrightnessAdjustmentResponseFut =
fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ControlWatchAutoBrightnessAdjustmentResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7c373aafe0058135,
>(_buf?)?;
Ok(_response.adjustment)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
(),
0x7c373aafe0058135,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
self.client.send::<ControlSetBrightnessTableRequest>(
(table,),
0x11d419413129dcee,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
ControlGetMaxAbsoluteBrightnessResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x73055a8d6422caf8,
>(_buf?)?;
Ok(_response.map(|x| x.max_brightness))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
ControlGetMaxAbsoluteBrightnessResult,
>(
(),
0x73055a8d6422caf8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ControlEventStream {}
impl futures::stream::FusedStream for ControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ControlEventStream {
type Item = Result<ControlEvent, 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(ControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ControlEvent {}
impl ControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ControlEvent, 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: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ControlRequestStream {}
impl futures::stream::FusedStream for ControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ControlRequestStream {
type Protocol = ControlMarker;
type ControlHandle = ControlControlHandle;
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 {
ControlControlHandle { 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 ControlRequestStream {
type Item = Result<ControlRequest, 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 ControlRequestStream 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 {
0x46b623a7fa77a979 => {
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 = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::SetAutoBrightness { control_handle })
}
0xd956a90c115186b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
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 = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::WatchAutoBrightness {
responder: ControlWatchAutoBrightnessResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1e333aa49771e1eb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControlSetManualBrightnessRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::SetManualBrightness { value: req.value, control_handle })
}
0x7b7d273c20a61d0c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControlSetManualBrightnessSmoothRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessSmoothRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::SetManualBrightnessSmooth {
value: req.value,
duration: req.duration,
control_handle,
})
}
0x2cc3011e2326d4d8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
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 = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::WatchCurrentBrightness {
responder: ControlWatchCurrentBrightnessResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x678ee26bc217d996 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControlSetAutoBrightnessAdjustmentRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetAutoBrightnessAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::SetAutoBrightnessAdjustment {
adjustment: req.adjustment,
control_handle,
})
}
0x7c373aafe0058135 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
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 = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::WatchAutoBrightnessAdjustment {
responder: ControlWatchAutoBrightnessAdjustmentResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x11d419413129dcee => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControlSetBrightnessTableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetBrightnessTableRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::SetBrightnessTable { table: req.table, control_handle })
}
0x73055a8d6422caf8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
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 = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::GetMaxAbsoluteBrightness {
responder: ControlGetMaxAbsoluteBrightnessResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ControlRequest {
SetAutoBrightness { control_handle: ControlControlHandle },
WatchAutoBrightness { responder: ControlWatchAutoBrightnessResponder },
SetManualBrightness { value: f32, control_handle: ControlControlHandle },
SetManualBrightnessSmooth { value: f32, duration: i64, control_handle: ControlControlHandle },
WatchCurrentBrightness { responder: ControlWatchCurrentBrightnessResponder },
SetAutoBrightnessAdjustment { adjustment: f32, control_handle: ControlControlHandle },
WatchAutoBrightnessAdjustment { responder: ControlWatchAutoBrightnessAdjustmentResponder },
SetBrightnessTable { table: BrightnessTable, control_handle: ControlControlHandle },
GetMaxAbsoluteBrightness { responder: ControlGetMaxAbsoluteBrightnessResponder },
}
impl ControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_auto_brightness(self) -> Option<(ControlControlHandle)> {
if let ControlRequest::SetAutoBrightness { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_auto_brightness(self) -> Option<(ControlWatchAutoBrightnessResponder)> {
if let ControlRequest::WatchAutoBrightness { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_manual_brightness(self) -> Option<(f32, ControlControlHandle)> {
if let ControlRequest::SetManualBrightness { value, control_handle } = self {
Some((value, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_manual_brightness_smooth(self) -> Option<(f32, i64, ControlControlHandle)> {
if let ControlRequest::SetManualBrightnessSmooth { value, duration, control_handle } = self
{
Some((value, duration, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_current_brightness(self) -> Option<(ControlWatchCurrentBrightnessResponder)> {
if let ControlRequest::WatchCurrentBrightness { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_auto_brightness_adjustment(self) -> Option<(f32, ControlControlHandle)> {
if let ControlRequest::SetAutoBrightnessAdjustment { adjustment, control_handle } = self {
Some((adjustment, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_auto_brightness_adjustment(
self,
) -> Option<(ControlWatchAutoBrightnessAdjustmentResponder)> {
if let ControlRequest::WatchAutoBrightnessAdjustment { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_brightness_table(self) -> Option<(BrightnessTable, ControlControlHandle)> {
if let ControlRequest::SetBrightnessTable { table, control_handle } = self {
Some((table, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_max_absolute_brightness(
self,
) -> Option<(ControlGetMaxAbsoluteBrightnessResponder)> {
if let ControlRequest::GetMaxAbsoluteBrightness { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ControlRequest::SetAutoBrightness { .. } => "set_auto_brightness",
ControlRequest::WatchAutoBrightness { .. } => "watch_auto_brightness",
ControlRequest::SetManualBrightness { .. } => "set_manual_brightness",
ControlRequest::SetManualBrightnessSmooth { .. } => "set_manual_brightness_smooth",
ControlRequest::WatchCurrentBrightness { .. } => "watch_current_brightness",
ControlRequest::SetAutoBrightnessAdjustment { .. } => "set_auto_brightness_adjustment",
ControlRequest::WatchAutoBrightnessAdjustment { .. } => {
"watch_auto_brightness_adjustment"
}
ControlRequest::SetBrightnessTable { .. } => "set_brightness_table",
ControlRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
}
}
}
#[derive(Debug, Clone)]
pub struct ControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ControlControlHandle {
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 ControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControlWatchAutoBrightnessResponder {
control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControlWatchAutoBrightnessResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControlWatchAutoBrightnessResponder {
type ControlHandle = ControlControlHandle;
fn control_handle(&self) -> &ControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControlWatchAutoBrightnessResponder {
pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(enabled);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(enabled);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ControlWatchAutoBrightnessResponse>(
(enabled,),
self.tx_id,
0xd956a90c115186b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControlWatchCurrentBrightnessResponder {
control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControlWatchCurrentBrightnessResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControlWatchCurrentBrightnessResponder {
type ControlHandle = ControlControlHandle;
fn control_handle(&self) -> &ControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControlWatchCurrentBrightnessResponder {
pub fn send(self, mut value: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(value);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut value: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(value);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut value: f32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ControlWatchCurrentBrightnessResponse>(
(value,),
self.tx_id,
0x2cc3011e2326d4d8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControlWatchAutoBrightnessAdjustmentResponder {
control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControlWatchAutoBrightnessAdjustmentResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControlWatchAutoBrightnessAdjustmentResponder {
type ControlHandle = ControlControlHandle;
fn control_handle(&self) -> &ControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControlWatchAutoBrightnessAdjustmentResponder {
pub fn send(self, mut adjustment: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(adjustment);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut adjustment: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(adjustment);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ControlWatchAutoBrightnessAdjustmentResponse>(
(adjustment,),
self.tx_id,
0x7c373aafe0058135,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControlGetMaxAbsoluteBrightnessResponder {
control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControlGetMaxAbsoluteBrightnessResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControlGetMaxAbsoluteBrightnessResponder {
type ControlHandle = ControlControlHandle;
fn control_handle(&self) -> &ControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControlGetMaxAbsoluteBrightnessResponder {
pub fn send(self, mut result: Result<f64, 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<f64, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
ControlGetMaxAbsoluteBrightnessResponse,
i32,
>>(
result.map(|max_brightness| (max_brightness,)),
self.tx_id,
0x73055a8d6422caf8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for BrightnessPoint {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BrightnessPoint {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BrightnessPoint, D>
for &BrightnessPoint
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BrightnessPoint>(offset);
fidl::encoding::Encode::<BrightnessPoint, D>::encode(
(
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.ambient_lux),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_nits),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f32, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<BrightnessPoint, 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::<BrightnessPoint>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessPoint {
#[inline(always)]
fn new_empty() -> Self {
Self { ambient_lux: fidl::new_empty!(f32, D), display_nits: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.ambient_lux, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.display_nits, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BrightnessTable {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BrightnessTable {
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<BrightnessTable, D>
for &BrightnessTable
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BrightnessTable>(offset);
fidl::encoding::Encode::<BrightnessTable, D>::encode(
(
<fidl::encoding::Vector<BrightnessPoint, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.points),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<BrightnessPoint, 50>, D>,
> fidl::encoding::Encode<BrightnessTable, 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::<BrightnessTable>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessTable {
#[inline(always)]
fn new_empty() -> Self {
Self { points: fidl::new_empty!(fidl::encoding::Vector<BrightnessPoint, 50>, 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::Vector<BrightnessPoint, 50>, D, &mut self.points, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
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<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>
for &ColorAdjustmentHandlerSetColorAdjustmentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
fidl::encoding::Encode::<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>::encode(
(<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
&self.color_adjustment,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
> fidl::encoding::Encode<ColorAdjustmentHandlerSetColorAdjustmentRequest, 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::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ColorAdjustmentHandlerSetColorAdjustmentRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, 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!(
ColorAdjustmentTable,
D,
&mut self.color_adjustment,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
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<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>
for &ColorAdjustmentSetDiscreteColorAdjustmentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
fidl::encoding::Encode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>::encode(
(<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
&self.color_adjustment,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
> fidl::encoding::Encode<ColorAdjustmentSetDiscreteColorAdjustmentRequest, 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::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ColorAdjustmentSetDiscreteColorAdjustmentRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, 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!(
ColorAdjustmentTable,
D,
&mut self.color_adjustment,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, D>
for &ControlSetAutoBrightnessAdjustmentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
fidl::encoding::Encode::<ControlSetAutoBrightnessAdjustmentRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, 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::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlSetAutoBrightnessAdjustmentRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { adjustment: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlSetBrightnessTableRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlSetBrightnessTableRequest {
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<ControlSetBrightnessTableRequest, D>
for &ControlSetBrightnessTableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlSetBrightnessTableRequest>(offset);
fidl::encoding::Encode::<ControlSetBrightnessTableRequest, D>::encode(
(<BrightnessTable as fidl::encoding::ValueTypeMarker>::borrow(&self.table),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BrightnessTable, D>>
fidl::encoding::Encode<ControlSetBrightnessTableRequest, 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::<ControlSetBrightnessTableRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlSetBrightnessTableRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { table: fidl::new_empty!(BrightnessTable, 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!(BrightnessTable, D, &mut self.table, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlSetManualBrightnessRequest, D>
for &ControlSetManualBrightnessRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlSetManualBrightnessRequest>(offset);
fidl::encoding::Encode::<ControlSetManualBrightnessRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<ControlSetManualBrightnessRequest, 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::<ControlSetManualBrightnessRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlSetManualBrightnessRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessSmoothRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessSmoothRequest {
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<ControlSetManualBrightnessSmoothRequest, D>
for &ControlSetManualBrightnessSmoothRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlSetManualBrightnessSmoothRequest>(offset);
fidl::encoding::Encode::<ControlSetManualBrightnessSmoothRequest, D>::encode(
(
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f32, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<ControlSetManualBrightnessSmoothRequest, 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::<ControlSetManualBrightnessSmoothRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlSetManualBrightnessSmoothRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(f32, D), duration: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, D>
for &ControlWatchAutoBrightnessAdjustmentResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
fidl::encoding::Encode::<ControlWatchAutoBrightnessAdjustmentResponse, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, 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::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlWatchAutoBrightnessAdjustmentResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { adjustment: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, D>
for &ControlWatchAutoBrightnessResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlWatchAutoBrightnessResponse>(offset);
fidl::encoding::Encode::<ControlWatchAutoBrightnessResponse, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, 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::<ControlWatchAutoBrightnessResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlWatchAutoBrightnessResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlWatchCurrentBrightnessResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlWatchCurrentBrightnessResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, D>
for &ControlWatchCurrentBrightnessResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlWatchCurrentBrightnessResponse>(offset);
fidl::encoding::Encode::<ControlWatchCurrentBrightnessResponse, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, 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::<ControlWatchCurrentBrightnessResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlWatchCurrentBrightnessResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, D>
for &ControlGetMaxAbsoluteBrightnessResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
fidl::encoding::Encode::<ControlGetMaxAbsoluteBrightnessResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_brightness),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, 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::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControlGetMaxAbsoluteBrightnessResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { max_brightness: fidl::new_empty!(f64, 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!(f64, D, &mut self.max_brightness, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl ColorAdjustmentTable {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.matrix {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ColorAdjustmentTable {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentTable {
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<ColorAdjustmentTable, D>
for &ColorAdjustmentTable
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ColorAdjustmentTable>(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::Array<f32, 9>, D>(
self.matrix.as_ref().map(
<fidl::encoding::Array<f32, 9> 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 ColorAdjustmentTable {
#[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::Array<f32, 9> 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
.matrix
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 9>, D));
fidl::decode!(fidl::encoding::Array<f32, 9>, 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(())
}
}
}