fidl_fuchsia_pkg_rewrite/
fidl_fuchsia_pkg_rewrite.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_pkg_rewrite__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct EditTransactionListDynamicRequest {
16    pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for EditTransactionListDynamicRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct EngineListRequest {
26    pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EngineListRequest {}
30
31#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct EngineListStaticRequest {
33    pub iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EngineListStaticRequest {}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct EngineStartEditTransactionRequest {
40    pub transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for EngineStartEditTransactionRequest
45{
46}
47
48#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
49pub struct EditTransactionMarker;
50
51impl fidl::endpoints::ProtocolMarker for EditTransactionMarker {
52    type Proxy = EditTransactionProxy;
53    type RequestStream = EditTransactionRequestStream;
54    #[cfg(target_os = "fuchsia")]
55    type SynchronousProxy = EditTransactionSynchronousProxy;
56
57    const DEBUG_NAME: &'static str = "(anonymous) EditTransaction";
58}
59pub type EditTransactionAddResult = Result<(), i32>;
60pub type EditTransactionCommitResult = Result<(), i32>;
61
62pub trait EditTransactionProxyInterface: Send + Sync {
63    fn r#list_dynamic(
64        &self,
65        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
66    ) -> Result<(), fidl::Error>;
67    fn r#reset_all(&self) -> Result<(), fidl::Error>;
68    type AddResponseFut: std::future::Future<Output = Result<EditTransactionAddResult, fidl::Error>>
69        + Send;
70    fn r#add(&self, rule: &Rule) -> Self::AddResponseFut;
71    type CommitResponseFut: std::future::Future<Output = Result<EditTransactionCommitResult, fidl::Error>>
72        + Send;
73    fn r#commit(&self) -> Self::CommitResponseFut;
74}
75#[derive(Debug)]
76#[cfg(target_os = "fuchsia")]
77pub struct EditTransactionSynchronousProxy {
78    client: fidl::client::sync::Client,
79}
80
81#[cfg(target_os = "fuchsia")]
82impl fidl::endpoints::SynchronousProxy for EditTransactionSynchronousProxy {
83    type Proxy = EditTransactionProxy;
84    type Protocol = EditTransactionMarker;
85
86    fn from_channel(inner: fidl::Channel) -> Self {
87        Self::new(inner)
88    }
89
90    fn into_channel(self) -> fidl::Channel {
91        self.client.into_channel()
92    }
93
94    fn as_channel(&self) -> &fidl::Channel {
95        self.client.as_channel()
96    }
97}
98
99#[cfg(target_os = "fuchsia")]
100impl EditTransactionSynchronousProxy {
101    pub fn new(channel: fidl::Channel) -> Self {
102        let protocol_name = <EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
103        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
104    }
105
106    pub fn into_channel(self) -> fidl::Channel {
107        self.client.into_channel()
108    }
109
110    /// Waits until an event arrives and returns it. It is safe for other
111    /// threads to make concurrent requests while waiting for an event.
112    pub fn wait_for_event(
113        &self,
114        deadline: zx::MonotonicInstant,
115    ) -> Result<EditTransactionEvent, fidl::Error> {
116        EditTransactionEvent::decode(self.client.wait_for_event(deadline)?)
117    }
118
119    /// Returns an iterator over all dynamic (editable) rewrite rules. The
120    /// iterator will reflect any changes made to the rewrite rules so far in
121    /// this transaction.
122    ///
123    /// + request `iterator` a request for an iterator.
124    pub fn r#list_dynamic(
125        &self,
126        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
127    ) -> Result<(), fidl::Error> {
128        self.client.send::<EditTransactionListDynamicRequest>(
129            (iterator,),
130            0x37862a86b057cb49,
131            fidl::encoding::DynamicFlags::empty(),
132        )
133    }
134
135    /// Removes all dynamically configured rewrite rules, leaving only any
136    /// statically configured rules.
137    pub fn r#reset_all(&self) -> Result<(), fidl::Error> {
138        self.client.send::<fidl::encoding::EmptyPayload>(
139            (),
140            0x41e518acd0864a90,
141            fidl::encoding::DynamicFlags::empty(),
142        )
143    }
144
145    /// Adds a rewrite rule with highest priority. If `rule` already exists, this
146    /// API will prioritize it over other rules.
147    ///
148    /// + request `rule` the rewrite rule to persist.
149    /// * error a zx_status value indicating failure. One of the following:
150    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
151    ///      URL. See [`fuchsia-pkg URL`].
152    ///
153    /// [`fuchsia-pkg URL`]:
154    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
155    pub fn r#add(
156        &self,
157        mut rule: &Rule,
158        ___deadline: zx::MonotonicInstant,
159    ) -> Result<EditTransactionAddResult, fidl::Error> {
160        let _response = self.client.send_query::<
161            EditTransactionAddRequest,
162            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
163        >(
164            (rule,),
165            0x56a2b5fe92ca5db6,
166            fidl::encoding::DynamicFlags::empty(),
167            ___deadline,
168        )?;
169        Ok(_response.map(|x| x))
170    }
171
172    /// Commits this transaction, or detect another transaction that committed
173    /// before this one.
174    ///
175    /// * error a zx_status value indicating failure. One of the following:
176    ///     * `ZX_ERR_UNAVAILABLE` if another transaction committed before this one.
177    ///     * `ZX_ERR_ACCESS_DENIED` if editing dynamic rewrite rules is permanently disabled.
178    pub fn r#commit(
179        &self,
180        ___deadline: zx::MonotonicInstant,
181    ) -> Result<EditTransactionCommitResult, fidl::Error> {
182        let _response = self.client.send_query::<
183            fidl::encoding::EmptyPayload,
184            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
185        >(
186            (),
187            0x3ca50fc9c13341fb,
188            fidl::encoding::DynamicFlags::empty(),
189            ___deadline,
190        )?;
191        Ok(_response.map(|x| x))
192    }
193}
194
195#[cfg(target_os = "fuchsia")]
196impl From<EditTransactionSynchronousProxy> for zx::Handle {
197    fn from(value: EditTransactionSynchronousProxy) -> Self {
198        value.into_channel().into()
199    }
200}
201
202#[cfg(target_os = "fuchsia")]
203impl From<fidl::Channel> for EditTransactionSynchronousProxy {
204    fn from(value: fidl::Channel) -> Self {
205        Self::new(value)
206    }
207}
208
209#[cfg(target_os = "fuchsia")]
210impl fidl::endpoints::FromClient for EditTransactionSynchronousProxy {
211    type Protocol = EditTransactionMarker;
212
213    fn from_client(value: fidl::endpoints::ClientEnd<EditTransactionMarker>) -> Self {
214        Self::new(value.into_channel())
215    }
216}
217
218#[derive(Debug, Clone)]
219pub struct EditTransactionProxy {
220    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
221}
222
223impl fidl::endpoints::Proxy for EditTransactionProxy {
224    type Protocol = EditTransactionMarker;
225
226    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
227        Self::new(inner)
228    }
229
230    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
231        self.client.into_channel().map_err(|client| Self { client })
232    }
233
234    fn as_channel(&self) -> &::fidl::AsyncChannel {
235        self.client.as_channel()
236    }
237}
238
239impl EditTransactionProxy {
240    /// Create a new Proxy for fuchsia.pkg.rewrite/EditTransaction.
241    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
242        let protocol_name = <EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
243        Self { client: fidl::client::Client::new(channel, protocol_name) }
244    }
245
246    /// Get a Stream of events from the remote end of the protocol.
247    ///
248    /// # Panics
249    ///
250    /// Panics if the event stream was already taken.
251    pub fn take_event_stream(&self) -> EditTransactionEventStream {
252        EditTransactionEventStream { event_receiver: self.client.take_event_receiver() }
253    }
254
255    /// Returns an iterator over all dynamic (editable) rewrite rules. The
256    /// iterator will reflect any changes made to the rewrite rules so far in
257    /// this transaction.
258    ///
259    /// + request `iterator` a request for an iterator.
260    pub fn r#list_dynamic(
261        &self,
262        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
263    ) -> Result<(), fidl::Error> {
264        EditTransactionProxyInterface::r#list_dynamic(self, iterator)
265    }
266
267    /// Removes all dynamically configured rewrite rules, leaving only any
268    /// statically configured rules.
269    pub fn r#reset_all(&self) -> Result<(), fidl::Error> {
270        EditTransactionProxyInterface::r#reset_all(self)
271    }
272
273    /// Adds a rewrite rule with highest priority. If `rule` already exists, this
274    /// API will prioritize it over other rules.
275    ///
276    /// + request `rule` the rewrite rule to persist.
277    /// * error a zx_status value indicating failure. One of the following:
278    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
279    ///      URL. See [`fuchsia-pkg URL`].
280    ///
281    /// [`fuchsia-pkg URL`]:
282    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
283    pub fn r#add(
284        &self,
285        mut rule: &Rule,
286    ) -> fidl::client::QueryResponseFut<
287        EditTransactionAddResult,
288        fidl::encoding::DefaultFuchsiaResourceDialect,
289    > {
290        EditTransactionProxyInterface::r#add(self, rule)
291    }
292
293    /// Commits this transaction, or detect another transaction that committed
294    /// before this one.
295    ///
296    /// * error a zx_status value indicating failure. One of the following:
297    ///     * `ZX_ERR_UNAVAILABLE` if another transaction committed before this one.
298    ///     * `ZX_ERR_ACCESS_DENIED` if editing dynamic rewrite rules is permanently disabled.
299    pub fn r#commit(
300        &self,
301    ) -> fidl::client::QueryResponseFut<
302        EditTransactionCommitResult,
303        fidl::encoding::DefaultFuchsiaResourceDialect,
304    > {
305        EditTransactionProxyInterface::r#commit(self)
306    }
307}
308
309impl EditTransactionProxyInterface for EditTransactionProxy {
310    fn r#list_dynamic(
311        &self,
312        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
313    ) -> Result<(), fidl::Error> {
314        self.client.send::<EditTransactionListDynamicRequest>(
315            (iterator,),
316            0x37862a86b057cb49,
317            fidl::encoding::DynamicFlags::empty(),
318        )
319    }
320
321    fn r#reset_all(&self) -> Result<(), fidl::Error> {
322        self.client.send::<fidl::encoding::EmptyPayload>(
323            (),
324            0x41e518acd0864a90,
325            fidl::encoding::DynamicFlags::empty(),
326        )
327    }
328
329    type AddResponseFut = fidl::client::QueryResponseFut<
330        EditTransactionAddResult,
331        fidl::encoding::DefaultFuchsiaResourceDialect,
332    >;
333    fn r#add(&self, mut rule: &Rule) -> Self::AddResponseFut {
334        fn _decode(
335            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
336        ) -> Result<EditTransactionAddResult, fidl::Error> {
337            let _response = fidl::client::decode_transaction_body::<
338                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
339                fidl::encoding::DefaultFuchsiaResourceDialect,
340                0x56a2b5fe92ca5db6,
341            >(_buf?)?;
342            Ok(_response.map(|x| x))
343        }
344        self.client.send_query_and_decode::<EditTransactionAddRequest, EditTransactionAddResult>(
345            (rule,),
346            0x56a2b5fe92ca5db6,
347            fidl::encoding::DynamicFlags::empty(),
348            _decode,
349        )
350    }
351
352    type CommitResponseFut = fidl::client::QueryResponseFut<
353        EditTransactionCommitResult,
354        fidl::encoding::DefaultFuchsiaResourceDialect,
355    >;
356    fn r#commit(&self) -> Self::CommitResponseFut {
357        fn _decode(
358            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
359        ) -> Result<EditTransactionCommitResult, fidl::Error> {
360            let _response = fidl::client::decode_transaction_body::<
361                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
362                fidl::encoding::DefaultFuchsiaResourceDialect,
363                0x3ca50fc9c13341fb,
364            >(_buf?)?;
365            Ok(_response.map(|x| x))
366        }
367        self.client
368            .send_query_and_decode::<fidl::encoding::EmptyPayload, EditTransactionCommitResult>(
369                (),
370                0x3ca50fc9c13341fb,
371                fidl::encoding::DynamicFlags::empty(),
372                _decode,
373            )
374    }
375}
376
377pub struct EditTransactionEventStream {
378    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
379}
380
381impl std::marker::Unpin for EditTransactionEventStream {}
382
383impl futures::stream::FusedStream for EditTransactionEventStream {
384    fn is_terminated(&self) -> bool {
385        self.event_receiver.is_terminated()
386    }
387}
388
389impl futures::Stream for EditTransactionEventStream {
390    type Item = Result<EditTransactionEvent, fidl::Error>;
391
392    fn poll_next(
393        mut self: std::pin::Pin<&mut Self>,
394        cx: &mut std::task::Context<'_>,
395    ) -> std::task::Poll<Option<Self::Item>> {
396        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
397            &mut self.event_receiver,
398            cx
399        )?) {
400            Some(buf) => std::task::Poll::Ready(Some(EditTransactionEvent::decode(buf))),
401            None => std::task::Poll::Ready(None),
402        }
403    }
404}
405
406#[derive(Debug)]
407pub enum EditTransactionEvent {}
408
409impl EditTransactionEvent {
410    /// Decodes a message buffer as a [`EditTransactionEvent`].
411    fn decode(
412        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
413    ) -> Result<EditTransactionEvent, fidl::Error> {
414        let (bytes, _handles) = buf.split_mut();
415        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
416        debug_assert_eq!(tx_header.tx_id, 0);
417        match tx_header.ordinal {
418            _ => Err(fidl::Error::UnknownOrdinal {
419                ordinal: tx_header.ordinal,
420                protocol_name:
421                    <EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
422            }),
423        }
424    }
425}
426
427/// A Stream of incoming requests for fuchsia.pkg.rewrite/EditTransaction.
428pub struct EditTransactionRequestStream {
429    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
430    is_terminated: bool,
431}
432
433impl std::marker::Unpin for EditTransactionRequestStream {}
434
435impl futures::stream::FusedStream for EditTransactionRequestStream {
436    fn is_terminated(&self) -> bool {
437        self.is_terminated
438    }
439}
440
441impl fidl::endpoints::RequestStream for EditTransactionRequestStream {
442    type Protocol = EditTransactionMarker;
443    type ControlHandle = EditTransactionControlHandle;
444
445    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
446        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
447    }
448
449    fn control_handle(&self) -> Self::ControlHandle {
450        EditTransactionControlHandle { inner: self.inner.clone() }
451    }
452
453    fn into_inner(
454        self,
455    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
456    {
457        (self.inner, self.is_terminated)
458    }
459
460    fn from_inner(
461        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
462        is_terminated: bool,
463    ) -> Self {
464        Self { inner, is_terminated }
465    }
466}
467
468impl futures::Stream for EditTransactionRequestStream {
469    type Item = Result<EditTransactionRequest, fidl::Error>;
470
471    fn poll_next(
472        mut self: std::pin::Pin<&mut Self>,
473        cx: &mut std::task::Context<'_>,
474    ) -> std::task::Poll<Option<Self::Item>> {
475        let this = &mut *self;
476        if this.inner.check_shutdown(cx) {
477            this.is_terminated = true;
478            return std::task::Poll::Ready(None);
479        }
480        if this.is_terminated {
481            panic!("polled EditTransactionRequestStream after completion");
482        }
483        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
484            |bytes, handles| {
485                match this.inner.channel().read_etc(cx, bytes, handles) {
486                    std::task::Poll::Ready(Ok(())) => {}
487                    std::task::Poll::Pending => return std::task::Poll::Pending,
488                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
489                        this.is_terminated = true;
490                        return std::task::Poll::Ready(None);
491                    }
492                    std::task::Poll::Ready(Err(e)) => {
493                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
494                            e.into(),
495                        ))))
496                    }
497                }
498
499                // A message has been received from the channel
500                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
501
502                std::task::Poll::Ready(Some(match header.ordinal {
503                    0x37862a86b057cb49 => {
504                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
505                        let mut req = fidl::new_empty!(
506                            EditTransactionListDynamicRequest,
507                            fidl::encoding::DefaultFuchsiaResourceDialect
508                        );
509                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EditTransactionListDynamicRequest>(&header, _body_bytes, handles, &mut req)?;
510                        let control_handle =
511                            EditTransactionControlHandle { inner: this.inner.clone() };
512                        Ok(EditTransactionRequest::ListDynamic {
513                            iterator: req.iterator,
514
515                            control_handle,
516                        })
517                    }
518                    0x41e518acd0864a90 => {
519                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
520                        let mut req = fidl::new_empty!(
521                            fidl::encoding::EmptyPayload,
522                            fidl::encoding::DefaultFuchsiaResourceDialect
523                        );
524                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
525                        let control_handle =
526                            EditTransactionControlHandle { inner: this.inner.clone() };
527                        Ok(EditTransactionRequest::ResetAll { control_handle })
528                    }
529                    0x56a2b5fe92ca5db6 => {
530                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
531                        let mut req = fidl::new_empty!(
532                            EditTransactionAddRequest,
533                            fidl::encoding::DefaultFuchsiaResourceDialect
534                        );
535                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EditTransactionAddRequest>(&header, _body_bytes, handles, &mut req)?;
536                        let control_handle =
537                            EditTransactionControlHandle { inner: this.inner.clone() };
538                        Ok(EditTransactionRequest::Add {
539                            rule: req.rule,
540
541                            responder: EditTransactionAddResponder {
542                                control_handle: std::mem::ManuallyDrop::new(control_handle),
543                                tx_id: header.tx_id,
544                            },
545                        })
546                    }
547                    0x3ca50fc9c13341fb => {
548                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
549                        let mut req = fidl::new_empty!(
550                            fidl::encoding::EmptyPayload,
551                            fidl::encoding::DefaultFuchsiaResourceDialect
552                        );
553                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
554                        let control_handle =
555                            EditTransactionControlHandle { inner: this.inner.clone() };
556                        Ok(EditTransactionRequest::Commit {
557                            responder: EditTransactionCommitResponder {
558                                control_handle: std::mem::ManuallyDrop::new(control_handle),
559                                tx_id: header.tx_id,
560                            },
561                        })
562                    }
563                    _ => Err(fidl::Error::UnknownOrdinal {
564                        ordinal: header.ordinal,
565                        protocol_name:
566                            <EditTransactionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
567                    }),
568                }))
569            },
570        )
571    }
572}
573
574/// A unit of editing for rewrite rules.
575#[derive(Debug)]
576pub enum EditTransactionRequest {
577    /// Returns an iterator over all dynamic (editable) rewrite rules. The
578    /// iterator will reflect any changes made to the rewrite rules so far in
579    /// this transaction.
580    ///
581    /// + request `iterator` a request for an iterator.
582    ListDynamic {
583        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
584        control_handle: EditTransactionControlHandle,
585    },
586    /// Removes all dynamically configured rewrite rules, leaving only any
587    /// statically configured rules.
588    ResetAll { control_handle: EditTransactionControlHandle },
589    /// Adds a rewrite rule with highest priority. If `rule` already exists, this
590    /// API will prioritize it over other rules.
591    ///
592    /// + request `rule` the rewrite rule to persist.
593    /// * error a zx_status value indicating failure. One of the following:
594    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
595    ///      URL. See [`fuchsia-pkg URL`].
596    ///
597    /// [`fuchsia-pkg URL`]:
598    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
599    Add { rule: Rule, responder: EditTransactionAddResponder },
600    /// Commits this transaction, or detect another transaction that committed
601    /// before this one.
602    ///
603    /// * error a zx_status value indicating failure. One of the following:
604    ///     * `ZX_ERR_UNAVAILABLE` if another transaction committed before this one.
605    ///     * `ZX_ERR_ACCESS_DENIED` if editing dynamic rewrite rules is permanently disabled.
606    Commit { responder: EditTransactionCommitResponder },
607}
608
609impl EditTransactionRequest {
610    #[allow(irrefutable_let_patterns)]
611    pub fn into_list_dynamic(
612        self,
613    ) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EditTransactionControlHandle)>
614    {
615        if let EditTransactionRequest::ListDynamic { iterator, control_handle } = self {
616            Some((iterator, control_handle))
617        } else {
618            None
619        }
620    }
621
622    #[allow(irrefutable_let_patterns)]
623    pub fn into_reset_all(self) -> Option<(EditTransactionControlHandle)> {
624        if let EditTransactionRequest::ResetAll { control_handle } = self {
625            Some((control_handle))
626        } else {
627            None
628        }
629    }
630
631    #[allow(irrefutable_let_patterns)]
632    pub fn into_add(self) -> Option<(Rule, EditTransactionAddResponder)> {
633        if let EditTransactionRequest::Add { rule, responder } = self {
634            Some((rule, responder))
635        } else {
636            None
637        }
638    }
639
640    #[allow(irrefutable_let_patterns)]
641    pub fn into_commit(self) -> Option<(EditTransactionCommitResponder)> {
642        if let EditTransactionRequest::Commit { responder } = self {
643            Some((responder))
644        } else {
645            None
646        }
647    }
648
649    /// Name of the method defined in FIDL
650    pub fn method_name(&self) -> &'static str {
651        match *self {
652            EditTransactionRequest::ListDynamic { .. } => "list_dynamic",
653            EditTransactionRequest::ResetAll { .. } => "reset_all",
654            EditTransactionRequest::Add { .. } => "add",
655            EditTransactionRequest::Commit { .. } => "commit",
656        }
657    }
658}
659
660#[derive(Debug, Clone)]
661pub struct EditTransactionControlHandle {
662    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
663}
664
665impl fidl::endpoints::ControlHandle for EditTransactionControlHandle {
666    fn shutdown(&self) {
667        self.inner.shutdown()
668    }
669    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
670        self.inner.shutdown_with_epitaph(status)
671    }
672
673    fn is_closed(&self) -> bool {
674        self.inner.channel().is_closed()
675    }
676    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
677        self.inner.channel().on_closed()
678    }
679
680    #[cfg(target_os = "fuchsia")]
681    fn signal_peer(
682        &self,
683        clear_mask: zx::Signals,
684        set_mask: zx::Signals,
685    ) -> Result<(), zx_status::Status> {
686        use fidl::Peered;
687        self.inner.channel().signal_peer(clear_mask, set_mask)
688    }
689}
690
691impl EditTransactionControlHandle {}
692
693#[must_use = "FIDL methods require a response to be sent"]
694#[derive(Debug)]
695pub struct EditTransactionAddResponder {
696    control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
697    tx_id: u32,
698}
699
700/// Set the the channel to be shutdown (see [`EditTransactionControlHandle::shutdown`])
701/// if the responder is dropped without sending a response, so that the client
702/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
703impl std::ops::Drop for EditTransactionAddResponder {
704    fn drop(&mut self) {
705        self.control_handle.shutdown();
706        // Safety: drops once, never accessed again
707        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
708    }
709}
710
711impl fidl::endpoints::Responder for EditTransactionAddResponder {
712    type ControlHandle = EditTransactionControlHandle;
713
714    fn control_handle(&self) -> &EditTransactionControlHandle {
715        &self.control_handle
716    }
717
718    fn drop_without_shutdown(mut self) {
719        // Safety: drops once, never accessed again due to mem::forget
720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
721        // Prevent Drop from running (which would shut down the channel)
722        std::mem::forget(self);
723    }
724}
725
726impl EditTransactionAddResponder {
727    /// Sends a response to the FIDL transaction.
728    ///
729    /// Sets the channel to shutdown if an error occurs.
730    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
731        let _result = self.send_raw(result);
732        if _result.is_err() {
733            self.control_handle.shutdown();
734        }
735        self.drop_without_shutdown();
736        _result
737    }
738
739    /// Similar to "send" but does not shutdown the channel if an error occurs.
740    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
741        let _result = self.send_raw(result);
742        self.drop_without_shutdown();
743        _result
744    }
745
746    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
747        self.control_handle
748            .inner
749            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
750                result,
751                self.tx_id,
752                0x56a2b5fe92ca5db6,
753                fidl::encoding::DynamicFlags::empty(),
754            )
755    }
756}
757
758#[must_use = "FIDL methods require a response to be sent"]
759#[derive(Debug)]
760pub struct EditTransactionCommitResponder {
761    control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
762    tx_id: u32,
763}
764
765/// Set the the channel to be shutdown (see [`EditTransactionControlHandle::shutdown`])
766/// if the responder is dropped without sending a response, so that the client
767/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
768impl std::ops::Drop for EditTransactionCommitResponder {
769    fn drop(&mut self) {
770        self.control_handle.shutdown();
771        // Safety: drops once, never accessed again
772        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
773    }
774}
775
776impl fidl::endpoints::Responder for EditTransactionCommitResponder {
777    type ControlHandle = EditTransactionControlHandle;
778
779    fn control_handle(&self) -> &EditTransactionControlHandle {
780        &self.control_handle
781    }
782
783    fn drop_without_shutdown(mut self) {
784        // Safety: drops once, never accessed again due to mem::forget
785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
786        // Prevent Drop from running (which would shut down the channel)
787        std::mem::forget(self);
788    }
789}
790
791impl EditTransactionCommitResponder {
792    /// Sends a response to the FIDL transaction.
793    ///
794    /// Sets the channel to shutdown if an error occurs.
795    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
796        let _result = self.send_raw(result);
797        if _result.is_err() {
798            self.control_handle.shutdown();
799        }
800        self.drop_without_shutdown();
801        _result
802    }
803
804    /// Similar to "send" but does not shutdown the channel if an error occurs.
805    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
806        let _result = self.send_raw(result);
807        self.drop_without_shutdown();
808        _result
809    }
810
811    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
812        self.control_handle
813            .inner
814            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
815                result,
816                self.tx_id,
817                0x3ca50fc9c13341fb,
818                fidl::encoding::DynamicFlags::empty(),
819            )
820    }
821}
822
823#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
824pub struct EngineMarker;
825
826impl fidl::endpoints::ProtocolMarker for EngineMarker {
827    type Proxy = EngineProxy;
828    type RequestStream = EngineRequestStream;
829    #[cfg(target_os = "fuchsia")]
830    type SynchronousProxy = EngineSynchronousProxy;
831
832    const DEBUG_NAME: &'static str = "fuchsia.pkg.rewrite.Engine";
833}
834impl fidl::endpoints::DiscoverableProtocolMarker for EngineMarker {}
835pub type EngineTestApplyResult = Result<String, i32>;
836
837pub trait EngineProxyInterface: Send + Sync {
838    fn r#start_edit_transaction(
839        &self,
840        transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
841    ) -> Result<(), fidl::Error>;
842    fn r#list(
843        &self,
844        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
845    ) -> Result<(), fidl::Error>;
846    fn r#list_static(
847        &self,
848        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
849    ) -> Result<(), fidl::Error>;
850    type TestApplyResponseFut: std::future::Future<Output = Result<EngineTestApplyResult, fidl::Error>>
851        + Send;
852    fn r#test_apply(&self, url: &str) -> Self::TestApplyResponseFut;
853}
854#[derive(Debug)]
855#[cfg(target_os = "fuchsia")]
856pub struct EngineSynchronousProxy {
857    client: fidl::client::sync::Client,
858}
859
860#[cfg(target_os = "fuchsia")]
861impl fidl::endpoints::SynchronousProxy for EngineSynchronousProxy {
862    type Proxy = EngineProxy;
863    type Protocol = EngineMarker;
864
865    fn from_channel(inner: fidl::Channel) -> Self {
866        Self::new(inner)
867    }
868
869    fn into_channel(self) -> fidl::Channel {
870        self.client.into_channel()
871    }
872
873    fn as_channel(&self) -> &fidl::Channel {
874        self.client.as_channel()
875    }
876}
877
878#[cfg(target_os = "fuchsia")]
879impl EngineSynchronousProxy {
880    pub fn new(channel: fidl::Channel) -> Self {
881        let protocol_name = <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
882        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
883    }
884
885    pub fn into_channel(self) -> fidl::Channel {
886        self.client.into_channel()
887    }
888
889    /// Waits until an event arrives and returns it. It is safe for other
890    /// threads to make concurrent requests while waiting for an event.
891    pub fn wait_for_event(
892        &self,
893        deadline: zx::MonotonicInstant,
894    ) -> Result<EngineEvent, fidl::Error> {
895        EngineEvent::decode(self.client.wait_for_event(deadline)?)
896    }
897
898    /// Begins a rule edit transaction.
899    ///
900    /// + request `transaction` a request for an [`EditTransaction`].
901    pub fn r#start_edit_transaction(
902        &self,
903        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
904    ) -> Result<(), fidl::Error> {
905        self.client.send::<EngineStartEditTransactionRequest>(
906            (transaction,),
907            0x6f649b7dbbc904fb,
908            fidl::encoding::DynamicFlags::empty(),
909        )
910    }
911
912    /// Returns an iterator over all rewrite rules.
913    ///
914    /// + request `iterator` a request for an iterator.
915    pub fn r#list(
916        &self,
917        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
918    ) -> Result<(), fidl::Error> {
919        self.client.send::<EngineListRequest>(
920            (iterator,),
921            0xccbc8b5cb10ad14,
922            fidl::encoding::DynamicFlags::empty(),
923        )
924    }
925
926    /// Returns an iterator over all static (immutable) rewrite rules. These
927    /// rules are handled as lower priority than dynamic rules and cannot be
928    /// modified (although they can be overridden) by [`EditTransaction`]s.
929    ///
930    /// + request `iterator` a request for an iterator.
931    pub fn r#list_static(
932        &self,
933        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
934    ) -> Result<(), fidl::Error> {
935        self.client.send::<EngineListStaticRequest>(
936            (iterator,),
937            0x5416f92d0bac1b30,
938            fidl::encoding::DynamicFlags::empty(),
939        )
940    }
941
942    /// Rewrites the given `url` with the current rewrite rule set, returning the
943    /// `rewritten` url.  If no rules match or a rule matches but performs an
944    /// identity transformation, this API returns `url` unchanged.
945    ///
946    /// This API is intended only for reflecting on rule side effects. Using
947    /// this API to pre-apply the rules, then passing the result to
948    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
949    ///
950    /// + request `url` the url to rewrite.
951    /// - response `rewritten` the rewritten url.
952    /// * error a zx_status value indicating failure. One of the following:
953    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
954    ///       URL. See [`fuchsia-pkg URL`].
955    ///
956    /// [`fuchsia-pkg URL`]:
957    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
958    pub fn r#test_apply(
959        &self,
960        mut url: &str,
961        ___deadline: zx::MonotonicInstant,
962    ) -> Result<EngineTestApplyResult, fidl::Error> {
963        let _response = self.client.send_query::<
964            EngineTestApplyRequest,
965            fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
966        >(
967            (url,),
968            0xc8826a2b36fca39,
969            fidl::encoding::DynamicFlags::empty(),
970            ___deadline,
971        )?;
972        Ok(_response.map(|x| x.rewritten))
973    }
974}
975
976#[cfg(target_os = "fuchsia")]
977impl From<EngineSynchronousProxy> for zx::Handle {
978    fn from(value: EngineSynchronousProxy) -> Self {
979        value.into_channel().into()
980    }
981}
982
983#[cfg(target_os = "fuchsia")]
984impl From<fidl::Channel> for EngineSynchronousProxy {
985    fn from(value: fidl::Channel) -> Self {
986        Self::new(value)
987    }
988}
989
990#[cfg(target_os = "fuchsia")]
991impl fidl::endpoints::FromClient for EngineSynchronousProxy {
992    type Protocol = EngineMarker;
993
994    fn from_client(value: fidl::endpoints::ClientEnd<EngineMarker>) -> Self {
995        Self::new(value.into_channel())
996    }
997}
998
999#[derive(Debug, Clone)]
1000pub struct EngineProxy {
1001    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1002}
1003
1004impl fidl::endpoints::Proxy for EngineProxy {
1005    type Protocol = EngineMarker;
1006
1007    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1008        Self::new(inner)
1009    }
1010
1011    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1012        self.client.into_channel().map_err(|client| Self { client })
1013    }
1014
1015    fn as_channel(&self) -> &::fidl::AsyncChannel {
1016        self.client.as_channel()
1017    }
1018}
1019
1020impl EngineProxy {
1021    /// Create a new Proxy for fuchsia.pkg.rewrite/Engine.
1022    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1023        let protocol_name = <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1024        Self { client: fidl::client::Client::new(channel, protocol_name) }
1025    }
1026
1027    /// Get a Stream of events from the remote end of the protocol.
1028    ///
1029    /// # Panics
1030    ///
1031    /// Panics if the event stream was already taken.
1032    pub fn take_event_stream(&self) -> EngineEventStream {
1033        EngineEventStream { event_receiver: self.client.take_event_receiver() }
1034    }
1035
1036    /// Begins a rule edit transaction.
1037    ///
1038    /// + request `transaction` a request for an [`EditTransaction`].
1039    pub fn r#start_edit_transaction(
1040        &self,
1041        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1042    ) -> Result<(), fidl::Error> {
1043        EngineProxyInterface::r#start_edit_transaction(self, transaction)
1044    }
1045
1046    /// Returns an iterator over all rewrite rules.
1047    ///
1048    /// + request `iterator` a request for an iterator.
1049    pub fn r#list(
1050        &self,
1051        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1052    ) -> Result<(), fidl::Error> {
1053        EngineProxyInterface::r#list(self, iterator)
1054    }
1055
1056    /// Returns an iterator over all static (immutable) rewrite rules. These
1057    /// rules are handled as lower priority than dynamic rules and cannot be
1058    /// modified (although they can be overridden) by [`EditTransaction`]s.
1059    ///
1060    /// + request `iterator` a request for an iterator.
1061    pub fn r#list_static(
1062        &self,
1063        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1064    ) -> Result<(), fidl::Error> {
1065        EngineProxyInterface::r#list_static(self, iterator)
1066    }
1067
1068    /// Rewrites the given `url` with the current rewrite rule set, returning the
1069    /// `rewritten` url.  If no rules match or a rule matches but performs an
1070    /// identity transformation, this API returns `url` unchanged.
1071    ///
1072    /// This API is intended only for reflecting on rule side effects. Using
1073    /// this API to pre-apply the rules, then passing the result to
1074    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
1075    ///
1076    /// + request `url` the url to rewrite.
1077    /// - response `rewritten` the rewritten url.
1078    /// * error a zx_status value indicating failure. One of the following:
1079    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
1080    ///       URL. See [`fuchsia-pkg URL`].
1081    ///
1082    /// [`fuchsia-pkg URL`]:
1083    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
1084    pub fn r#test_apply(
1085        &self,
1086        mut url: &str,
1087    ) -> fidl::client::QueryResponseFut<
1088        EngineTestApplyResult,
1089        fidl::encoding::DefaultFuchsiaResourceDialect,
1090    > {
1091        EngineProxyInterface::r#test_apply(self, url)
1092    }
1093}
1094
1095impl EngineProxyInterface for EngineProxy {
1096    fn r#start_edit_transaction(
1097        &self,
1098        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1099    ) -> Result<(), fidl::Error> {
1100        self.client.send::<EngineStartEditTransactionRequest>(
1101            (transaction,),
1102            0x6f649b7dbbc904fb,
1103            fidl::encoding::DynamicFlags::empty(),
1104        )
1105    }
1106
1107    fn r#list(
1108        &self,
1109        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1110    ) -> Result<(), fidl::Error> {
1111        self.client.send::<EngineListRequest>(
1112            (iterator,),
1113            0xccbc8b5cb10ad14,
1114            fidl::encoding::DynamicFlags::empty(),
1115        )
1116    }
1117
1118    fn r#list_static(
1119        &self,
1120        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1121    ) -> Result<(), fidl::Error> {
1122        self.client.send::<EngineListStaticRequest>(
1123            (iterator,),
1124            0x5416f92d0bac1b30,
1125            fidl::encoding::DynamicFlags::empty(),
1126        )
1127    }
1128
1129    type TestApplyResponseFut = fidl::client::QueryResponseFut<
1130        EngineTestApplyResult,
1131        fidl::encoding::DefaultFuchsiaResourceDialect,
1132    >;
1133    fn r#test_apply(&self, mut url: &str) -> Self::TestApplyResponseFut {
1134        fn _decode(
1135            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1136        ) -> Result<EngineTestApplyResult, fidl::Error> {
1137            let _response = fidl::client::decode_transaction_body::<
1138                fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
1139                fidl::encoding::DefaultFuchsiaResourceDialect,
1140                0xc8826a2b36fca39,
1141            >(_buf?)?;
1142            Ok(_response.map(|x| x.rewritten))
1143        }
1144        self.client.send_query_and_decode::<EngineTestApplyRequest, EngineTestApplyResult>(
1145            (url,),
1146            0xc8826a2b36fca39,
1147            fidl::encoding::DynamicFlags::empty(),
1148            _decode,
1149        )
1150    }
1151}
1152
1153pub struct EngineEventStream {
1154    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1155}
1156
1157impl std::marker::Unpin for EngineEventStream {}
1158
1159impl futures::stream::FusedStream for EngineEventStream {
1160    fn is_terminated(&self) -> bool {
1161        self.event_receiver.is_terminated()
1162    }
1163}
1164
1165impl futures::Stream for EngineEventStream {
1166    type Item = Result<EngineEvent, fidl::Error>;
1167
1168    fn poll_next(
1169        mut self: std::pin::Pin<&mut Self>,
1170        cx: &mut std::task::Context<'_>,
1171    ) -> std::task::Poll<Option<Self::Item>> {
1172        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1173            &mut self.event_receiver,
1174            cx
1175        )?) {
1176            Some(buf) => std::task::Poll::Ready(Some(EngineEvent::decode(buf))),
1177            None => std::task::Poll::Ready(None),
1178        }
1179    }
1180}
1181
1182#[derive(Debug)]
1183pub enum EngineEvent {}
1184
1185impl EngineEvent {
1186    /// Decodes a message buffer as a [`EngineEvent`].
1187    fn decode(
1188        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1189    ) -> Result<EngineEvent, fidl::Error> {
1190        let (bytes, _handles) = buf.split_mut();
1191        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1192        debug_assert_eq!(tx_header.tx_id, 0);
1193        match tx_header.ordinal {
1194            _ => Err(fidl::Error::UnknownOrdinal {
1195                ordinal: tx_header.ordinal,
1196                protocol_name: <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1197            }),
1198        }
1199    }
1200}
1201
1202/// A Stream of incoming requests for fuchsia.pkg.rewrite/Engine.
1203pub struct EngineRequestStream {
1204    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1205    is_terminated: bool,
1206}
1207
1208impl std::marker::Unpin for EngineRequestStream {}
1209
1210impl futures::stream::FusedStream for EngineRequestStream {
1211    fn is_terminated(&self) -> bool {
1212        self.is_terminated
1213    }
1214}
1215
1216impl fidl::endpoints::RequestStream for EngineRequestStream {
1217    type Protocol = EngineMarker;
1218    type ControlHandle = EngineControlHandle;
1219
1220    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1221        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1222    }
1223
1224    fn control_handle(&self) -> Self::ControlHandle {
1225        EngineControlHandle { inner: self.inner.clone() }
1226    }
1227
1228    fn into_inner(
1229        self,
1230    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1231    {
1232        (self.inner, self.is_terminated)
1233    }
1234
1235    fn from_inner(
1236        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1237        is_terminated: bool,
1238    ) -> Self {
1239        Self { inner, is_terminated }
1240    }
1241}
1242
1243impl futures::Stream for EngineRequestStream {
1244    type Item = Result<EngineRequest, fidl::Error>;
1245
1246    fn poll_next(
1247        mut self: std::pin::Pin<&mut Self>,
1248        cx: &mut std::task::Context<'_>,
1249    ) -> std::task::Poll<Option<Self::Item>> {
1250        let this = &mut *self;
1251        if this.inner.check_shutdown(cx) {
1252            this.is_terminated = true;
1253            return std::task::Poll::Ready(None);
1254        }
1255        if this.is_terminated {
1256            panic!("polled EngineRequestStream after completion");
1257        }
1258        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1259            |bytes, handles| {
1260                match this.inner.channel().read_etc(cx, bytes, handles) {
1261                    std::task::Poll::Ready(Ok(())) => {}
1262                    std::task::Poll::Pending => return std::task::Poll::Pending,
1263                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1264                        this.is_terminated = true;
1265                        return std::task::Poll::Ready(None);
1266                    }
1267                    std::task::Poll::Ready(Err(e)) => {
1268                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1269                            e.into(),
1270                        ))))
1271                    }
1272                }
1273
1274                // A message has been received from the channel
1275                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1276
1277                std::task::Poll::Ready(Some(match header.ordinal {
1278                    0x6f649b7dbbc904fb => {
1279                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1280                        let mut req = fidl::new_empty!(
1281                            EngineStartEditTransactionRequest,
1282                            fidl::encoding::DefaultFuchsiaResourceDialect
1283                        );
1284                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineStartEditTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
1285                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1286                        Ok(EngineRequest::StartEditTransaction {
1287                            transaction: req.transaction,
1288
1289                            control_handle,
1290                        })
1291                    }
1292                    0xccbc8b5cb10ad14 => {
1293                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1294                        let mut req = fidl::new_empty!(
1295                            EngineListRequest,
1296                            fidl::encoding::DefaultFuchsiaResourceDialect
1297                        );
1298                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListRequest>(&header, _body_bytes, handles, &mut req)?;
1299                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1300                        Ok(EngineRequest::List { iterator: req.iterator, control_handle })
1301                    }
1302                    0x5416f92d0bac1b30 => {
1303                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1304                        let mut req = fidl::new_empty!(
1305                            EngineListStaticRequest,
1306                            fidl::encoding::DefaultFuchsiaResourceDialect
1307                        );
1308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListStaticRequest>(&header, _body_bytes, handles, &mut req)?;
1309                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1310                        Ok(EngineRequest::ListStatic { iterator: req.iterator, control_handle })
1311                    }
1312                    0xc8826a2b36fca39 => {
1313                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1314                        let mut req = fidl::new_empty!(
1315                            EngineTestApplyRequest,
1316                            fidl::encoding::DefaultFuchsiaResourceDialect
1317                        );
1318                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineTestApplyRequest>(&header, _body_bytes, handles, &mut req)?;
1319                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1320                        Ok(EngineRequest::TestApply {
1321                            url: req.url,
1322
1323                            responder: EngineTestApplyResponder {
1324                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1325                                tx_id: header.tx_id,
1326                            },
1327                        })
1328                    }
1329                    _ => Err(fidl::Error::UnknownOrdinal {
1330                        ordinal: header.ordinal,
1331                        protocol_name:
1332                            <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1333                    }),
1334                }))
1335            },
1336        )
1337    }
1338}
1339
1340/// This manages fuchsia-pkg:// rewrite rules.
1341///
1342/// When a package resolver is asked to resolve a fuchsia-pkg URL, it must first
1343/// iterate through its sequence of rewrite rules (given by [`List`]). The
1344/// rewrite engine will rewrite the given URL with the first rule that:
1345/// * matches the given URL
1346/// * produces a valid URL when applied to the given URL
1347///
1348/// If no rules match, the URL is resolved as-is.
1349///
1350/// This is intended to be implemented by package resolver components,
1351/// and used by repository administration tools.
1352#[derive(Debug)]
1353pub enum EngineRequest {
1354    /// Begins a rule edit transaction.
1355    ///
1356    /// + request `transaction` a request for an [`EditTransaction`].
1357    StartEditTransaction {
1358        transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1359        control_handle: EngineControlHandle,
1360    },
1361    /// Returns an iterator over all rewrite rules.
1362    ///
1363    /// + request `iterator` a request for an iterator.
1364    List {
1365        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1366        control_handle: EngineControlHandle,
1367    },
1368    /// Returns an iterator over all static (immutable) rewrite rules. These
1369    /// rules are handled as lower priority than dynamic rules and cannot be
1370    /// modified (although they can be overridden) by [`EditTransaction`]s.
1371    ///
1372    /// + request `iterator` a request for an iterator.
1373    ListStatic {
1374        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1375        control_handle: EngineControlHandle,
1376    },
1377    /// Rewrites the given `url` with the current rewrite rule set, returning the
1378    /// `rewritten` url.  If no rules match or a rule matches but performs an
1379    /// identity transformation, this API returns `url` unchanged.
1380    ///
1381    /// This API is intended only for reflecting on rule side effects. Using
1382    /// this API to pre-apply the rules, then passing the result to
1383    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
1384    ///
1385    /// + request `url` the url to rewrite.
1386    /// - response `rewritten` the rewritten url.
1387    /// * error a zx_status value indicating failure. One of the following:
1388    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
1389    ///       URL. See [`fuchsia-pkg URL`].
1390    ///
1391    /// [`fuchsia-pkg URL`]:
1392    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
1393    TestApply { url: String, responder: EngineTestApplyResponder },
1394}
1395
1396impl EngineRequest {
1397    #[allow(irrefutable_let_patterns)]
1398    pub fn into_start_edit_transaction(
1399        self,
1400    ) -> Option<(fidl::endpoints::ServerEnd<EditTransactionMarker>, EngineControlHandle)> {
1401        if let EngineRequest::StartEditTransaction { transaction, control_handle } = self {
1402            Some((transaction, control_handle))
1403        } else {
1404            None
1405        }
1406    }
1407
1408    #[allow(irrefutable_let_patterns)]
1409    pub fn into_list(
1410        self,
1411    ) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
1412        if let EngineRequest::List { iterator, control_handle } = self {
1413            Some((iterator, control_handle))
1414        } else {
1415            None
1416        }
1417    }
1418
1419    #[allow(irrefutable_let_patterns)]
1420    pub fn into_list_static(
1421        self,
1422    ) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
1423        if let EngineRequest::ListStatic { iterator, control_handle } = self {
1424            Some((iterator, control_handle))
1425        } else {
1426            None
1427        }
1428    }
1429
1430    #[allow(irrefutable_let_patterns)]
1431    pub fn into_test_apply(self) -> Option<(String, EngineTestApplyResponder)> {
1432        if let EngineRequest::TestApply { url, responder } = self {
1433            Some((url, responder))
1434        } else {
1435            None
1436        }
1437    }
1438
1439    /// Name of the method defined in FIDL
1440    pub fn method_name(&self) -> &'static str {
1441        match *self {
1442            EngineRequest::StartEditTransaction { .. } => "start_edit_transaction",
1443            EngineRequest::List { .. } => "list",
1444            EngineRequest::ListStatic { .. } => "list_static",
1445            EngineRequest::TestApply { .. } => "test_apply",
1446        }
1447    }
1448}
1449
1450#[derive(Debug, Clone)]
1451pub struct EngineControlHandle {
1452    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1453}
1454
1455impl fidl::endpoints::ControlHandle for EngineControlHandle {
1456    fn shutdown(&self) {
1457        self.inner.shutdown()
1458    }
1459    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1460        self.inner.shutdown_with_epitaph(status)
1461    }
1462
1463    fn is_closed(&self) -> bool {
1464        self.inner.channel().is_closed()
1465    }
1466    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1467        self.inner.channel().on_closed()
1468    }
1469
1470    #[cfg(target_os = "fuchsia")]
1471    fn signal_peer(
1472        &self,
1473        clear_mask: zx::Signals,
1474        set_mask: zx::Signals,
1475    ) -> Result<(), zx_status::Status> {
1476        use fidl::Peered;
1477        self.inner.channel().signal_peer(clear_mask, set_mask)
1478    }
1479}
1480
1481impl EngineControlHandle {}
1482
1483#[must_use = "FIDL methods require a response to be sent"]
1484#[derive(Debug)]
1485pub struct EngineTestApplyResponder {
1486    control_handle: std::mem::ManuallyDrop<EngineControlHandle>,
1487    tx_id: u32,
1488}
1489
1490/// Set the the channel to be shutdown (see [`EngineControlHandle::shutdown`])
1491/// if the responder is dropped without sending a response, so that the client
1492/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1493impl std::ops::Drop for EngineTestApplyResponder {
1494    fn drop(&mut self) {
1495        self.control_handle.shutdown();
1496        // Safety: drops once, never accessed again
1497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1498    }
1499}
1500
1501impl fidl::endpoints::Responder for EngineTestApplyResponder {
1502    type ControlHandle = EngineControlHandle;
1503
1504    fn control_handle(&self) -> &EngineControlHandle {
1505        &self.control_handle
1506    }
1507
1508    fn drop_without_shutdown(mut self) {
1509        // Safety: drops once, never accessed again due to mem::forget
1510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1511        // Prevent Drop from running (which would shut down the channel)
1512        std::mem::forget(self);
1513    }
1514}
1515
1516impl EngineTestApplyResponder {
1517    /// Sends a response to the FIDL transaction.
1518    ///
1519    /// Sets the channel to shutdown if an error occurs.
1520    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1521        let _result = self.send_raw(result);
1522        if _result.is_err() {
1523            self.control_handle.shutdown();
1524        }
1525        self.drop_without_shutdown();
1526        _result
1527    }
1528
1529    /// Similar to "send" but does not shutdown the channel if an error occurs.
1530    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1531        let _result = self.send_raw(result);
1532        self.drop_without_shutdown();
1533        _result
1534    }
1535
1536    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1537        self.control_handle.inner.send::<fidl::encoding::ResultType<EngineTestApplyResponse, i32>>(
1538            result.map(|rewritten| (rewritten,)),
1539            self.tx_id,
1540            0xc8826a2b36fca39,
1541            fidl::encoding::DynamicFlags::empty(),
1542        )
1543    }
1544}
1545
1546#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1547pub struct RuleIteratorMarker;
1548
1549impl fidl::endpoints::ProtocolMarker for RuleIteratorMarker {
1550    type Proxy = RuleIteratorProxy;
1551    type RequestStream = RuleIteratorRequestStream;
1552    #[cfg(target_os = "fuchsia")]
1553    type SynchronousProxy = RuleIteratorSynchronousProxy;
1554
1555    const DEBUG_NAME: &'static str = "(anonymous) RuleIterator";
1556}
1557
1558pub trait RuleIteratorProxyInterface: Send + Sync {
1559    type NextResponseFut: std::future::Future<Output = Result<Vec<Rule>, fidl::Error>> + Send;
1560    fn r#next(&self) -> Self::NextResponseFut;
1561}
1562#[derive(Debug)]
1563#[cfg(target_os = "fuchsia")]
1564pub struct RuleIteratorSynchronousProxy {
1565    client: fidl::client::sync::Client,
1566}
1567
1568#[cfg(target_os = "fuchsia")]
1569impl fidl::endpoints::SynchronousProxy for RuleIteratorSynchronousProxy {
1570    type Proxy = RuleIteratorProxy;
1571    type Protocol = RuleIteratorMarker;
1572
1573    fn from_channel(inner: fidl::Channel) -> Self {
1574        Self::new(inner)
1575    }
1576
1577    fn into_channel(self) -> fidl::Channel {
1578        self.client.into_channel()
1579    }
1580
1581    fn as_channel(&self) -> &fidl::Channel {
1582        self.client.as_channel()
1583    }
1584}
1585
1586#[cfg(target_os = "fuchsia")]
1587impl RuleIteratorSynchronousProxy {
1588    pub fn new(channel: fidl::Channel) -> Self {
1589        let protocol_name = <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1590        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1591    }
1592
1593    pub fn into_channel(self) -> fidl::Channel {
1594        self.client.into_channel()
1595    }
1596
1597    /// Waits until an event arrives and returns it. It is safe for other
1598    /// threads to make concurrent requests while waiting for an event.
1599    pub fn wait_for_event(
1600        &self,
1601        deadline: zx::MonotonicInstant,
1602    ) -> Result<RuleIteratorEvent, fidl::Error> {
1603        RuleIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1604    }
1605
1606    /// Advances the iterator and returns the next batch of rules.
1607    ///
1608    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1609    ///    vector and then close the channel when there are no more rules.
1610    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Rule>, fidl::Error> {
1611        let _response =
1612            self.client.send_query::<fidl::encoding::EmptyPayload, RuleIteratorNextResponse>(
1613                (),
1614                0x1007ff472e2fcd45,
1615                fidl::encoding::DynamicFlags::empty(),
1616                ___deadline,
1617            )?;
1618        Ok(_response.rules)
1619    }
1620}
1621
1622#[cfg(target_os = "fuchsia")]
1623impl From<RuleIteratorSynchronousProxy> for zx::Handle {
1624    fn from(value: RuleIteratorSynchronousProxy) -> Self {
1625        value.into_channel().into()
1626    }
1627}
1628
1629#[cfg(target_os = "fuchsia")]
1630impl From<fidl::Channel> for RuleIteratorSynchronousProxy {
1631    fn from(value: fidl::Channel) -> Self {
1632        Self::new(value)
1633    }
1634}
1635
1636#[cfg(target_os = "fuchsia")]
1637impl fidl::endpoints::FromClient for RuleIteratorSynchronousProxy {
1638    type Protocol = RuleIteratorMarker;
1639
1640    fn from_client(value: fidl::endpoints::ClientEnd<RuleIteratorMarker>) -> Self {
1641        Self::new(value.into_channel())
1642    }
1643}
1644
1645#[derive(Debug, Clone)]
1646pub struct RuleIteratorProxy {
1647    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1648}
1649
1650impl fidl::endpoints::Proxy for RuleIteratorProxy {
1651    type Protocol = RuleIteratorMarker;
1652
1653    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1654        Self::new(inner)
1655    }
1656
1657    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1658        self.client.into_channel().map_err(|client| Self { client })
1659    }
1660
1661    fn as_channel(&self) -> &::fidl::AsyncChannel {
1662        self.client.as_channel()
1663    }
1664}
1665
1666impl RuleIteratorProxy {
1667    /// Create a new Proxy for fuchsia.pkg.rewrite/RuleIterator.
1668    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1669        let protocol_name = <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1670        Self { client: fidl::client::Client::new(channel, protocol_name) }
1671    }
1672
1673    /// Get a Stream of events from the remote end of the protocol.
1674    ///
1675    /// # Panics
1676    ///
1677    /// Panics if the event stream was already taken.
1678    pub fn take_event_stream(&self) -> RuleIteratorEventStream {
1679        RuleIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1680    }
1681
1682    /// Advances the iterator and returns the next batch of rules.
1683    ///
1684    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1685    ///    vector and then close the channel when there are no more rules.
1686    pub fn r#next(
1687        &self,
1688    ) -> fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>
1689    {
1690        RuleIteratorProxyInterface::r#next(self)
1691    }
1692}
1693
1694impl RuleIteratorProxyInterface for RuleIteratorProxy {
1695    type NextResponseFut =
1696        fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1697    fn r#next(&self) -> Self::NextResponseFut {
1698        fn _decode(
1699            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1700        ) -> Result<Vec<Rule>, fidl::Error> {
1701            let _response = fidl::client::decode_transaction_body::<
1702                RuleIteratorNextResponse,
1703                fidl::encoding::DefaultFuchsiaResourceDialect,
1704                0x1007ff472e2fcd45,
1705            >(_buf?)?;
1706            Ok(_response.rules)
1707        }
1708        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Rule>>(
1709            (),
1710            0x1007ff472e2fcd45,
1711            fidl::encoding::DynamicFlags::empty(),
1712            _decode,
1713        )
1714    }
1715}
1716
1717pub struct RuleIteratorEventStream {
1718    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1719}
1720
1721impl std::marker::Unpin for RuleIteratorEventStream {}
1722
1723impl futures::stream::FusedStream for RuleIteratorEventStream {
1724    fn is_terminated(&self) -> bool {
1725        self.event_receiver.is_terminated()
1726    }
1727}
1728
1729impl futures::Stream for RuleIteratorEventStream {
1730    type Item = Result<RuleIteratorEvent, fidl::Error>;
1731
1732    fn poll_next(
1733        mut self: std::pin::Pin<&mut Self>,
1734        cx: &mut std::task::Context<'_>,
1735    ) -> std::task::Poll<Option<Self::Item>> {
1736        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1737            &mut self.event_receiver,
1738            cx
1739        )?) {
1740            Some(buf) => std::task::Poll::Ready(Some(RuleIteratorEvent::decode(buf))),
1741            None => std::task::Poll::Ready(None),
1742        }
1743    }
1744}
1745
1746#[derive(Debug)]
1747pub enum RuleIteratorEvent {}
1748
1749impl RuleIteratorEvent {
1750    /// Decodes a message buffer as a [`RuleIteratorEvent`].
1751    fn decode(
1752        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1753    ) -> Result<RuleIteratorEvent, fidl::Error> {
1754        let (bytes, _handles) = buf.split_mut();
1755        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1756        debug_assert_eq!(tx_header.tx_id, 0);
1757        match tx_header.ordinal {
1758            _ => Err(fidl::Error::UnknownOrdinal {
1759                ordinal: tx_header.ordinal,
1760                protocol_name: <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1761            }),
1762        }
1763    }
1764}
1765
1766/// A Stream of incoming requests for fuchsia.pkg.rewrite/RuleIterator.
1767pub struct RuleIteratorRequestStream {
1768    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1769    is_terminated: bool,
1770}
1771
1772impl std::marker::Unpin for RuleIteratorRequestStream {}
1773
1774impl futures::stream::FusedStream for RuleIteratorRequestStream {
1775    fn is_terminated(&self) -> bool {
1776        self.is_terminated
1777    }
1778}
1779
1780impl fidl::endpoints::RequestStream for RuleIteratorRequestStream {
1781    type Protocol = RuleIteratorMarker;
1782    type ControlHandle = RuleIteratorControlHandle;
1783
1784    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1785        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1786    }
1787
1788    fn control_handle(&self) -> Self::ControlHandle {
1789        RuleIteratorControlHandle { inner: self.inner.clone() }
1790    }
1791
1792    fn into_inner(
1793        self,
1794    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1795    {
1796        (self.inner, self.is_terminated)
1797    }
1798
1799    fn from_inner(
1800        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1801        is_terminated: bool,
1802    ) -> Self {
1803        Self { inner, is_terminated }
1804    }
1805}
1806
1807impl futures::Stream for RuleIteratorRequestStream {
1808    type Item = Result<RuleIteratorRequest, fidl::Error>;
1809
1810    fn poll_next(
1811        mut self: std::pin::Pin<&mut Self>,
1812        cx: &mut std::task::Context<'_>,
1813    ) -> std::task::Poll<Option<Self::Item>> {
1814        let this = &mut *self;
1815        if this.inner.check_shutdown(cx) {
1816            this.is_terminated = true;
1817            return std::task::Poll::Ready(None);
1818        }
1819        if this.is_terminated {
1820            panic!("polled RuleIteratorRequestStream after completion");
1821        }
1822        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1823            |bytes, handles| {
1824                match this.inner.channel().read_etc(cx, bytes, handles) {
1825                    std::task::Poll::Ready(Ok(())) => {}
1826                    std::task::Poll::Pending => return std::task::Poll::Pending,
1827                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1828                        this.is_terminated = true;
1829                        return std::task::Poll::Ready(None);
1830                    }
1831                    std::task::Poll::Ready(Err(e)) => {
1832                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1833                            e.into(),
1834                        ))))
1835                    }
1836                }
1837
1838                // A message has been received from the channel
1839                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1840
1841                std::task::Poll::Ready(Some(match header.ordinal {
1842                    0x1007ff472e2fcd45 => {
1843                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1844                        let mut req = fidl::new_empty!(
1845                            fidl::encoding::EmptyPayload,
1846                            fidl::encoding::DefaultFuchsiaResourceDialect
1847                        );
1848                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1849                        let control_handle =
1850                            RuleIteratorControlHandle { inner: this.inner.clone() };
1851                        Ok(RuleIteratorRequest::Next {
1852                            responder: RuleIteratorNextResponder {
1853                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1854                                tx_id: header.tx_id,
1855                            },
1856                        })
1857                    }
1858                    _ => Err(fidl::Error::UnknownOrdinal {
1859                        ordinal: header.ordinal,
1860                        protocol_name:
1861                            <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1862                    }),
1863                }))
1864            },
1865        )
1866    }
1867}
1868
1869/// The iterator over all the rewrite rules defined in a [`Engine`].
1870#[derive(Debug)]
1871pub enum RuleIteratorRequest {
1872    /// Advances the iterator and returns the next batch of rules.
1873    ///
1874    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1875    ///    vector and then close the channel when there are no more rules.
1876    Next { responder: RuleIteratorNextResponder },
1877}
1878
1879impl RuleIteratorRequest {
1880    #[allow(irrefutable_let_patterns)]
1881    pub fn into_next(self) -> Option<(RuleIteratorNextResponder)> {
1882        if let RuleIteratorRequest::Next { responder } = self {
1883            Some((responder))
1884        } else {
1885            None
1886        }
1887    }
1888
1889    /// Name of the method defined in FIDL
1890    pub fn method_name(&self) -> &'static str {
1891        match *self {
1892            RuleIteratorRequest::Next { .. } => "next",
1893        }
1894    }
1895}
1896
1897#[derive(Debug, Clone)]
1898pub struct RuleIteratorControlHandle {
1899    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1900}
1901
1902impl fidl::endpoints::ControlHandle for RuleIteratorControlHandle {
1903    fn shutdown(&self) {
1904        self.inner.shutdown()
1905    }
1906    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1907        self.inner.shutdown_with_epitaph(status)
1908    }
1909
1910    fn is_closed(&self) -> bool {
1911        self.inner.channel().is_closed()
1912    }
1913    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1914        self.inner.channel().on_closed()
1915    }
1916
1917    #[cfg(target_os = "fuchsia")]
1918    fn signal_peer(
1919        &self,
1920        clear_mask: zx::Signals,
1921        set_mask: zx::Signals,
1922    ) -> Result<(), zx_status::Status> {
1923        use fidl::Peered;
1924        self.inner.channel().signal_peer(clear_mask, set_mask)
1925    }
1926}
1927
1928impl RuleIteratorControlHandle {}
1929
1930#[must_use = "FIDL methods require a response to be sent"]
1931#[derive(Debug)]
1932pub struct RuleIteratorNextResponder {
1933    control_handle: std::mem::ManuallyDrop<RuleIteratorControlHandle>,
1934    tx_id: u32,
1935}
1936
1937/// Set the the channel to be shutdown (see [`RuleIteratorControlHandle::shutdown`])
1938/// if the responder is dropped without sending a response, so that the client
1939/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1940impl std::ops::Drop for RuleIteratorNextResponder {
1941    fn drop(&mut self) {
1942        self.control_handle.shutdown();
1943        // Safety: drops once, never accessed again
1944        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1945    }
1946}
1947
1948impl fidl::endpoints::Responder for RuleIteratorNextResponder {
1949    type ControlHandle = RuleIteratorControlHandle;
1950
1951    fn control_handle(&self) -> &RuleIteratorControlHandle {
1952        &self.control_handle
1953    }
1954
1955    fn drop_without_shutdown(mut self) {
1956        // Safety: drops once, never accessed again due to mem::forget
1957        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1958        // Prevent Drop from running (which would shut down the channel)
1959        std::mem::forget(self);
1960    }
1961}
1962
1963impl RuleIteratorNextResponder {
1964    /// Sends a response to the FIDL transaction.
1965    ///
1966    /// Sets the channel to shutdown if an error occurs.
1967    pub fn send(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1968        let _result = self.send_raw(rules);
1969        if _result.is_err() {
1970            self.control_handle.shutdown();
1971        }
1972        self.drop_without_shutdown();
1973        _result
1974    }
1975
1976    /// Similar to "send" but does not shutdown the channel if an error occurs.
1977    pub fn send_no_shutdown_on_err(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1978        let _result = self.send_raw(rules);
1979        self.drop_without_shutdown();
1980        _result
1981    }
1982
1983    fn send_raw(&self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1984        self.control_handle.inner.send::<RuleIteratorNextResponse>(
1985            (rules,),
1986            self.tx_id,
1987            0x1007ff472e2fcd45,
1988            fidl::encoding::DynamicFlags::empty(),
1989        )
1990    }
1991}
1992
1993mod internal {
1994    use super::*;
1995
1996    impl fidl::encoding::ResourceTypeMarker for EditTransactionListDynamicRequest {
1997        type Borrowed<'a> = &'a mut Self;
1998        fn take_or_borrow<'a>(
1999            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2000        ) -> Self::Borrowed<'a> {
2001            value
2002        }
2003    }
2004
2005    unsafe impl fidl::encoding::TypeMarker for EditTransactionListDynamicRequest {
2006        type Owned = Self;
2007
2008        #[inline(always)]
2009        fn inline_align(_context: fidl::encoding::Context) -> usize {
2010            4
2011        }
2012
2013        #[inline(always)]
2014        fn inline_size(_context: fidl::encoding::Context) -> usize {
2015            4
2016        }
2017    }
2018
2019    unsafe impl
2020        fidl::encoding::Encode<
2021            EditTransactionListDynamicRequest,
2022            fidl::encoding::DefaultFuchsiaResourceDialect,
2023        > for &mut EditTransactionListDynamicRequest
2024    {
2025        #[inline]
2026        unsafe fn encode(
2027            self,
2028            encoder: &mut fidl::encoding::Encoder<
2029                '_,
2030                fidl::encoding::DefaultFuchsiaResourceDialect,
2031            >,
2032            offset: usize,
2033            _depth: fidl::encoding::Depth,
2034        ) -> fidl::Result<()> {
2035            encoder.debug_check_bounds::<EditTransactionListDynamicRequest>(offset);
2036            // Delegate to tuple encoding.
2037            fidl::encoding::Encode::<EditTransactionListDynamicRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2038                (
2039                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2040                ),
2041                encoder, offset, _depth
2042            )
2043        }
2044    }
2045    unsafe impl<
2046            T0: fidl::encoding::Encode<
2047                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2048                fidl::encoding::DefaultFuchsiaResourceDialect,
2049            >,
2050        >
2051        fidl::encoding::Encode<
2052            EditTransactionListDynamicRequest,
2053            fidl::encoding::DefaultFuchsiaResourceDialect,
2054        > for (T0,)
2055    {
2056        #[inline]
2057        unsafe fn encode(
2058            self,
2059            encoder: &mut fidl::encoding::Encoder<
2060                '_,
2061                fidl::encoding::DefaultFuchsiaResourceDialect,
2062            >,
2063            offset: usize,
2064            depth: fidl::encoding::Depth,
2065        ) -> fidl::Result<()> {
2066            encoder.debug_check_bounds::<EditTransactionListDynamicRequest>(offset);
2067            // Zero out padding regions. There's no need to apply masks
2068            // because the unmasked parts will be overwritten by fields.
2069            // Write the fields.
2070            self.0.encode(encoder, offset + 0, depth)?;
2071            Ok(())
2072        }
2073    }
2074
2075    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2076        for EditTransactionListDynamicRequest
2077    {
2078        #[inline(always)]
2079        fn new_empty() -> Self {
2080            Self {
2081                iterator: fidl::new_empty!(
2082                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2083                    fidl::encoding::DefaultFuchsiaResourceDialect
2084                ),
2085            }
2086        }
2087
2088        #[inline]
2089        unsafe fn decode(
2090            &mut self,
2091            decoder: &mut fidl::encoding::Decoder<
2092                '_,
2093                fidl::encoding::DefaultFuchsiaResourceDialect,
2094            >,
2095            offset: usize,
2096            _depth: fidl::encoding::Depth,
2097        ) -> fidl::Result<()> {
2098            decoder.debug_check_bounds::<Self>(offset);
2099            // Verify that padding bytes are zero.
2100            fidl::decode!(
2101                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2102                fidl::encoding::DefaultFuchsiaResourceDialect,
2103                &mut self.iterator,
2104                decoder,
2105                offset + 0,
2106                _depth
2107            )?;
2108            Ok(())
2109        }
2110    }
2111
2112    impl fidl::encoding::ResourceTypeMarker for EngineListRequest {
2113        type Borrowed<'a> = &'a mut Self;
2114        fn take_or_borrow<'a>(
2115            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2116        ) -> Self::Borrowed<'a> {
2117            value
2118        }
2119    }
2120
2121    unsafe impl fidl::encoding::TypeMarker for EngineListRequest {
2122        type Owned = Self;
2123
2124        #[inline(always)]
2125        fn inline_align(_context: fidl::encoding::Context) -> usize {
2126            4
2127        }
2128
2129        #[inline(always)]
2130        fn inline_size(_context: fidl::encoding::Context) -> usize {
2131            4
2132        }
2133    }
2134
2135    unsafe impl
2136        fidl::encoding::Encode<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2137        for &mut EngineListRequest
2138    {
2139        #[inline]
2140        unsafe fn encode(
2141            self,
2142            encoder: &mut fidl::encoding::Encoder<
2143                '_,
2144                fidl::encoding::DefaultFuchsiaResourceDialect,
2145            >,
2146            offset: usize,
2147            _depth: fidl::encoding::Depth,
2148        ) -> fidl::Result<()> {
2149            encoder.debug_check_bounds::<EngineListRequest>(offset);
2150            // Delegate to tuple encoding.
2151            fidl::encoding::Encode::<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2152                (
2153                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2154                ),
2155                encoder, offset, _depth
2156            )
2157        }
2158    }
2159    unsafe impl<
2160            T0: fidl::encoding::Encode<
2161                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2162                fidl::encoding::DefaultFuchsiaResourceDialect,
2163            >,
2164        >
2165        fidl::encoding::Encode<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2166        for (T0,)
2167    {
2168        #[inline]
2169        unsafe fn encode(
2170            self,
2171            encoder: &mut fidl::encoding::Encoder<
2172                '_,
2173                fidl::encoding::DefaultFuchsiaResourceDialect,
2174            >,
2175            offset: usize,
2176            depth: fidl::encoding::Depth,
2177        ) -> fidl::Result<()> {
2178            encoder.debug_check_bounds::<EngineListRequest>(offset);
2179            // Zero out padding regions. There's no need to apply masks
2180            // because the unmasked parts will be overwritten by fields.
2181            // Write the fields.
2182            self.0.encode(encoder, offset + 0, depth)?;
2183            Ok(())
2184        }
2185    }
2186
2187    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2188        for EngineListRequest
2189    {
2190        #[inline(always)]
2191        fn new_empty() -> Self {
2192            Self {
2193                iterator: fidl::new_empty!(
2194                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2195                    fidl::encoding::DefaultFuchsiaResourceDialect
2196                ),
2197            }
2198        }
2199
2200        #[inline]
2201        unsafe fn decode(
2202            &mut self,
2203            decoder: &mut fidl::encoding::Decoder<
2204                '_,
2205                fidl::encoding::DefaultFuchsiaResourceDialect,
2206            >,
2207            offset: usize,
2208            _depth: fidl::encoding::Depth,
2209        ) -> fidl::Result<()> {
2210            decoder.debug_check_bounds::<Self>(offset);
2211            // Verify that padding bytes are zero.
2212            fidl::decode!(
2213                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2214                fidl::encoding::DefaultFuchsiaResourceDialect,
2215                &mut self.iterator,
2216                decoder,
2217                offset + 0,
2218                _depth
2219            )?;
2220            Ok(())
2221        }
2222    }
2223
2224    impl fidl::encoding::ResourceTypeMarker for EngineListStaticRequest {
2225        type Borrowed<'a> = &'a mut Self;
2226        fn take_or_borrow<'a>(
2227            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2228        ) -> Self::Borrowed<'a> {
2229            value
2230        }
2231    }
2232
2233    unsafe impl fidl::encoding::TypeMarker for EngineListStaticRequest {
2234        type Owned = Self;
2235
2236        #[inline(always)]
2237        fn inline_align(_context: fidl::encoding::Context) -> usize {
2238            4
2239        }
2240
2241        #[inline(always)]
2242        fn inline_size(_context: fidl::encoding::Context) -> usize {
2243            4
2244        }
2245    }
2246
2247    unsafe impl
2248        fidl::encoding::Encode<
2249            EngineListStaticRequest,
2250            fidl::encoding::DefaultFuchsiaResourceDialect,
2251        > for &mut EngineListStaticRequest
2252    {
2253        #[inline]
2254        unsafe fn encode(
2255            self,
2256            encoder: &mut fidl::encoding::Encoder<
2257                '_,
2258                fidl::encoding::DefaultFuchsiaResourceDialect,
2259            >,
2260            offset: usize,
2261            _depth: fidl::encoding::Depth,
2262        ) -> fidl::Result<()> {
2263            encoder.debug_check_bounds::<EngineListStaticRequest>(offset);
2264            // Delegate to tuple encoding.
2265            fidl::encoding::Encode::<EngineListStaticRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2266                (
2267                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2268                ),
2269                encoder, offset, _depth
2270            )
2271        }
2272    }
2273    unsafe impl<
2274            T0: fidl::encoding::Encode<
2275                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2276                fidl::encoding::DefaultFuchsiaResourceDialect,
2277            >,
2278        >
2279        fidl::encoding::Encode<
2280            EngineListStaticRequest,
2281            fidl::encoding::DefaultFuchsiaResourceDialect,
2282        > for (T0,)
2283    {
2284        #[inline]
2285        unsafe fn encode(
2286            self,
2287            encoder: &mut fidl::encoding::Encoder<
2288                '_,
2289                fidl::encoding::DefaultFuchsiaResourceDialect,
2290            >,
2291            offset: usize,
2292            depth: fidl::encoding::Depth,
2293        ) -> fidl::Result<()> {
2294            encoder.debug_check_bounds::<EngineListStaticRequest>(offset);
2295            // Zero out padding regions. There's no need to apply masks
2296            // because the unmasked parts will be overwritten by fields.
2297            // Write the fields.
2298            self.0.encode(encoder, offset + 0, depth)?;
2299            Ok(())
2300        }
2301    }
2302
2303    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2304        for EngineListStaticRequest
2305    {
2306        #[inline(always)]
2307        fn new_empty() -> Self {
2308            Self {
2309                iterator: fidl::new_empty!(
2310                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2311                    fidl::encoding::DefaultFuchsiaResourceDialect
2312                ),
2313            }
2314        }
2315
2316        #[inline]
2317        unsafe fn decode(
2318            &mut self,
2319            decoder: &mut fidl::encoding::Decoder<
2320                '_,
2321                fidl::encoding::DefaultFuchsiaResourceDialect,
2322            >,
2323            offset: usize,
2324            _depth: fidl::encoding::Depth,
2325        ) -> fidl::Result<()> {
2326            decoder.debug_check_bounds::<Self>(offset);
2327            // Verify that padding bytes are zero.
2328            fidl::decode!(
2329                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2330                fidl::encoding::DefaultFuchsiaResourceDialect,
2331                &mut self.iterator,
2332                decoder,
2333                offset + 0,
2334                _depth
2335            )?;
2336            Ok(())
2337        }
2338    }
2339
2340    impl fidl::encoding::ResourceTypeMarker for EngineStartEditTransactionRequest {
2341        type Borrowed<'a> = &'a mut Self;
2342        fn take_or_borrow<'a>(
2343            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2344        ) -> Self::Borrowed<'a> {
2345            value
2346        }
2347    }
2348
2349    unsafe impl fidl::encoding::TypeMarker for EngineStartEditTransactionRequest {
2350        type Owned = Self;
2351
2352        #[inline(always)]
2353        fn inline_align(_context: fidl::encoding::Context) -> usize {
2354            4
2355        }
2356
2357        #[inline(always)]
2358        fn inline_size(_context: fidl::encoding::Context) -> usize {
2359            4
2360        }
2361    }
2362
2363    unsafe impl
2364        fidl::encoding::Encode<
2365            EngineStartEditTransactionRequest,
2366            fidl::encoding::DefaultFuchsiaResourceDialect,
2367        > for &mut EngineStartEditTransactionRequest
2368    {
2369        #[inline]
2370        unsafe fn encode(
2371            self,
2372            encoder: &mut fidl::encoding::Encoder<
2373                '_,
2374                fidl::encoding::DefaultFuchsiaResourceDialect,
2375            >,
2376            offset: usize,
2377            _depth: fidl::encoding::Depth,
2378        ) -> fidl::Result<()> {
2379            encoder.debug_check_bounds::<EngineStartEditTransactionRequest>(offset);
2380            // Delegate to tuple encoding.
2381            fidl::encoding::Encode::<EngineStartEditTransactionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2382                (
2383                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.transaction),
2384                ),
2385                encoder, offset, _depth
2386            )
2387        }
2388    }
2389    unsafe impl<
2390            T0: fidl::encoding::Encode<
2391                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2392                fidl::encoding::DefaultFuchsiaResourceDialect,
2393            >,
2394        >
2395        fidl::encoding::Encode<
2396            EngineStartEditTransactionRequest,
2397            fidl::encoding::DefaultFuchsiaResourceDialect,
2398        > for (T0,)
2399    {
2400        #[inline]
2401        unsafe fn encode(
2402            self,
2403            encoder: &mut fidl::encoding::Encoder<
2404                '_,
2405                fidl::encoding::DefaultFuchsiaResourceDialect,
2406            >,
2407            offset: usize,
2408            depth: fidl::encoding::Depth,
2409        ) -> fidl::Result<()> {
2410            encoder.debug_check_bounds::<EngineStartEditTransactionRequest>(offset);
2411            // Zero out padding regions. There's no need to apply masks
2412            // because the unmasked parts will be overwritten by fields.
2413            // Write the fields.
2414            self.0.encode(encoder, offset + 0, depth)?;
2415            Ok(())
2416        }
2417    }
2418
2419    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2420        for EngineStartEditTransactionRequest
2421    {
2422        #[inline(always)]
2423        fn new_empty() -> Self {
2424            Self {
2425                transaction: fidl::new_empty!(
2426                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2427                    fidl::encoding::DefaultFuchsiaResourceDialect
2428                ),
2429            }
2430        }
2431
2432        #[inline]
2433        unsafe fn decode(
2434            &mut self,
2435            decoder: &mut fidl::encoding::Decoder<
2436                '_,
2437                fidl::encoding::DefaultFuchsiaResourceDialect,
2438            >,
2439            offset: usize,
2440            _depth: fidl::encoding::Depth,
2441        ) -> fidl::Result<()> {
2442            decoder.debug_check_bounds::<Self>(offset);
2443            // Verify that padding bytes are zero.
2444            fidl::decode!(
2445                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2446                fidl::encoding::DefaultFuchsiaResourceDialect,
2447                &mut self.transaction,
2448                decoder,
2449                offset + 0,
2450                _depth
2451            )?;
2452            Ok(())
2453        }
2454    }
2455}