#![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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum WantResponse {
Success = 1,
Err = 2,
}
impl WantResponse {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Success),
2 => Some(Self::Err),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ComposedEchoUnionResponseWithErrorComposedRequest {
pub value: i64,
pub want_absolute_value: bool,
pub forward_to_server: String,
pub result_err: u32,
pub result_variant: WantResponse,
}
impl fidl::Persistable for ComposedEchoUnionResponseWithErrorComposedRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ErrorableRequestStruct {
pub value: SimpleStruct,
pub result_err: u32,
pub forward_to_server: String,
pub result_variant: WantResponse,
}
impl fidl::Persistable for ErrorableRequestStruct {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EventTriggeringRequestStruct {
pub value: SimpleStruct,
pub forward_to_server: String,
}
impl fidl::Persistable for EventTriggeringRequestStruct {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RequestStruct {
pub value: SimpleStruct,
pub forward_to_server: String,
}
impl fidl::Persistable for RequestStruct {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ResponseStruct {
pub value: SimpleStruct,
}
impl fidl::Persistable for ResponseStruct {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SimpleStruct {
pub f1: bool,
pub f2: u64,
}
impl fidl::Persistable for SimpleStruct {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ComposedEchoTableRequestComposedRequest {
pub value: Option<u64>,
pub forward_to_server: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ComposedEchoTableRequestComposedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ComposedEchoUnionResponseWithErrorComposedResponse {
Unsigned(u64),
Signed(i64),
}
impl ComposedEchoUnionResponseWithErrorComposedResponse {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Unsigned(_) => 1,
Self::Signed(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for ComposedEchoUnionResponseWithErrorComposedResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ComposedMarker;
impl fidl::endpoints::ProtocolMarker for ComposedMarker {
type Proxy = ComposedProxy;
type RequestStream = ComposedRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ComposedSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Composed";
}
pub type ComposedEchoUnionResponseWithErrorComposedResult =
Result<ComposedEchoUnionResponseWithErrorComposedResponse, u32>;
pub trait ComposedProxyInterface: Send + Sync {
type EchoTableRequestComposedResponseFut: std::future::Future<Output = Result<SimpleStruct, fidl::Error>>
+ Send;
fn r#echo_table_request_composed(
&self,
payload: &ComposedEchoTableRequestComposedRequest,
) -> Self::EchoTableRequestComposedResponseFut;
type EchoUnionResponseWithErrorComposedResponseFut: std::future::Future<
Output = Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error>,
> + Send;
fn r#echo_union_response_with_error_composed(
&self,
value: i64,
want_absolute_value: bool,
forward_to_server: &str,
result_err: u32,
result_variant: WantResponse,
) -> Self::EchoUnionResponseWithErrorComposedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ComposedSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ComposedSynchronousProxy {
type Proxy = ComposedProxy;
type Protocol = ComposedMarker;
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 ComposedSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ComposedMarker 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<ComposedEvent, fidl::Error> {
ComposedEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#echo_table_request_composed(
&self,
mut payload: &ComposedEchoTableRequestComposedRequest,
___deadline: zx::MonotonicInstant,
) -> Result<SimpleStruct, fidl::Error> {
let _response =
self.client.send_query::<ComposedEchoTableRequestComposedRequest, ResponseStruct>(
payload,
0x1d545c738c7a8ee,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.value)
}
pub fn r#echo_union_response_with_error_composed(
&self,
mut value: i64,
mut want_absolute_value: bool,
mut forward_to_server: &str,
mut result_err: u32,
mut result_variant: WantResponse,
___deadline: zx::MonotonicInstant,
) -> Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error> {
let _response = self.client.send_query::<
ComposedEchoUnionResponseWithErrorComposedRequest,
fidl::encoding::ResultType<ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
>(
(value, want_absolute_value, forward_to_server, result_err, result_variant,),
0x38a67e88d6106443,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ComposedProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ComposedProxy {
type Protocol = ComposedMarker;
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 ComposedProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ComposedEventStream {
ComposedEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#echo_table_request_composed(
&self,
mut payload: &ComposedEchoTableRequestComposedRequest,
) -> fidl::client::QueryResponseFut<SimpleStruct, fidl::encoding::DefaultFuchsiaResourceDialect>
{
ComposedProxyInterface::r#echo_table_request_composed(self, payload)
}
pub fn r#echo_union_response_with_error_composed(
&self,
mut value: i64,
mut want_absolute_value: bool,
mut forward_to_server: &str,
mut result_err: u32,
mut result_variant: WantResponse,
) -> fidl::client::QueryResponseFut<
ComposedEchoUnionResponseWithErrorComposedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ComposedProxyInterface::r#echo_union_response_with_error_composed(
self,
value,
want_absolute_value,
forward_to_server,
result_err,
result_variant,
)
}
}
impl ComposedProxyInterface for ComposedProxy {
type EchoTableRequestComposedResponseFut =
fidl::client::QueryResponseFut<SimpleStruct, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#echo_table_request_composed(
&self,
mut payload: &ComposedEchoTableRequestComposedRequest,
) -> Self::EchoTableRequestComposedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SimpleStruct, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ResponseStruct,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1d545c738c7a8ee,
>(_buf?)?;
Ok(_response.value)
}
self.client.send_query_and_decode::<ComposedEchoTableRequestComposedRequest, SimpleStruct>(
payload,
0x1d545c738c7a8ee,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type EchoUnionResponseWithErrorComposedResponseFut = fidl::client::QueryResponseFut<
ComposedEchoUnionResponseWithErrorComposedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#echo_union_response_with_error_composed(
&self,
mut value: i64,
mut want_absolute_value: bool,
mut forward_to_server: &str,
mut result_err: u32,
mut result_variant: WantResponse,
) -> Self::EchoUnionResponseWithErrorComposedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x38a67e88d6106443,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ComposedEchoUnionResponseWithErrorComposedRequest,
ComposedEchoUnionResponseWithErrorComposedResult,
>(
(value, want_absolute_value, forward_to_server, result_err, result_variant,),
0x38a67e88d6106443,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ComposedEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ComposedEventStream {}
impl futures::stream::FusedStream for ComposedEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ComposedEventStream {
type Item = Result<ComposedEvent, 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(ComposedEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ComposedEvent {}
impl ComposedEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ComposedEvent, 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: <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ComposedRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ComposedRequestStream {}
impl futures::stream::FusedStream for ComposedRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ComposedRequestStream {
type Protocol = ComposedMarker;
type ControlHandle = ComposedControlHandle;
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 {
ComposedControlHandle { 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 ComposedRequestStream {
type Item = Result<ComposedRequest, 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 ComposedRequestStream 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 {
0x1d545c738c7a8ee => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ComposedEchoTableRequestComposedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedEchoTableRequestComposedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ComposedControlHandle { inner: this.inner.clone() };
Ok(ComposedRequest::EchoTableRequestComposed {
payload: req,
responder: ComposedEchoTableRequestComposedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x38a67e88d6106443 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ComposedEchoUnionResponseWithErrorComposedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedEchoUnionResponseWithErrorComposedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ComposedControlHandle { inner: this.inner.clone() };
Ok(ComposedRequest::EchoUnionResponseWithErrorComposed {
value: req.value,
want_absolute_value: req.want_absolute_value,
forward_to_server: req.forward_to_server,
result_err: req.result_err,
result_variant: req.result_variant,
responder: ComposedEchoUnionResponseWithErrorComposedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ComposedRequest {
EchoTableRequestComposed {
payload: ComposedEchoTableRequestComposedRequest,
responder: ComposedEchoTableRequestComposedResponder,
},
EchoUnionResponseWithErrorComposed {
value: i64,
want_absolute_value: bool,
forward_to_server: String,
result_err: u32,
result_variant: WantResponse,
responder: ComposedEchoUnionResponseWithErrorComposedResponder,
},
}
impl ComposedRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_echo_table_request_composed(
self,
) -> Option<(ComposedEchoTableRequestComposedRequest, ComposedEchoTableRequestComposedResponder)>
{
if let ComposedRequest::EchoTableRequestComposed { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_echo_union_response_with_error_composed(
self,
) -> Option<(
i64,
bool,
String,
u32,
WantResponse,
ComposedEchoUnionResponseWithErrorComposedResponder,
)> {
if let ComposedRequest::EchoUnionResponseWithErrorComposed {
value,
want_absolute_value,
forward_to_server,
result_err,
result_variant,
responder,
} = self
{
Some((
value,
want_absolute_value,
forward_to_server,
result_err,
result_variant,
responder,
))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ComposedRequest::EchoTableRequestComposed { .. } => "echo_table_request_composed",
ComposedRequest::EchoUnionResponseWithErrorComposed { .. } => {
"echo_union_response_with_error_composed"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ComposedControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ComposedControlHandle {
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 ComposedControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ComposedEchoTableRequestComposedResponder {
control_handle: std::mem::ManuallyDrop<ComposedControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ComposedEchoTableRequestComposedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ComposedEchoTableRequestComposedResponder {
type ControlHandle = ComposedControlHandle;
fn control_handle(&self) -> &ComposedControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ComposedEchoTableRequestComposedResponder {
pub fn send(self, mut value: &SimpleStruct) -> 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: &SimpleStruct) -> Result<(), fidl::Error> {
let _result = self.send_raw(value);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut value: &SimpleStruct) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ResponseStruct>(
(value,),
self.tx_id,
0x1d545c738c7a8ee,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ComposedEchoUnionResponseWithErrorComposedResponder {
control_handle: std::mem::ManuallyDrop<ComposedControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ComposedEchoUnionResponseWithErrorComposedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ComposedEchoUnionResponseWithErrorComposedResponder {
type ControlHandle = ComposedControlHandle;
fn control_handle(&self) -> &ComposedControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ComposedEchoUnionResponseWithErrorComposedResponder {
pub fn send(
self,
mut result: Result<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
) -> 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<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
ComposedEchoUnionResponseWithErrorComposedResponse,
u32,
>>(
result,
self.tx_id,
0x38a67e88d6106443,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for WantResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for WantResponse {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WantResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WantResponse {
#[inline(always)]
fn new_empty() -> Self {
Self::Success
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ComposedEchoUnionResponseWithErrorComposedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ComposedEchoUnionResponseWithErrorComposedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ComposedEchoUnionResponseWithErrorComposedRequest, D>
for &ComposedEchoUnionResponseWithErrorComposedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedRequest>(offset);
fidl::encoding::Encode::<ComposedEchoUnionResponseWithErrorComposedRequest, D>::encode(
(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_absolute_value),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.forward_to_server,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.result_err),
<WantResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.result_variant),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<WantResponse, D>,
> fidl::encoding::Encode<ComposedEchoUnionResponseWithErrorComposedRequest, D>
for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
self.4.encode(encoder, offset + 36, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ComposedEchoUnionResponseWithErrorComposedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
value: fidl::new_empty!(i64, D),
want_absolute_value: fidl::new_empty!(bool, D),
forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
result_err: fidl::new_empty!(u32, D),
result_variant: fidl::new_empty!(WantResponse, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i64, D, &mut self.value, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.want_absolute_value, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.forward_to_server,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(u32, D, &mut self.result_err, decoder, offset + 32, _depth)?;
fidl::decode!(WantResponse, D, &mut self.result_variant, decoder, offset + 36, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ErrorableRequestStruct {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ErrorableRequestStruct {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ErrorableRequestStruct, D> for &ErrorableRequestStruct
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ErrorableRequestStruct>(offset);
fidl::encoding::Encode::<ErrorableRequestStruct, D>::encode(
(
<SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.result_err),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.forward_to_server,
),
<WantResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.result_variant),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SimpleStruct, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T3: fidl::encoding::Encode<WantResponse, D>,
> fidl::encoding::Encode<ErrorableRequestStruct, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ErrorableRequestStruct>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ErrorableRequestStruct
{
#[inline(always)]
fn new_empty() -> Self {
Self {
value: fidl::new_empty!(SimpleStruct, D),
result_err: fidl::new_empty!(u32, D),
forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
result_variant: fidl::new_empty!(WantResponse, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.result_err, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.forward_to_server,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(WantResponse, D, &mut self.result_variant, decoder, offset + 40, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EventTriggeringRequestStruct {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EventTriggeringRequestStruct {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EventTriggeringRequestStruct, D> for &EventTriggeringRequestStruct
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EventTriggeringRequestStruct>(offset);
fidl::encoding::Encode::<EventTriggeringRequestStruct, D>::encode(
(
<SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.forward_to_server,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SimpleStruct, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<EventTriggeringRequestStruct, 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::<EventTriggeringRequestStruct>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EventTriggeringRequestStruct
{
#[inline(always)]
fn new_empty() -> Self {
Self {
value: fidl::new_empty!(SimpleStruct, D),
forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.forward_to_server,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RequestStruct {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RequestStruct {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RequestStruct, D>
for &RequestStruct
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RequestStruct>(offset);
fidl::encoding::Encode::<RequestStruct, D>::encode(
(
<SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.forward_to_server,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SimpleStruct, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<RequestStruct, 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::<RequestStruct>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequestStruct {
#[inline(always)]
fn new_empty() -> Self {
Self {
value: fidl::new_empty!(SimpleStruct, D),
forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.forward_to_server,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ResponseStruct {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ResponseStruct {
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<ResponseStruct, D>
for &ResponseStruct
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ResponseStruct>(offset);
fidl::encoding::Encode::<ResponseStruct, D>::encode(
(<SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SimpleStruct, D>>
fidl::encoding::Encode<ResponseStruct, 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::<ResponseStruct>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResponseStruct {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(SimpleStruct, 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!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SimpleStruct {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SimpleStruct {
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<SimpleStruct, D>
for &SimpleStruct
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SimpleStruct>(offset);
fidl::encoding::Encode::<SimpleStruct, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.f1),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.f2),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<SimpleStruct, 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::<SimpleStruct>(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 SimpleStruct {
#[inline(always)]
fn new_empty() -> Self {
Self { f1: fidl::new_empty!(bool, D), f2: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(bool, D, &mut self.f1, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.f2, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl ComposedEchoTableRequestComposedRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.forward_to_server {
return 2;
}
if let Some(_) = self.value {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ComposedEchoTableRequestComposedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ComposedEchoTableRequestComposedRequest {
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<ComposedEchoTableRequestComposedRequest, D>
for &ComposedEchoTableRequestComposedRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ComposedEchoTableRequestComposedRequest>(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::<u64, D>(
self.value.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
self.forward_to_server.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ComposedEchoTableRequestComposedRequest
{
#[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 =
<u64 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.value.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.forward_to_server
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
fidl::decode!(
fidl::encoding::UnboundedString,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ComposedEchoUnionResponseWithErrorComposedResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ComposedEchoUnionResponseWithErrorComposedResponse {
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<ComposedEchoUnionResponseWithErrorComposedResponse, D>
for &ComposedEchoUnionResponseWithErrorComposedResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedResponse>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(ref val) => {
fidl::encoding::encode_in_envelope::<u64, D>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ComposedEchoUnionResponseWithErrorComposedResponse::Signed(ref val) => {
fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ComposedEchoUnionResponseWithErrorComposedResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::Unsigned(fidl::new_empty!(u64, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(_) = self {
} else {
*self = ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(
fidl::new_empty!(u64, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(
ref mut val,
) = self
{
fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ComposedEchoUnionResponseWithErrorComposedResponse::Signed(_) = self {
} else {
*self = ComposedEchoUnionResponseWithErrorComposedResponse::Signed(
fidl::new_empty!(i64, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ComposedEchoUnionResponseWithErrorComposedResponse::Signed(ref mut val) =
self
{
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}