#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CounterConnectToProtocolRequest {
pub protocol_name: String,
pub request: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for CounterConnectToProtocolRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct CounterIncrementResponse {
pub value: u32,
}
impl fidl::Persistable for CounterIncrementResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CounterOpenInNamespaceRequest {
pub path: String,
pub flags: fidl_fuchsia_io::Flags,
pub request: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for CounterOpenInNamespaceRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CounterTryOpenDirectoryRequest {
pub path: String,
}
impl fidl::Persistable for CounterTryOpenDirectoryRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CounterMarker;
impl fidl::endpoints::ProtocolMarker for CounterMarker {
type Proxy = CounterProxy;
type RequestStream = CounterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CounterSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netemul.test.Counter";
}
impl fidl::endpoints::DiscoverableProtocolMarker for CounterMarker {}
pub type CounterTryOpenDirectoryResult = Result<(), i32>;
pub trait CounterProxyInterface: Send + Sync {
type IncrementResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#increment(&self) -> Self::IncrementResponseFut;
fn r#connect_to_protocol(
&self,
protocol_name: &str,
request: fidl::Channel,
) -> Result<(), fidl::Error>;
fn r#open_in_namespace(
&self,
path: &str,
flags: fidl_fuchsia_io::Flags,
request: fidl::Channel,
) -> Result<(), fidl::Error>;
type TryOpenDirectoryResponseFut: std::future::Future<Output = Result<CounterTryOpenDirectoryResult, fidl::Error>>
+ Send;
fn r#try_open_directory(&self, path: &str) -> Self::TryOpenDirectoryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CounterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CounterSynchronousProxy {
type Proxy = CounterProxy;
type Protocol = CounterMarker;
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 CounterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CounterMarker 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<CounterEvent, fidl::Error> {
CounterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#increment(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, CounterIncrementResponse>(
(),
0x60cf610cd915d7a9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.value)
}
pub fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<CounterConnectToProtocolRequest>(
(protocol_name, request),
0x75ea8d3a0e7a4f68,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#open_in_namespace(
&self,
mut path: &str,
mut flags: fidl_fuchsia_io::Flags,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<CounterOpenInNamespaceRequest>(
(path, flags, request),
0x393b5808935aee83,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#try_open_directory(
&self,
mut path: &str,
___deadline: zx::MonotonicInstant,
) -> Result<CounterTryOpenDirectoryResult, fidl::Error> {
let _response = self.client.send_query::<
CounterTryOpenDirectoryRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(path,),
0x37310702b1c8b863,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct CounterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CounterProxy {
type Protocol = CounterMarker;
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 CounterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CounterEventStream {
CounterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#increment(
&self,
) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
CounterProxyInterface::r#increment(self)
}
pub fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
CounterProxyInterface::r#connect_to_protocol(self, protocol_name, request)
}
pub fn r#open_in_namespace(
&self,
mut path: &str,
mut flags: fidl_fuchsia_io::Flags,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
CounterProxyInterface::r#open_in_namespace(self, path, flags, request)
}
pub fn r#try_open_directory(
&self,
mut path: &str,
) -> fidl::client::QueryResponseFut<
CounterTryOpenDirectoryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
CounterProxyInterface::r#try_open_directory(self, path)
}
}
impl CounterProxyInterface for CounterProxy {
type IncrementResponseFut =
fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#increment(&self) -> Self::IncrementResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CounterIncrementResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x60cf610cd915d7a9,
>(_buf?)?;
Ok(_response.value)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x60cf610cd915d7a9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<CounterConnectToProtocolRequest>(
(protocol_name, request),
0x75ea8d3a0e7a4f68,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#open_in_namespace(
&self,
mut path: &str,
mut flags: fidl_fuchsia_io::Flags,
mut request: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<CounterOpenInNamespaceRequest>(
(path, flags, request),
0x393b5808935aee83,
fidl::encoding::DynamicFlags::empty(),
)
}
type TryOpenDirectoryResponseFut = fidl::client::QueryResponseFut<
CounterTryOpenDirectoryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#try_open_directory(&self, mut path: &str) -> Self::TryOpenDirectoryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<CounterTryOpenDirectoryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x37310702b1c8b863,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<CounterTryOpenDirectoryRequest, CounterTryOpenDirectoryResult>(
(path,),
0x37310702b1c8b863,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CounterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CounterEventStream {}
impl futures::stream::FusedStream for CounterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CounterEventStream {
type Item = Result<CounterEvent, 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(CounterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CounterEvent {}
impl CounterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CounterEvent, 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: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CounterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CounterRequestStream {}
impl futures::stream::FusedStream for CounterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CounterRequestStream {
type Protocol = CounterMarker;
type ControlHandle = CounterControlHandle;
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 {
CounterControlHandle { 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 CounterRequestStream {
type Item = Result<CounterRequest, 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 CounterRequestStream 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 {
0x60cf610cd915d7a9 => {
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 = CounterControlHandle { inner: this.inner.clone() };
Ok(CounterRequest::Increment {
responder: CounterIncrementResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75ea8d3a0e7a4f68 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
CounterConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CounterConnectToProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CounterControlHandle { inner: this.inner.clone() };
Ok(CounterRequest::ConnectToProtocol {
protocol_name: req.protocol_name,
request: req.request,
control_handle,
})
}
0x393b5808935aee83 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
CounterOpenInNamespaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CounterOpenInNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CounterControlHandle { inner: this.inner.clone() };
Ok(CounterRequest::OpenInNamespace {
path: req.path,
flags: req.flags,
request: req.request,
control_handle,
})
}
0x37310702b1c8b863 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CounterTryOpenDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CounterTryOpenDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CounterControlHandle { inner: this.inner.clone() };
Ok(CounterRequest::TryOpenDirectory {
path: req.path,
responder: CounterTryOpenDirectoryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CounterRequest {
Increment { responder: CounterIncrementResponder },
ConnectToProtocol {
protocol_name: String,
request: fidl::Channel,
control_handle: CounterControlHandle,
},
OpenInNamespace {
path: String,
flags: fidl_fuchsia_io::Flags,
request: fidl::Channel,
control_handle: CounterControlHandle,
},
TryOpenDirectory { path: String, responder: CounterTryOpenDirectoryResponder },
}
impl CounterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_increment(self) -> Option<(CounterIncrementResponder)> {
if let CounterRequest::Increment { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_protocol(self) -> Option<(String, fidl::Channel, CounterControlHandle)> {
if let CounterRequest::ConnectToProtocol { protocol_name, request, control_handle } = self {
Some((protocol_name, request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_in_namespace(
self,
) -> Option<(String, fidl_fuchsia_io::Flags, fidl::Channel, CounterControlHandle)> {
if let CounterRequest::OpenInNamespace { path, flags, request, control_handle } = self {
Some((path, flags, request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_try_open_directory(self) -> Option<(String, CounterTryOpenDirectoryResponder)> {
if let CounterRequest::TryOpenDirectory { path, responder } = self {
Some((path, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CounterRequest::Increment { .. } => "increment",
CounterRequest::ConnectToProtocol { .. } => "connect_to_protocol",
CounterRequest::OpenInNamespace { .. } => "open_in_namespace",
CounterRequest::TryOpenDirectory { .. } => "try_open_directory",
}
}
}
#[derive(Debug, Clone)]
pub struct CounterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CounterControlHandle {
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 CounterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CounterIncrementResponder {
control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CounterIncrementResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CounterIncrementResponder {
type ControlHandle = CounterControlHandle;
fn control_handle(&self) -> &CounterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CounterIncrementResponder {
pub fn send(self, mut value: u32) -> 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: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(value);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut value: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CounterIncrementResponse>(
(value,),
self.tx_id,
0x60cf610cd915d7a9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CounterTryOpenDirectoryResponder {
control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CounterTryOpenDirectoryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CounterTryOpenDirectoryResponder {
type ControlHandle = CounterControlHandle;
fn control_handle(&self) -> &CounterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CounterTryOpenDirectoryResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x37310702b1c8b863,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for CounterConnectToProtocolRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CounterConnectToProtocolRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
CounterConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut CounterConnectToProtocolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterConnectToProtocolRequest>(offset);
fidl::encoding::Encode::<
CounterConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.protocol_name,
),
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.request
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
CounterConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterConnectToProtocolRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for CounterConnectToProtocolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
protocol_name: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
request: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.protocol_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.request, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CounterIncrementResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CounterIncrementResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CounterIncrementResponse, D> for &CounterIncrementResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterIncrementResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut CounterIncrementResponse)
.write_unaligned((self as *const CounterIncrementResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<CounterIncrementResponse, 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::<CounterIncrementResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CounterIncrementResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for CounterOpenInNamespaceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CounterOpenInNamespaceRequest {
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
fidl::encoding::Encode<
CounterOpenInNamespaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut CounterOpenInNamespaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterOpenInNamespaceRequest>(offset);
fidl::encoding::Encode::<CounterOpenInNamespaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
<fidl_fuchsia_io::Flags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
<fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<4095>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
CounterOpenInNamespaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterOpenInNamespaceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(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)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for CounterOpenInNamespaceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
path: fidl::new_empty!(
fidl::encoding::BoundedString<4095>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
flags: fidl::new_empty!(
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect
),
request: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
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 + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<4095>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.flags,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.request, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CounterTryOpenDirectoryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CounterTryOpenDirectoryRequest {
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<CounterTryOpenDirectoryRequest, D>
for &CounterTryOpenDirectoryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CounterTryOpenDirectoryRequest>(offset);
fidl::encoding::Encode::<CounterTryOpenDirectoryRequest, D>::encode(
(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(
&self.path,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4095>, D>,
> fidl::encoding::Encode<CounterTryOpenDirectoryRequest, 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::<CounterTryOpenDirectoryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CounterTryOpenDirectoryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { path: fidl::new_empty!(fidl::encoding::BoundedString<4095>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<4095>,
D,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}