#![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(Clone, Debug, PartialEq)]
pub struct EditTransactionAddRequest {
pub rule: Rule,
}
impl fidl::Persistable for EditTransactionAddRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EditTransactionListDynamicRequest {
pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for EditTransactionListDynamicRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EngineListRequest {
pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EngineListRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EngineListStaticRequest {
pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EngineListStaticRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EngineStartEditTransactionRequest {
pub transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for EngineStartEditTransactionRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EngineTestApplyRequest {
pub url: String,
}
impl fidl::Persistable for EngineTestApplyRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EngineTestApplyResponse {
pub rewritten: String,
}
impl fidl::Persistable for EngineTestApplyResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LiteralRule {
pub host_match: String,
pub host_replacement: String,
pub path_prefix_match: String,
pub path_prefix_replacement: String,
}
impl fidl::Persistable for LiteralRule {}
#[derive(Clone, Debug, PartialEq)]
pub struct RuleIteratorNextResponse {
pub rules: Vec<Rule>,
}
impl fidl::Persistable for RuleIteratorNextResponse {}
#[derive(Clone, Debug)]
pub enum Rule {
Literal(LiteralRule),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! RuleUnknown {
() => {
_
};
}
impl PartialEq for Rule {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Literal(x), Self::Literal(y)) => *x == *y,
_ => false,
}
}
}
impl Rule {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Literal(_) => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Rule {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EditTransactionMarker;
impl fidl::endpoints::ProtocolMarker for EditTransactionMarker {
type Proxy = EditTransactionProxy;
type RequestStream = EditTransactionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EditTransactionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) EditTransaction";
}
pub type EditTransactionAddResult = Result<(), i32>;
pub type EditTransactionCommitResult = Result<(), i32>;
pub trait EditTransactionProxyInterface: Send + Sync {
fn r#list_dynamic(
&self,
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error>;
fn r#reset_all(&self) -> Result<(), fidl::Error>;
type AddResponseFut: std::future::Future<Output = Result<EditTransactionAddResult, fidl::Error>>
+ Send;
fn r#add(&self, rule: &Rule) -> Self::AddResponseFut;
type CommitResponseFut: std::future::Future<Output = Result<EditTransactionCommitResult, fidl::Error>>
+ Send;
fn r#commit(&self) -> Self::CommitResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EditTransactionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EditTransactionSynchronousProxy {
type Proxy = EditTransactionProxy;
type Protocol = EditTransactionMarker;
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 EditTransactionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EditTransactionMarker 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<EditTransactionEvent, fidl::Error> {
EditTransactionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#list_dynamic(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EditTransactionListDynamicRequest>(
(iterator,),
0x37862a86b057cb49,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#reset_all(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x41e518acd0864a90,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#add(
&self,
mut rule: &Rule,
___deadline: zx::MonotonicInstant,
) -> Result<EditTransactionAddResult, fidl::Error> {
let _response = self.client.send_query::<
EditTransactionAddRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(rule,),
0x56a2b5fe92ca5db6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#commit(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<EditTransactionCommitResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x3ca50fc9c13341fb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct EditTransactionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EditTransactionProxy {
type Protocol = EditTransactionMarker;
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 EditTransactionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EditTransactionEventStream {
EditTransactionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#list_dynamic(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
EditTransactionProxyInterface::r#list_dynamic(self, iterator)
}
pub fn r#reset_all(&self) -> Result<(), fidl::Error> {
EditTransactionProxyInterface::r#reset_all(self)
}
pub fn r#add(
&self,
mut rule: &Rule,
) -> fidl::client::QueryResponseFut<
EditTransactionAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EditTransactionProxyInterface::r#add(self, rule)
}
pub fn r#commit(
&self,
) -> fidl::client::QueryResponseFut<
EditTransactionCommitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EditTransactionProxyInterface::r#commit(self)
}
}
impl EditTransactionProxyInterface for EditTransactionProxy {
fn r#list_dynamic(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EditTransactionListDynamicRequest>(
(iterator,),
0x37862a86b057cb49,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#reset_all(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x41e518acd0864a90,
fidl::encoding::DynamicFlags::empty(),
)
}
type AddResponseFut = fidl::client::QueryResponseFut<
EditTransactionAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add(&self, mut rule: &Rule) -> Self::AddResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EditTransactionAddResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x56a2b5fe92ca5db6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<EditTransactionAddRequest, EditTransactionAddResult>(
(rule,),
0x56a2b5fe92ca5db6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CommitResponseFut = fidl::client::QueryResponseFut<
EditTransactionCommitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#commit(&self) -> Self::CommitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EditTransactionCommitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ca50fc9c13341fb,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, EditTransactionCommitResult>(
(),
0x3ca50fc9c13341fb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct EditTransactionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EditTransactionEventStream {}
impl futures::stream::FusedStream for EditTransactionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EditTransactionEventStream {
type Item = Result<EditTransactionEvent, 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(EditTransactionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EditTransactionEvent {}
impl EditTransactionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EditTransactionEvent, 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:
<EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EditTransactionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EditTransactionRequestStream {}
impl futures::stream::FusedStream for EditTransactionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EditTransactionRequestStream {
type Protocol = EditTransactionMarker;
type ControlHandle = EditTransactionControlHandle;
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 {
EditTransactionControlHandle { 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 EditTransactionRequestStream {
type Item = Result<EditTransactionRequest, 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 EditTransactionRequestStream 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 {
0x37862a86b057cb49 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EditTransactionListDynamicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EditTransactionListDynamicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EditTransactionControlHandle { inner: this.inner.clone() };
Ok(EditTransactionRequest::ListDynamic {
iterator: req.iterator,
control_handle,
})
}
0x41e518acd0864a90 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EditTransactionControlHandle { inner: this.inner.clone() };
Ok(EditTransactionRequest::ResetAll { control_handle })
}
0x56a2b5fe92ca5db6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EditTransactionAddRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EditTransactionAddRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EditTransactionControlHandle { inner: this.inner.clone() };
Ok(EditTransactionRequest::Add {
rule: req.rule,
responder: EditTransactionAddResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ca50fc9c13341fb => {
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 =
EditTransactionControlHandle { inner: this.inner.clone() };
Ok(EditTransactionRequest::Commit {
responder: EditTransactionCommitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EditTransactionRequest {
ListDynamic {
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
control_handle: EditTransactionControlHandle,
},
ResetAll { control_handle: EditTransactionControlHandle },
Add { rule: Rule, responder: EditTransactionAddResponder },
Commit { responder: EditTransactionCommitResponder },
}
impl EditTransactionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_list_dynamic(
self,
) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EditTransactionControlHandle)>
{
if let EditTransactionRequest::ListDynamic { iterator, control_handle } = self {
Some((iterator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_all(self) -> Option<(EditTransactionControlHandle)> {
if let EditTransactionRequest::ResetAll { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add(self) -> Option<(Rule, EditTransactionAddResponder)> {
if let EditTransactionRequest::Add { rule, responder } = self {
Some((rule, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_commit(self) -> Option<(EditTransactionCommitResponder)> {
if let EditTransactionRequest::Commit { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EditTransactionRequest::ListDynamic { .. } => "list_dynamic",
EditTransactionRequest::ResetAll { .. } => "reset_all",
EditTransactionRequest::Add { .. } => "add",
EditTransactionRequest::Commit { .. } => "commit",
}
}
}
#[derive(Debug, Clone)]
pub struct EditTransactionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EditTransactionControlHandle {
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 EditTransactionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EditTransactionAddResponder {
control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EditTransactionAddResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EditTransactionAddResponder {
type ControlHandle = EditTransactionControlHandle;
fn control_handle(&self) -> &EditTransactionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EditTransactionAddResponder {
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,
0x56a2b5fe92ca5db6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EditTransactionCommitResponder {
control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EditTransactionCommitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EditTransactionCommitResponder {
type ControlHandle = EditTransactionControlHandle;
fn control_handle(&self) -> &EditTransactionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EditTransactionCommitResponder {
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,
0x3ca50fc9c13341fb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EngineMarker;
impl fidl::endpoints::ProtocolMarker for EngineMarker {
type Proxy = EngineProxy;
type RequestStream = EngineRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EngineSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.pkg.rewrite.Engine";
}
impl fidl::endpoints::DiscoverableProtocolMarker for EngineMarker {}
pub type EngineTestApplyResult = Result<String, i32>;
pub trait EngineProxyInterface: Send + Sync {
fn r#start_edit_transaction(
&self,
transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
) -> Result<(), fidl::Error>;
fn r#list(
&self,
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error>;
fn r#list_static(
&self,
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error>;
type TestApplyResponseFut: std::future::Future<Output = Result<EngineTestApplyResult, fidl::Error>>
+ Send;
fn r#test_apply(&self, url: &str) -> Self::TestApplyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EngineSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EngineSynchronousProxy {
type Proxy = EngineProxy;
type Protocol = EngineMarker;
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 EngineSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EngineMarker 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<EngineEvent, fidl::Error> {
EngineEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start_edit_transaction(
&self,
mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineStartEditTransactionRequest>(
(transaction,),
0x6f649b7dbbc904fb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#list(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineListRequest>(
(iterator,),
0xccbc8b5cb10ad14,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#list_static(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineListStaticRequest>(
(iterator,),
0x5416f92d0bac1b30,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#test_apply(
&self,
mut url: &str,
___deadline: zx::MonotonicInstant,
) -> Result<EngineTestApplyResult, fidl::Error> {
let _response = self.client.send_query::<
EngineTestApplyRequest,
fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
>(
(url,),
0xc8826a2b36fca39,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.rewritten))
}
}
#[derive(Debug, Clone)]
pub struct EngineProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EngineProxy {
type Protocol = EngineMarker;
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 EngineProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EngineEventStream {
EngineEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start_edit_transaction(
&self,
mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
) -> Result<(), fidl::Error> {
EngineProxyInterface::r#start_edit_transaction(self, transaction)
}
pub fn r#list(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
EngineProxyInterface::r#list(self, iterator)
}
pub fn r#list_static(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
EngineProxyInterface::r#list_static(self, iterator)
}
pub fn r#test_apply(
&self,
mut url: &str,
) -> fidl::client::QueryResponseFut<
EngineTestApplyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EngineProxyInterface::r#test_apply(self, url)
}
}
impl EngineProxyInterface for EngineProxy {
fn r#start_edit_transaction(
&self,
mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineStartEditTransactionRequest>(
(transaction,),
0x6f649b7dbbc904fb,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#list(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineListRequest>(
(iterator,),
0xccbc8b5cb10ad14,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#list_static(
&self,
mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EngineListStaticRequest>(
(iterator,),
0x5416f92d0bac1b30,
fidl::encoding::DynamicFlags::empty(),
)
}
type TestApplyResponseFut = fidl::client::QueryResponseFut<
EngineTestApplyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#test_apply(&self, mut url: &str) -> Self::TestApplyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EngineTestApplyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xc8826a2b36fca39,
>(_buf?)?;
Ok(_response.map(|x| x.rewritten))
}
self.client.send_query_and_decode::<EngineTestApplyRequest, EngineTestApplyResult>(
(url,),
0xc8826a2b36fca39,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct EngineEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EngineEventStream {}
impl futures::stream::FusedStream for EngineEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EngineEventStream {
type Item = Result<EngineEvent, 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(EngineEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EngineEvent {}
impl EngineEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EngineEvent, 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: <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EngineRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EngineRequestStream {}
impl futures::stream::FusedStream for EngineRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EngineRequestStream {
type Protocol = EngineMarker;
type ControlHandle = EngineControlHandle;
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 {
EngineControlHandle { 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 EngineRequestStream {
type Item = Result<EngineRequest, 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 EngineRequestStream 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 {
0x6f649b7dbbc904fb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EngineStartEditTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineStartEditTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EngineControlHandle { inner: this.inner.clone() };
Ok(EngineRequest::StartEditTransaction {
transaction: req.transaction,
control_handle,
})
}
0xccbc8b5cb10ad14 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EngineListRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EngineControlHandle { inner: this.inner.clone() };
Ok(EngineRequest::List { iterator: req.iterator, control_handle })
}
0x5416f92d0bac1b30 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EngineListStaticRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListStaticRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EngineControlHandle { inner: this.inner.clone() };
Ok(EngineRequest::ListStatic { iterator: req.iterator, control_handle })
}
0xc8826a2b36fca39 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EngineTestApplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineTestApplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EngineControlHandle { inner: this.inner.clone() };
Ok(EngineRequest::TestApply {
url: req.url,
responder: EngineTestApplyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EngineRequest {
StartEditTransaction {
transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
control_handle: EngineControlHandle,
},
List {
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
control_handle: EngineControlHandle,
},
ListStatic {
iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
control_handle: EngineControlHandle,
},
TestApply { url: String, responder: EngineTestApplyResponder },
}
impl EngineRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_start_edit_transaction(
self,
) -> Option<(fidl::endpoints::ServerEnd<EditTransactionMarker>, EngineControlHandle)> {
if let EngineRequest::StartEditTransaction { transaction, control_handle } = self {
Some((transaction, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_list(
self,
) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
if let EngineRequest::List { iterator, control_handle } = self {
Some((iterator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_list_static(
self,
) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
if let EngineRequest::ListStatic { iterator, control_handle } = self {
Some((iterator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_test_apply(self) -> Option<(String, EngineTestApplyResponder)> {
if let EngineRequest::TestApply { url, responder } = self {
Some((url, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EngineRequest::StartEditTransaction { .. } => "start_edit_transaction",
EngineRequest::List { .. } => "list",
EngineRequest::ListStatic { .. } => "list_static",
EngineRequest::TestApply { .. } => "test_apply",
}
}
}
#[derive(Debug, Clone)]
pub struct EngineControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EngineControlHandle {
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 EngineControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EngineTestApplyResponder {
control_handle: std::mem::ManuallyDrop<EngineControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EngineTestApplyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EngineTestApplyResponder {
type ControlHandle = EngineControlHandle;
fn control_handle(&self) -> &EngineControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EngineTestApplyResponder {
pub fn send(self, mut result: Result<&str, 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<&str, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<EngineTestApplyResponse, i32>>(
result.map(|rewritten| (rewritten,)),
self.tx_id,
0xc8826a2b36fca39,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RuleIteratorMarker;
impl fidl::endpoints::ProtocolMarker for RuleIteratorMarker {
type Proxy = RuleIteratorProxy;
type RequestStream = RuleIteratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RuleIteratorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RuleIterator";
}
pub trait RuleIteratorProxyInterface: Send + Sync {
type NextResponseFut: std::future::Future<Output = Result<Vec<Rule>, fidl::Error>> + Send;
fn r#next(&self) -> Self::NextResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RuleIteratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RuleIteratorSynchronousProxy {
type Proxy = RuleIteratorProxy;
type Protocol = RuleIteratorMarker;
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 RuleIteratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RuleIteratorMarker 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<RuleIteratorEvent, fidl::Error> {
RuleIteratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Rule>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, RuleIteratorNextResponse>(
(),
0x1007ff472e2fcd45,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.rules)
}
}
#[derive(Debug, Clone)]
pub struct RuleIteratorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RuleIteratorProxy {
type Protocol = RuleIteratorMarker;
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 RuleIteratorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RuleIteratorEventStream {
RuleIteratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#next(
&self,
) -> fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
RuleIteratorProxyInterface::r#next(self)
}
}
impl RuleIteratorProxyInterface for RuleIteratorProxy {
type NextResponseFut =
fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#next(&self) -> Self::NextResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<Rule>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RuleIteratorNextResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1007ff472e2fcd45,
>(_buf?)?;
Ok(_response.rules)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Rule>>(
(),
0x1007ff472e2fcd45,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RuleIteratorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RuleIteratorEventStream {}
impl futures::stream::FusedStream for RuleIteratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RuleIteratorEventStream {
type Item = Result<RuleIteratorEvent, 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(RuleIteratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RuleIteratorEvent {}
impl RuleIteratorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RuleIteratorEvent, 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: <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RuleIteratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RuleIteratorRequestStream {}
impl futures::stream::FusedStream for RuleIteratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RuleIteratorRequestStream {
type Protocol = RuleIteratorMarker;
type ControlHandle = RuleIteratorControlHandle;
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 {
RuleIteratorControlHandle { 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 RuleIteratorRequestStream {
type Item = Result<RuleIteratorRequest, 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 RuleIteratorRequestStream 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 {
0x1007ff472e2fcd45 => {
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 =
RuleIteratorControlHandle { inner: this.inner.clone() };
Ok(RuleIteratorRequest::Next {
responder: RuleIteratorNextResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RuleIteratorRequest {
Next { responder: RuleIteratorNextResponder },
}
impl RuleIteratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_next(self) -> Option<(RuleIteratorNextResponder)> {
if let RuleIteratorRequest::Next { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RuleIteratorRequest::Next { .. } => "next",
}
}
}
#[derive(Debug, Clone)]
pub struct RuleIteratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RuleIteratorControlHandle {
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 RuleIteratorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleIteratorNextResponder {
control_handle: std::mem::ManuallyDrop<RuleIteratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleIteratorNextResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleIteratorNextResponder {
type ControlHandle = RuleIteratorControlHandle;
fn control_handle(&self) -> &RuleIteratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleIteratorNextResponder {
pub fn send(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
let _result = self.send_raw(rules);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
let _result = self.send_raw(rules);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RuleIteratorNextResponse>(
(rules,),
self.tx_id,
0x1007ff472e2fcd45,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for EditTransactionAddRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EditTransactionAddRequest {
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<EditTransactionAddRequest, D> for &EditTransactionAddRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EditTransactionAddRequest>(offset);
fidl::encoding::Encode::<EditTransactionAddRequest, D>::encode(
(<Rule as fidl::encoding::ValueTypeMarker>::borrow(&self.rule),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Rule, D>>
fidl::encoding::Encode<EditTransactionAddRequest, 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::<EditTransactionAddRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EditTransactionAddRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { rule: fidl::new_empty!(Rule, 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!(Rule, D, &mut self.rule, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EditTransactionListDynamicRequest {
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 EditTransactionListDynamicRequest {
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<
EditTransactionListDynamicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EditTransactionListDynamicRequest
{
#[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::<EditTransactionListDynamicRequest>(offset);
fidl::encoding::Encode::<EditTransactionListDynamicRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EditTransactionListDynamicRequest,
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::<EditTransactionListDynamicRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EditTransactionListDynamicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
iterator: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
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::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.iterator,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EngineListRequest {
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 EngineListRequest {
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<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut EngineListRequest
{
#[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::<EngineListRequest>(offset);
fidl::encoding::Encode::<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<EngineListRequest, 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::<EngineListRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EngineListRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
iterator: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
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::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.iterator,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EngineListStaticRequest {
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 EngineListStaticRequest {
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<
EngineListStaticRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EngineListStaticRequest
{
#[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::<EngineListStaticRequest>(offset);
fidl::encoding::Encode::<EngineListStaticRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EngineListStaticRequest,
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::<EngineListStaticRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EngineListStaticRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
iterator: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
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::ServerEnd<RuleIteratorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.iterator,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EngineStartEditTransactionRequest {
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 EngineStartEditTransactionRequest {
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<
EngineStartEditTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EngineStartEditTransactionRequest
{
#[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::<EngineStartEditTransactionRequest>(offset);
fidl::encoding::Encode::<EngineStartEditTransactionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.transaction),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EngineStartEditTransactionRequest,
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::<EngineStartEditTransactionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EngineStartEditTransactionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
transaction: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
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::ServerEnd<EditTransactionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.transaction,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EngineTestApplyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EngineTestApplyRequest {
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<EngineTestApplyRequest, D> for &EngineTestApplyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EngineTestApplyRequest>(offset);
fidl::encoding::Encode::<EngineTestApplyRequest, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.url,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<EngineTestApplyRequest, 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::<EngineTestApplyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EngineTestApplyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { url: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.url,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EngineTestApplyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EngineTestApplyResponse {
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<EngineTestApplyResponse, D> for &EngineTestApplyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EngineTestApplyResponse>(offset);
fidl::encoding::Encode::<EngineTestApplyResponse, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.rewritten,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<EngineTestApplyResponse, 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::<EngineTestApplyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EngineTestApplyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { rewritten: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.rewritten,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LiteralRule {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LiteralRule {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LiteralRule, D>
for &LiteralRule
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LiteralRule>(offset);
fidl::encoding::Encode::<LiteralRule, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.host_match,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.host_replacement,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.path_prefix_match,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.path_prefix_replacement,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<LiteralRule, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LiteralRule>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LiteralRule {
#[inline(always)]
fn new_empty() -> Self {
Self {
host_match: fidl::new_empty!(fidl::encoding::UnboundedString, D),
host_replacement: fidl::new_empty!(fidl::encoding::UnboundedString, D),
path_prefix_match: fidl::new_empty!(fidl::encoding::UnboundedString, D),
path_prefix_replacement: fidl::new_empty!(fidl::encoding::UnboundedString, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.host_match,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.host_replacement,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.path_prefix_match,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.path_prefix_replacement,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RuleIteratorNextResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RuleIteratorNextResponse {
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<RuleIteratorNextResponse, D> for &RuleIteratorNextResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleIteratorNextResponse>(offset);
fidl::encoding::Encode::<RuleIteratorNextResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<Rule> as fidl::encoding::ValueTypeMarker>::borrow(&self.rules),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Rule>, D>,
> fidl::encoding::Encode<RuleIteratorNextResponse, 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::<RuleIteratorNextResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RuleIteratorNextResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { rules: fidl::new_empty!(fidl::encoding::UnboundedVector<Rule>, 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::UnboundedVector<Rule>,
D,
&mut self.rules,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Rule {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Rule {
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<Rule, D> for &Rule {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Rule>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Rule::Literal(ref val) => fidl::encoding::encode_in_envelope::<LiteralRule, D>(
<LiteralRule as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Rule::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Rule {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <LiteralRule as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 Rule::Literal(_) = self {
} else {
*self = Rule::Literal(fidl::new_empty!(LiteralRule, D));
}
#[allow(irrefutable_let_patterns)]
if let Rule::Literal(ref mut val) = self {
fidl::decode!(LiteralRule, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Rule::__SourceBreaking { unknown_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(())
}
}
}