#![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 Directory {
pub name: String,
pub entries: Vec<Option<Box<DirectoryEntry>>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Directory {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ExecutableFile {
pub name: String,
}
impl fidl::Persistable for ExecutableFile {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct File {
pub name: String,
pub contents: Vec<u8>,
}
impl fidl::Persistable for File {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HarnessConfig {
pub supports_executable_file: bool,
pub supports_mutable_file: bool,
pub supports_get_backing_memory: bool,
pub supports_remote_dir: bool,
pub supports_get_token: bool,
pub supports_link_into: bool,
pub supports_append: bool,
pub supports_truncate: bool,
pub supported_attributes: fidl_fuchsia_io::NodeAttributesQuery,
pub supports_modify_directory: bool,
pub supports_services: bool,
}
impl fidl::Persistable for HarnessConfig {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteDirectory {
pub name: String,
pub remote_client: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RemoteDirectory {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TestHarnessCreateDirectoryRequest {
pub contents: Vec<Option<Box<DirectoryEntry>>>,
pub flags: fidl_fuchsia_io::Flags,
pub object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for TestHarnessCreateDirectoryRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TestHarnessGetConfigResponse {
pub config: HarnessConfig,
}
impl fidl::Persistable for TestHarnessGetConfigResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TestHarnessOpenServiceDirectoryResponse {
pub object_request: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for TestHarnessOpenServiceDirectoryResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum DirectoryEntry {
Directory(Directory),
RemoteDirectory(RemoteDirectory),
File(File),
ExecutableFile(ExecutableFile),
}
impl DirectoryEntry {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Directory(_) => 1,
Self::RemoteDirectory(_) => 2,
Self::File(_) => 3,
Self::ExecutableFile(_) => 5,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DirectoryEntry {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TestHarnessMarker;
impl fidl::endpoints::ProtocolMarker for TestHarnessMarker {
type Proxy = TestHarnessProxy;
type RequestStream = TestHarnessRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TestHarnessSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.io.test.TestHarness";
}
impl fidl::endpoints::DiscoverableProtocolMarker for TestHarnessMarker {}
pub trait TestHarnessProxyInterface: Send + Sync {
type GetConfigResponseFut: std::future::Future<Output = Result<HarnessConfig, fidl::Error>>
+ Send;
fn r#get_config(&self) -> Self::GetConfigResponseFut;
fn r#create_directory(
&self,
contents: Vec<Option<Box<DirectoryEntry>>>,
flags: fidl_fuchsia_io::Flags,
object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error>;
type OpenServiceDirectoryResponseFut: std::future::Future<
Output = Result<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
fidl::Error,
>,
> + Send;
fn r#open_service_directory(&self) -> Self::OpenServiceDirectoryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TestHarnessSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TestHarnessSynchronousProxy {
type Proxy = TestHarnessProxy;
type Protocol = TestHarnessMarker;
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 TestHarnessSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <TestHarnessMarker 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<TestHarnessEvent, fidl::Error> {
TestHarnessEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_config(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<HarnessConfig, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, TestHarnessGetConfigResponse>(
(),
0x758882a165dbaa23,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.config)
}
pub fn r#create_directory(
&self,
mut contents: Vec<Option<Box<DirectoryEntry>>>,
mut flags: fidl_fuchsia_io::Flags,
mut object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<TestHarnessCreateDirectoryRequest>(
(contents.as_mut(), flags, object_request),
0x626b0ce412a0cb4c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#open_service_directory(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, TestHarnessOpenServiceDirectoryResponse>(
(),
0x42904fe08b12ef88,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.object_request)
}
}
#[derive(Debug, Clone)]
pub struct TestHarnessProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for TestHarnessProxy {
type Protocol = TestHarnessMarker;
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 TestHarnessProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <TestHarnessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TestHarnessEventStream {
TestHarnessEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_config(
&self,
) -> fidl::client::QueryResponseFut<HarnessConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
{
TestHarnessProxyInterface::r#get_config(self)
}
pub fn r#create_directory(
&self,
mut contents: Vec<Option<Box<DirectoryEntry>>>,
mut flags: fidl_fuchsia_io::Flags,
mut object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
TestHarnessProxyInterface::r#create_directory(self, contents, flags, object_request)
}
pub fn r#open_service_directory(
&self,
) -> fidl::client::QueryResponseFut<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TestHarnessProxyInterface::r#open_service_directory(self)
}
}
impl TestHarnessProxyInterface for TestHarnessProxy {
type GetConfigResponseFut = fidl::client::QueryResponseFut<
HarnessConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_config(&self) -> Self::GetConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HarnessConfig, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
TestHarnessGetConfigResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x758882a165dbaa23,
>(_buf?)?;
Ok(_response.config)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HarnessConfig>(
(),
0x758882a165dbaa23,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#create_directory(
&self,
mut contents: Vec<Option<Box<DirectoryEntry>>>,
mut flags: fidl_fuchsia_io::Flags,
mut object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<TestHarnessCreateDirectoryRequest>(
(contents.as_mut(), flags, object_request),
0x626b0ce412a0cb4c,
fidl::encoding::DynamicFlags::empty(),
)
}
type OpenServiceDirectoryResponseFut = fidl::client::QueryResponseFut<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_service_directory(&self) -> Self::OpenServiceDirectoryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
TestHarnessOpenServiceDirectoryResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x42904fe08b12ef88,
>(_buf?)?;
Ok(_response.object_request)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>(
(),
0x42904fe08b12ef88,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct TestHarnessEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for TestHarnessEventStream {}
impl futures::stream::FusedStream for TestHarnessEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TestHarnessEventStream {
type Item = Result<TestHarnessEvent, 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(TestHarnessEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TestHarnessEvent {}
impl TestHarnessEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<TestHarnessEvent, 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: <TestHarnessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TestHarnessRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for TestHarnessRequestStream {}
impl futures::stream::FusedStream for TestHarnessRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TestHarnessRequestStream {
type Protocol = TestHarnessMarker;
type ControlHandle = TestHarnessControlHandle;
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 {
TestHarnessControlHandle { 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 TestHarnessRequestStream {
type Item = Result<TestHarnessRequest, 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 TestHarnessRequestStream 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 {
0x758882a165dbaa23 => {
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 = TestHarnessControlHandle { inner: this.inner.clone() };
Ok(TestHarnessRequest::GetConfig {
responder: TestHarnessGetConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x626b0ce412a0cb4c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
TestHarnessCreateDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TestHarnessCreateDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TestHarnessControlHandle { inner: this.inner.clone() };
Ok(TestHarnessRequest::CreateDirectory {
contents: req.contents,
flags: req.flags,
object_request: req.object_request,
control_handle,
})
}
0x42904fe08b12ef88 => {
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 = TestHarnessControlHandle { inner: this.inner.clone() };
Ok(TestHarnessRequest::OpenServiceDirectory {
responder: TestHarnessOpenServiceDirectoryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<TestHarnessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum TestHarnessRequest {
GetConfig { responder: TestHarnessGetConfigResponder },
CreateDirectory {
contents: Vec<Option<Box<DirectoryEntry>>>,
flags: fidl_fuchsia_io::Flags,
object_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
control_handle: TestHarnessControlHandle,
},
OpenServiceDirectory { responder: TestHarnessOpenServiceDirectoryResponder },
}
impl TestHarnessRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_config(self) -> Option<(TestHarnessGetConfigResponder)> {
if let TestHarnessRequest::GetConfig { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_directory(
self,
) -> Option<(
Vec<Option<Box<DirectoryEntry>>>,
fidl_fuchsia_io::Flags,
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
TestHarnessControlHandle,
)> {
if let TestHarnessRequest::CreateDirectory {
contents,
flags,
object_request,
control_handle,
} = self
{
Some((contents, flags, object_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_service_directory(self) -> Option<(TestHarnessOpenServiceDirectoryResponder)> {
if let TestHarnessRequest::OpenServiceDirectory { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TestHarnessRequest::GetConfig { .. } => "get_config",
TestHarnessRequest::CreateDirectory { .. } => "create_directory",
TestHarnessRequest::OpenServiceDirectory { .. } => "open_service_directory",
}
}
}
#[derive(Debug, Clone)]
pub struct TestHarnessControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for TestHarnessControlHandle {
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 TestHarnessControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TestHarnessGetConfigResponder {
control_handle: std::mem::ManuallyDrop<TestHarnessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TestHarnessGetConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TestHarnessGetConfigResponder {
type ControlHandle = TestHarnessControlHandle;
fn control_handle(&self) -> &TestHarnessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TestHarnessGetConfigResponder {
pub fn send(self, mut config: &HarnessConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut config: &HarnessConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut config: &HarnessConfig) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<TestHarnessGetConfigResponse>(
(config,),
self.tx_id,
0x758882a165dbaa23,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TestHarnessOpenServiceDirectoryResponder {
control_handle: std::mem::ManuallyDrop<TestHarnessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TestHarnessOpenServiceDirectoryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TestHarnessOpenServiceDirectoryResponder {
type ControlHandle = TestHarnessControlHandle;
fn control_handle(&self) -> &TestHarnessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TestHarnessOpenServiceDirectoryResponder {
pub fn send(
self,
mut object_request: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(object_request);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut object_request: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(object_request);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut object_request: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<TestHarnessOpenServiceDirectoryResponse>(
(object_request,),
self.tx_id,
0x42904fe08b12ef88,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for Directory {
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 Directory {
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<Directory, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut Directory
{
#[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::<Directory>(offset);
fidl::encoding::Encode::<Directory, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<Directory, 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::<Directory>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Directory {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
entries: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.entries,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ExecutableFile {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ExecutableFile {
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<ExecutableFile, D>
for &ExecutableFile
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExecutableFile>(offset);
fidl::encoding::Encode::<ExecutableFile, D>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
> fidl::encoding::Encode<ExecutableFile, 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::<ExecutableFile>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutableFile {
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>, 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<255>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for File {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for File {
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<File, D> for &File {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<File>(offset);
fidl::encoding::Encode::<File, D>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.contents),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<File, 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::<File>(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 File {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
contents: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.contents,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HarnessConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HarnessConfig {
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HarnessConfig, D>
for &HarnessConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HarnessConfig>(offset);
fidl::encoding::Encode::<HarnessConfig, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_executable_file),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_mutable_file),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_backing_memory),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_remote_dir),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_token),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_link_into),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_append),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_truncate),
<fidl_fuchsia_io::NodeAttributesQuery as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_attributes),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_modify_directory),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_services),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<bool, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<bool, D>,
T5: fidl::encoding::Encode<bool, D>,
T6: fidl::encoding::Encode<bool, D>,
T7: fidl::encoding::Encode<bool, D>,
T8: fidl::encoding::Encode<fidl_fuchsia_io::NodeAttributesQuery, D>,
T9: fidl::encoding::Encode<bool, D>,
T10: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<HarnessConfig, D>
for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HarnessConfig>(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 + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
self.3.encode(encoder, offset + 3, depth)?;
self.4.encode(encoder, offset + 4, depth)?;
self.5.encode(encoder, offset + 5, depth)?;
self.6.encode(encoder, offset + 6, depth)?;
self.7.encode(encoder, offset + 7, depth)?;
self.8.encode(encoder, offset + 8, depth)?;
self.9.encode(encoder, offset + 16, depth)?;
self.10.encode(encoder, offset + 17, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HarnessConfig {
#[inline(always)]
fn new_empty() -> Self {
Self {
supports_executable_file: fidl::new_empty!(bool, D),
supports_mutable_file: fidl::new_empty!(bool, D),
supports_get_backing_memory: fidl::new_empty!(bool, D),
supports_remote_dir: fidl::new_empty!(bool, D),
supports_get_token: fidl::new_empty!(bool, D),
supports_link_into: fidl::new_empty!(bool, D),
supports_append: fidl::new_empty!(bool, D),
supports_truncate: fidl::new_empty!(bool, D),
supported_attributes: fidl::new_empty!(fidl_fuchsia_io::NodeAttributesQuery, D),
supports_modify_directory: fidl::new_empty!(bool, D),
supports_services: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
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!(
bool,
D,
&mut self.supports_executable_file,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(bool, D, &mut self.supports_mutable_file, decoder, offset + 1, _depth)?;
fidl::decode!(
bool,
D,
&mut self.supports_get_backing_memory,
decoder,
offset + 2,
_depth
)?;
fidl::decode!(bool, D, &mut self.supports_remote_dir, decoder, offset + 3, _depth)?;
fidl::decode!(bool, D, &mut self.supports_get_token, decoder, offset + 4, _depth)?;
fidl::decode!(bool, D, &mut self.supports_link_into, decoder, offset + 5, _depth)?;
fidl::decode!(bool, D, &mut self.supports_append, decoder, offset + 6, _depth)?;
fidl::decode!(bool, D, &mut self.supports_truncate, decoder, offset + 7, _depth)?;
fidl::decode!(
fidl_fuchsia_io::NodeAttributesQuery,
D,
&mut self.supported_attributes,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
bool,
D,
&mut self.supports_modify_directory,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(bool, D, &mut self.supports_services, decoder, offset + 17, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RemoteDirectory {
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 RemoteDirectory {
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<RemoteDirectory, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut RemoteDirectory
{
#[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::<RemoteDirectory>(offset);
fidl::encoding::Encode::<RemoteDirectory, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.remote_client),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<RemoteDirectory, 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::<RemoteDirectory>(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 RemoteDirectory
{
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
remote_client: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
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.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.remote_client,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for TestHarnessCreateDirectoryRequest {
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 TestHarnessCreateDirectoryRequest {
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<
TestHarnessCreateDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut TestHarnessCreateDirectoryRequest
{
#[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::<TestHarnessCreateDirectoryRequest>(offset);
fidl::encoding::Encode::<TestHarnessCreateDirectoryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.contents),
<fidl_fuchsia_io::Flags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
TestHarnessCreateDirectoryRequest,
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::<TestHarnessCreateDirectoryRequest>(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 TestHarnessCreateDirectoryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
contents: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
flags: fidl::new_empty!(
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect
),
object_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
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::UnboundedVector<fidl::encoding::OptionalUnion<DirectoryEntry>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.contents,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_io::Flags,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.flags,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.object_request,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TestHarnessGetConfigResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TestHarnessGetConfigResponse {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for &TestHarnessGetConfigResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
fidl::encoding::Encode::<TestHarnessGetConfigResponse, D>::encode(
(<HarnessConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HarnessConfig, D>>
fidl::encoding::Encode<TestHarnessGetConfigResponse, 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::<TestHarnessGetConfigResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TestHarnessGetConfigResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(HarnessConfig, 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!(HarnessConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for TestHarnessOpenServiceDirectoryResponse {
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 TestHarnessOpenServiceDirectoryResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
TestHarnessOpenServiceDirectoryResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut TestHarnessOpenServiceDirectoryResponse
{
#[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::<TestHarnessOpenServiceDirectoryResponse>(offset);
fidl::encoding::Encode::<
TestHarnessOpenServiceDirectoryResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.object_request
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
TestHarnessOpenServiceDirectoryResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TestHarnessOpenServiceDirectoryResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for TestHarnessOpenServiceDirectoryResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
object_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.object_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DirectoryEntry {
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 DirectoryEntry {
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
fidl::encoding::Encode<DirectoryEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DirectoryEntry
{
#[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::<DirectoryEntry>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DirectoryEntry::Directory(ref mut val) => fidl::encoding::encode_in_envelope::<
Directory,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<Directory as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder,
offset + 8,
_depth,
),
DirectoryEntry::RemoteDirectory(ref mut val) => {
fidl::encoding::encode_in_envelope::<
RemoteDirectory,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<RemoteDirectory as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val,
),
encoder,
offset + 8,
_depth,
)
}
DirectoryEntry::File(ref val) => fidl::encoding::encode_in_envelope::<
File,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<File as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
DirectoryEntry::ExecutableFile(ref val) => fidl::encoding::encode_in_envelope::<
ExecutableFile,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<ExecutableFile as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DirectoryEntry
{
#[inline(always)]
fn new_empty() -> Self {
Self::Directory(fidl::new_empty!(
Directory,
fidl::encoding::DefaultFuchsiaResourceDialect
))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 => <Directory as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <RemoteDirectory as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <File as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <ExecutableFile 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 DirectoryEntry::Directory(_) = self {
} else {
*self = DirectoryEntry::Directory(fidl::new_empty!(
Directory,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::Directory(ref mut val) = self {
fidl::decode!(
Directory,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::RemoteDirectory(_) = self {
} else {
*self = DirectoryEntry::RemoteDirectory(fidl::new_empty!(
RemoteDirectory,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::RemoteDirectory(ref mut val) = self {
fidl::decode!(
RemoteDirectory,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::File(_) = self {
} else {
*self = DirectoryEntry::File(fidl::new_empty!(
File,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::File(ref mut val) = self {
fidl::decode!(
File,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::ExecutableFile(_) = self {
} else {
*self = DirectoryEntry::ExecutableFile(fidl::new_empty!(
ExecutableFile,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let DirectoryEntry::ExecutableFile(ref mut val) = self {
fidl::decode!(
ExecutableFile,
fidl::encoding::DefaultFuchsiaResourceDialect,
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(())
}
}
}