blob: 06a61c2f672a480dc97cc8f87ad2809b8129ef96 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = no_optional_structs
// fidl_experiment = output_index_json
// fidl_experiment = simple_empty_response_syntax
// fidl_experiment = unknown_interactions
// fidl_experiment = unknown_interactions_mandate
#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SuperFooRequest {
pub s: String,
}
impl fidl::Persistable for SuperFooRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SuperFooResponse {
pub y: i64,
}
impl fidl::Persistable for SuperFooResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SubMarker;
impl fidl::endpoints::ProtocolMarker for SubMarker {
type Proxy = SubProxy;
type RequestStream = SubRequestStream;
const DEBUG_NAME: &'static str = "(anonymous) Sub";
}
pub trait SubProxyInterface: Send + Sync {
type FooResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#foo(&self, s: &str) -> Self::FooResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SubSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl SubSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SubMarker 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()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<SubEvent, fidl::Error> {
SubEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#foo(&self, mut s: &str, ___deadline: zx::Time) -> Result<i64, fidl::Error> {
let _response = self.client.send_query::<SuperFooRequest, SuperFooResponse>(
(s,),
0x68a61c2a230db8b8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.y)
}
}
#[derive(Debug, Clone)]
pub struct SubProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for SubProxy {
type Protocol = SubMarker;
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 SubProxy {
/// Create a new Proxy for Sub
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <SubMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the Sub protocol
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> SubEventStream {
SubEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#foo(&self, mut s: &str) -> fidl::client::QueryResponseFut<i64> {
SubProxyInterface::r#foo(self, s)
}
}
impl SubProxyInterface for SubProxy {
type FooResponseFut = fidl::client::QueryResponseFut<i64>;
fn r#foo(&self, mut s: &str) -> Self::FooResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<SuperFooResponse>(_buf?)?;
Ok(_response.y)
}
self.client.send_query_and_decode::<SuperFooRequest, i64>(
(s,),
0x68a61c2a230db8b8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SubEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for SubEventStream {}
impl futures::stream::FusedStream for SubEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SubEventStream {
type Item = Result<SubEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let buf = match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => buf,
None => return std::task::Poll::Ready(None),
};
std::task::Poll::Ready(Some(SubEvent::decode(buf)))
}
}
#[derive(Debug)]
pub enum SubEvent {}
impl SubEvent {
/// Decodes a message buffer as a [`SubEvent`]. Transaction
/// ID in the message must be zero; this method does not check TXID.
fn decode(mut buf: fidl::MessageBufEtc) -> Result<SubEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
match tx_header.ordinal() {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal(),
protocol_name: <SubMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for Sub
pub struct SubRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for SubRequestStream {}
impl futures::stream::FusedStream for SubRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SubRequestStream {
type Protocol = SubMarker;
type ControlHandle = SubControlHandle;
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 {
SubControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for SubRequestStream {
type Item = Result<SubRequest, 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.poll_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled SubRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
if !header.is_compatible() {
return std::task::Poll::Ready(Some(Err(fidl::Error::IncompatibleMagicNumber(
header.magic_number(),
))));
}
std::task::Poll::Ready(Some(match header.ordinal() {
0x68a61c2a230db8b8 => {
let mut req = fidl::new_empty!(SuperFooRequest);
fidl::encoding::Decoder::decode_into::<SuperFooRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SubControlHandle { inner: this.inner.clone() };
Ok(SubRequest::Foo {
s: req.s,
responder: SubFooResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal(),
protocol_name: <SubMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum SubRequest {
Foo { s: String, responder: SubFooResponder },
}
impl SubRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_foo(self) -> Option<(String, SubFooResponder)> {
if let SubRequest::Foo { s, responder } = self {
Some((s, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
SubRequest::Foo { .. } => "foo",
}
}
}
#[derive(Debug, Clone)]
pub struct SubControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for SubControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl SubControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SubFooResponder {
control_handle: std::mem::ManuallyDrop<SubControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// Set the the channel to be shutdown (see [`SubControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for SubFooResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SubFooResponder {
type ControlHandle = SubControlHandle;
fn control_handle(&self) -> &SubControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl SubFooResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut y: i64) -> Result<(), fidl::Error> {
let r = self.send_raw(y);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// Similar to "send" but does not shutdown the channel if
/// an error occurs.
pub fn send_no_shutdown_on_err(self, mut y: i64) -> Result<(), fidl::Error> {
let r = self.send_raw(y);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut y: i64) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (y,),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<SuperFooResponse>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Super_Marker;
impl fidl::endpoints::ProtocolMarker for Super_Marker {
type Proxy = Super_Proxy;
type RequestStream = Super_RequestStream;
const DEBUG_NAME: &'static str = "(anonymous) Super_";
}
pub trait Super_ProxyInterface: Send + Sync {
type FooResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#foo(&self, s: &str) -> Self::FooResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct Super_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl Super_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <Super_Marker 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()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<Super_Event, fidl::Error> {
Super_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#foo(&self, mut s: &str, ___deadline: zx::Time) -> Result<i64, fidl::Error> {
let _response = self.client.send_query::<SuperFooRequest, SuperFooResponse>(
(s,),
0x68a61c2a230db8b8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.y)
}
}
#[derive(Debug, Clone)]
pub struct Super_Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for Super_Proxy {
type Protocol = Super_Marker;
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 Super_Proxy {
/// Create a new Proxy for Super_
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <Super_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the Super_ protocol
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> Super_EventStream {
Super_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#foo(&self, mut s: &str) -> fidl::client::QueryResponseFut<i64> {
Super_ProxyInterface::r#foo(self, s)
}
}
impl Super_ProxyInterface for Super_Proxy {
type FooResponseFut = fidl::client::QueryResponseFut<i64>;
fn r#foo(&self, mut s: &str) -> Self::FooResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<SuperFooResponse>(_buf?)?;
Ok(_response.y)
}
self.client.send_query_and_decode::<SuperFooRequest, i64>(
(s,),
0x68a61c2a230db8b8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct Super_EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for Super_EventStream {}
impl futures::stream::FusedStream for Super_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for Super_EventStream {
type Item = Result<Super_Event, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let buf = match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => buf,
None => return std::task::Poll::Ready(None),
};
std::task::Poll::Ready(Some(Super_Event::decode(buf)))
}
}
#[derive(Debug)]
pub enum Super_Event {}
impl Super_Event {
/// Decodes a message buffer as a [`Super_Event`]. Transaction
/// ID in the message must be zero; this method does not check TXID.
fn decode(mut buf: fidl::MessageBufEtc) -> Result<Super_Event, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
match tx_header.ordinal() {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal(),
protocol_name: <Super_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for Super_
pub struct Super_RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for Super_RequestStream {}
impl futures::stream::FusedStream for Super_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for Super_RequestStream {
type Protocol = Super_Marker;
type ControlHandle = Super_ControlHandle;
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 {
Super_ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for Super_RequestStream {
type Item = Result<Super_Request, 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.poll_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled Super_RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
if !header.is_compatible() {
return std::task::Poll::Ready(Some(Err(fidl::Error::IncompatibleMagicNumber(
header.magic_number(),
))));
}
std::task::Poll::Ready(Some(match header.ordinal() {
0x68a61c2a230db8b8 => {
let mut req = fidl::new_empty!(SuperFooRequest);
fidl::encoding::Decoder::decode_into::<SuperFooRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = Super_ControlHandle { inner: this.inner.clone() };
Ok(Super_Request::Foo {
s: req.s,
responder: Super_FooResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal(),
protocol_name: <Super_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum Super_Request {
Foo { s: String, responder: Super_FooResponder },
}
impl Super_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_foo(self) -> Option<(String, Super_FooResponder)> {
if let Super_Request::Foo { s, responder } = self {
Some((s, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
Super_Request::Foo { .. } => "foo",
}
}
}
#[derive(Debug, Clone)]
pub struct Super_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for Super_ControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl Super_ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Super_FooResponder {
control_handle: std::mem::ManuallyDrop<Super_ControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// Set the the channel to be shutdown (see [`Super_ControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for Super_FooResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Super_FooResponder {
type ControlHandle = Super_ControlHandle;
fn control_handle(&self) -> &Super_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl Super_FooResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut y: i64) -> Result<(), fidl::Error> {
let r = self.send_raw(y);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// Similar to "send" but does not shutdown the channel if
/// an error occurs.
pub fn send_no_shutdown_on_err(self, mut y: i64) -> Result<(), fidl::Error> {
let r = self.send_raw(y);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut y: i64) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (y,),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<SuperFooResponse>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for SuperFooRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 16,
fidl::encoding::WireFormatVersion::V2 => 16,
}
}
}
impl fidl::encoding::ValueTypeMarker for SuperFooRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SuperFooRequest> for &SuperFooRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SuperFooRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<SuperFooRequest>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.s,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>>
fidl::encoding::Encode<SuperFooRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SuperFooRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SuperFooRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(fidl::encoding::UnboundedString) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
match decoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
let member_offset = match decoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.s,
decoder,
offset + member_offset,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SuperFooResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for SuperFooResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SuperFooResponse> for &SuperFooResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SuperFooResponse>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SuperFooResponse)
.write_unaligned((self as *const SuperFooResponse).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i64>> fidl::encoding::Encode<SuperFooResponse> for (T0,) {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SuperFooResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SuperFooResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { y: fidl::new_empty!(i64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
}