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::NullableHandle {
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
670    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
671        self.inner.shutdown_with_epitaph(status)
672    }
673
674    fn is_closed(&self) -> bool {
675        self.inner.channel().is_closed()
676    }
677    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
678        self.inner.channel().on_closed()
679    }
680
681    #[cfg(target_os = "fuchsia")]
682    fn signal_peer(
683        &self,
684        clear_mask: zx::Signals,
685        set_mask: zx::Signals,
686    ) -> Result<(), zx_status::Status> {
687        use fidl::Peered;
688        self.inner.channel().signal_peer(clear_mask, set_mask)
689    }
690}
691
692impl EditTransactionControlHandle {}
693
694#[must_use = "FIDL methods require a response to be sent"]
695#[derive(Debug)]
696pub struct EditTransactionAddResponder {
697    control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
698    tx_id: u32,
699}
700
701/// Set the the channel to be shutdown (see [`EditTransactionControlHandle::shutdown`])
702/// if the responder is dropped without sending a response, so that the client
703/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
704impl std::ops::Drop for EditTransactionAddResponder {
705    fn drop(&mut self) {
706        self.control_handle.shutdown();
707        // Safety: drops once, never accessed again
708        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
709    }
710}
711
712impl fidl::endpoints::Responder for EditTransactionAddResponder {
713    type ControlHandle = EditTransactionControlHandle;
714
715    fn control_handle(&self) -> &EditTransactionControlHandle {
716        &self.control_handle
717    }
718
719    fn drop_without_shutdown(mut self) {
720        // Safety: drops once, never accessed again due to mem::forget
721        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
722        // Prevent Drop from running (which would shut down the channel)
723        std::mem::forget(self);
724    }
725}
726
727impl EditTransactionAddResponder {
728    /// Sends a response to the FIDL transaction.
729    ///
730    /// Sets the channel to shutdown if an error occurs.
731    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
732        let _result = self.send_raw(result);
733        if _result.is_err() {
734            self.control_handle.shutdown();
735        }
736        self.drop_without_shutdown();
737        _result
738    }
739
740    /// Similar to "send" but does not shutdown the channel if an error occurs.
741    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
742        let _result = self.send_raw(result);
743        self.drop_without_shutdown();
744        _result
745    }
746
747    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
748        self.control_handle
749            .inner
750            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
751                result,
752                self.tx_id,
753                0x56a2b5fe92ca5db6,
754                fidl::encoding::DynamicFlags::empty(),
755            )
756    }
757}
758
759#[must_use = "FIDL methods require a response to be sent"]
760#[derive(Debug)]
761pub struct EditTransactionCommitResponder {
762    control_handle: std::mem::ManuallyDrop<EditTransactionControlHandle>,
763    tx_id: u32,
764}
765
766/// Set the the channel to be shutdown (see [`EditTransactionControlHandle::shutdown`])
767/// if the responder is dropped without sending a response, so that the client
768/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
769impl std::ops::Drop for EditTransactionCommitResponder {
770    fn drop(&mut self) {
771        self.control_handle.shutdown();
772        // Safety: drops once, never accessed again
773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
774    }
775}
776
777impl fidl::endpoints::Responder for EditTransactionCommitResponder {
778    type ControlHandle = EditTransactionControlHandle;
779
780    fn control_handle(&self) -> &EditTransactionControlHandle {
781        &self.control_handle
782    }
783
784    fn drop_without_shutdown(mut self) {
785        // Safety: drops once, never accessed again due to mem::forget
786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
787        // Prevent Drop from running (which would shut down the channel)
788        std::mem::forget(self);
789    }
790}
791
792impl EditTransactionCommitResponder {
793    /// Sends a response to the FIDL transaction.
794    ///
795    /// Sets the channel to shutdown if an error occurs.
796    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
797        let _result = self.send_raw(result);
798        if _result.is_err() {
799            self.control_handle.shutdown();
800        }
801        self.drop_without_shutdown();
802        _result
803    }
804
805    /// Similar to "send" but does not shutdown the channel if an error occurs.
806    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
807        let _result = self.send_raw(result);
808        self.drop_without_shutdown();
809        _result
810    }
811
812    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
813        self.control_handle
814            .inner
815            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
816                result,
817                self.tx_id,
818                0x3ca50fc9c13341fb,
819                fidl::encoding::DynamicFlags::empty(),
820            )
821    }
822}
823
824#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
825pub struct EngineMarker;
826
827impl fidl::endpoints::ProtocolMarker for EngineMarker {
828    type Proxy = EngineProxy;
829    type RequestStream = EngineRequestStream;
830    #[cfg(target_os = "fuchsia")]
831    type SynchronousProxy = EngineSynchronousProxy;
832
833    const DEBUG_NAME: &'static str = "fuchsia.pkg.rewrite.Engine";
834}
835impl fidl::endpoints::DiscoverableProtocolMarker for EngineMarker {}
836pub type EngineTestApplyResult = Result<String, i32>;
837
838pub trait EngineProxyInterface: Send + Sync {
839    fn r#start_edit_transaction(
840        &self,
841        transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
842    ) -> Result<(), fidl::Error>;
843    fn r#list(
844        &self,
845        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
846    ) -> Result<(), fidl::Error>;
847    fn r#list_static(
848        &self,
849        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
850    ) -> Result<(), fidl::Error>;
851    type TestApplyResponseFut: std::future::Future<Output = Result<EngineTestApplyResult, fidl::Error>>
852        + Send;
853    fn r#test_apply(&self, url: &str) -> Self::TestApplyResponseFut;
854}
855#[derive(Debug)]
856#[cfg(target_os = "fuchsia")]
857pub struct EngineSynchronousProxy {
858    client: fidl::client::sync::Client,
859}
860
861#[cfg(target_os = "fuchsia")]
862impl fidl::endpoints::SynchronousProxy for EngineSynchronousProxy {
863    type Proxy = EngineProxy;
864    type Protocol = EngineMarker;
865
866    fn from_channel(inner: fidl::Channel) -> Self {
867        Self::new(inner)
868    }
869
870    fn into_channel(self) -> fidl::Channel {
871        self.client.into_channel()
872    }
873
874    fn as_channel(&self) -> &fidl::Channel {
875        self.client.as_channel()
876    }
877}
878
879#[cfg(target_os = "fuchsia")]
880impl EngineSynchronousProxy {
881    pub fn new(channel: fidl::Channel) -> Self {
882        let protocol_name = <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
883        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
884    }
885
886    pub fn into_channel(self) -> fidl::Channel {
887        self.client.into_channel()
888    }
889
890    /// Waits until an event arrives and returns it. It is safe for other
891    /// threads to make concurrent requests while waiting for an event.
892    pub fn wait_for_event(
893        &self,
894        deadline: zx::MonotonicInstant,
895    ) -> Result<EngineEvent, fidl::Error> {
896        EngineEvent::decode(self.client.wait_for_event(deadline)?)
897    }
898
899    /// Begins a rule edit transaction.
900    ///
901    /// + request `transaction` a request for an [`EditTransaction`].
902    pub fn r#start_edit_transaction(
903        &self,
904        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
905    ) -> Result<(), fidl::Error> {
906        self.client.send::<EngineStartEditTransactionRequest>(
907            (transaction,),
908            0x6f649b7dbbc904fb,
909            fidl::encoding::DynamicFlags::empty(),
910        )
911    }
912
913    /// Returns an iterator over all rewrite rules.
914    ///
915    /// + request `iterator` a request for an iterator.
916    pub fn r#list(
917        &self,
918        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
919    ) -> Result<(), fidl::Error> {
920        self.client.send::<EngineListRequest>(
921            (iterator,),
922            0xccbc8b5cb10ad14,
923            fidl::encoding::DynamicFlags::empty(),
924        )
925    }
926
927    /// Returns an iterator over all static (immutable) rewrite rules. These
928    /// rules are handled as lower priority than dynamic rules and cannot be
929    /// modified (although they can be overridden) by [`EditTransaction`]s.
930    ///
931    /// + request `iterator` a request for an iterator.
932    pub fn r#list_static(
933        &self,
934        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
935    ) -> Result<(), fidl::Error> {
936        self.client.send::<EngineListStaticRequest>(
937            (iterator,),
938            0x5416f92d0bac1b30,
939            fidl::encoding::DynamicFlags::empty(),
940        )
941    }
942
943    /// Rewrites the given `url` with the current rewrite rule set, returning the
944    /// `rewritten` url.  If no rules match or a rule matches but performs an
945    /// identity transformation, this API returns `url` unchanged.
946    ///
947    /// This API is intended only for reflecting on rule side effects. Using
948    /// this API to pre-apply the rules, then passing the result to
949    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
950    ///
951    /// + request `url` the url to rewrite.
952    /// - response `rewritten` the rewritten url.
953    /// * error a zx_status value indicating failure. One of the following:
954    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
955    ///       URL. See [`fuchsia-pkg URL`].
956    ///
957    /// [`fuchsia-pkg URL`]:
958    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
959    pub fn r#test_apply(
960        &self,
961        mut url: &str,
962        ___deadline: zx::MonotonicInstant,
963    ) -> Result<EngineTestApplyResult, fidl::Error> {
964        let _response = self.client.send_query::<
965            EngineTestApplyRequest,
966            fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
967        >(
968            (url,),
969            0xc8826a2b36fca39,
970            fidl::encoding::DynamicFlags::empty(),
971            ___deadline,
972        )?;
973        Ok(_response.map(|x| x.rewritten))
974    }
975}
976
977#[cfg(target_os = "fuchsia")]
978impl From<EngineSynchronousProxy> for zx::NullableHandle {
979    fn from(value: EngineSynchronousProxy) -> Self {
980        value.into_channel().into()
981    }
982}
983
984#[cfg(target_os = "fuchsia")]
985impl From<fidl::Channel> for EngineSynchronousProxy {
986    fn from(value: fidl::Channel) -> Self {
987        Self::new(value)
988    }
989}
990
991#[cfg(target_os = "fuchsia")]
992impl fidl::endpoints::FromClient for EngineSynchronousProxy {
993    type Protocol = EngineMarker;
994
995    fn from_client(value: fidl::endpoints::ClientEnd<EngineMarker>) -> Self {
996        Self::new(value.into_channel())
997    }
998}
999
1000#[derive(Debug, Clone)]
1001pub struct EngineProxy {
1002    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1003}
1004
1005impl fidl::endpoints::Proxy for EngineProxy {
1006    type Protocol = EngineMarker;
1007
1008    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1009        Self::new(inner)
1010    }
1011
1012    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1013        self.client.into_channel().map_err(|client| Self { client })
1014    }
1015
1016    fn as_channel(&self) -> &::fidl::AsyncChannel {
1017        self.client.as_channel()
1018    }
1019}
1020
1021impl EngineProxy {
1022    /// Create a new Proxy for fuchsia.pkg.rewrite/Engine.
1023    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1024        let protocol_name = <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1025        Self { client: fidl::client::Client::new(channel, protocol_name) }
1026    }
1027
1028    /// Get a Stream of events from the remote end of the protocol.
1029    ///
1030    /// # Panics
1031    ///
1032    /// Panics if the event stream was already taken.
1033    pub fn take_event_stream(&self) -> EngineEventStream {
1034        EngineEventStream { event_receiver: self.client.take_event_receiver() }
1035    }
1036
1037    /// Begins a rule edit transaction.
1038    ///
1039    /// + request `transaction` a request for an [`EditTransaction`].
1040    pub fn r#start_edit_transaction(
1041        &self,
1042        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1043    ) -> Result<(), fidl::Error> {
1044        EngineProxyInterface::r#start_edit_transaction(self, transaction)
1045    }
1046
1047    /// Returns an iterator over all rewrite rules.
1048    ///
1049    /// + request `iterator` a request for an iterator.
1050    pub fn r#list(
1051        &self,
1052        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1053    ) -> Result<(), fidl::Error> {
1054        EngineProxyInterface::r#list(self, iterator)
1055    }
1056
1057    /// Returns an iterator over all static (immutable) rewrite rules. These
1058    /// rules are handled as lower priority than dynamic rules and cannot be
1059    /// modified (although they can be overridden) by [`EditTransaction`]s.
1060    ///
1061    /// + request `iterator` a request for an iterator.
1062    pub fn r#list_static(
1063        &self,
1064        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1065    ) -> Result<(), fidl::Error> {
1066        EngineProxyInterface::r#list_static(self, iterator)
1067    }
1068
1069    /// Rewrites the given `url` with the current rewrite rule set, returning the
1070    /// `rewritten` url.  If no rules match or a rule matches but performs an
1071    /// identity transformation, this API returns `url` unchanged.
1072    ///
1073    /// This API is intended only for reflecting on rule side effects. Using
1074    /// this API to pre-apply the rules, then passing the result to
1075    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
1076    ///
1077    /// + request `url` the url to rewrite.
1078    /// - response `rewritten` the rewritten url.
1079    /// * error a zx_status value indicating failure. One of the following:
1080    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
1081    ///       URL. See [`fuchsia-pkg URL`].
1082    ///
1083    /// [`fuchsia-pkg URL`]:
1084    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
1085    pub fn r#test_apply(
1086        &self,
1087        mut url: &str,
1088    ) -> fidl::client::QueryResponseFut<
1089        EngineTestApplyResult,
1090        fidl::encoding::DefaultFuchsiaResourceDialect,
1091    > {
1092        EngineProxyInterface::r#test_apply(self, url)
1093    }
1094}
1095
1096impl EngineProxyInterface for EngineProxy {
1097    fn r#start_edit_transaction(
1098        &self,
1099        mut transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1100    ) -> Result<(), fidl::Error> {
1101        self.client.send::<EngineStartEditTransactionRequest>(
1102            (transaction,),
1103            0x6f649b7dbbc904fb,
1104            fidl::encoding::DynamicFlags::empty(),
1105        )
1106    }
1107
1108    fn r#list(
1109        &self,
1110        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1111    ) -> Result<(), fidl::Error> {
1112        self.client.send::<EngineListRequest>(
1113            (iterator,),
1114            0xccbc8b5cb10ad14,
1115            fidl::encoding::DynamicFlags::empty(),
1116        )
1117    }
1118
1119    fn r#list_static(
1120        &self,
1121        mut iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1122    ) -> Result<(), fidl::Error> {
1123        self.client.send::<EngineListStaticRequest>(
1124            (iterator,),
1125            0x5416f92d0bac1b30,
1126            fidl::encoding::DynamicFlags::empty(),
1127        )
1128    }
1129
1130    type TestApplyResponseFut = fidl::client::QueryResponseFut<
1131        EngineTestApplyResult,
1132        fidl::encoding::DefaultFuchsiaResourceDialect,
1133    >;
1134    fn r#test_apply(&self, mut url: &str) -> Self::TestApplyResponseFut {
1135        fn _decode(
1136            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1137        ) -> Result<EngineTestApplyResult, fidl::Error> {
1138            let _response = fidl::client::decode_transaction_body::<
1139                fidl::encoding::ResultType<EngineTestApplyResponse, i32>,
1140                fidl::encoding::DefaultFuchsiaResourceDialect,
1141                0xc8826a2b36fca39,
1142            >(_buf?)?;
1143            Ok(_response.map(|x| x.rewritten))
1144        }
1145        self.client.send_query_and_decode::<EngineTestApplyRequest, EngineTestApplyResult>(
1146            (url,),
1147            0xc8826a2b36fca39,
1148            fidl::encoding::DynamicFlags::empty(),
1149            _decode,
1150        )
1151    }
1152}
1153
1154pub struct EngineEventStream {
1155    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1156}
1157
1158impl std::marker::Unpin for EngineEventStream {}
1159
1160impl futures::stream::FusedStream for EngineEventStream {
1161    fn is_terminated(&self) -> bool {
1162        self.event_receiver.is_terminated()
1163    }
1164}
1165
1166impl futures::Stream for EngineEventStream {
1167    type Item = Result<EngineEvent, fidl::Error>;
1168
1169    fn poll_next(
1170        mut self: std::pin::Pin<&mut Self>,
1171        cx: &mut std::task::Context<'_>,
1172    ) -> std::task::Poll<Option<Self::Item>> {
1173        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1174            &mut self.event_receiver,
1175            cx
1176        )?) {
1177            Some(buf) => std::task::Poll::Ready(Some(EngineEvent::decode(buf))),
1178            None => std::task::Poll::Ready(None),
1179        }
1180    }
1181}
1182
1183#[derive(Debug)]
1184pub enum EngineEvent {}
1185
1186impl EngineEvent {
1187    /// Decodes a message buffer as a [`EngineEvent`].
1188    fn decode(
1189        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1190    ) -> Result<EngineEvent, fidl::Error> {
1191        let (bytes, _handles) = buf.split_mut();
1192        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1193        debug_assert_eq!(tx_header.tx_id, 0);
1194        match tx_header.ordinal {
1195            _ => Err(fidl::Error::UnknownOrdinal {
1196                ordinal: tx_header.ordinal,
1197                protocol_name: <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1198            }),
1199        }
1200    }
1201}
1202
1203/// A Stream of incoming requests for fuchsia.pkg.rewrite/Engine.
1204pub struct EngineRequestStream {
1205    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1206    is_terminated: bool,
1207}
1208
1209impl std::marker::Unpin for EngineRequestStream {}
1210
1211impl futures::stream::FusedStream for EngineRequestStream {
1212    fn is_terminated(&self) -> bool {
1213        self.is_terminated
1214    }
1215}
1216
1217impl fidl::endpoints::RequestStream for EngineRequestStream {
1218    type Protocol = EngineMarker;
1219    type ControlHandle = EngineControlHandle;
1220
1221    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1222        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1223    }
1224
1225    fn control_handle(&self) -> Self::ControlHandle {
1226        EngineControlHandle { inner: self.inner.clone() }
1227    }
1228
1229    fn into_inner(
1230        self,
1231    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1232    {
1233        (self.inner, self.is_terminated)
1234    }
1235
1236    fn from_inner(
1237        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1238        is_terminated: bool,
1239    ) -> Self {
1240        Self { inner, is_terminated }
1241    }
1242}
1243
1244impl futures::Stream for EngineRequestStream {
1245    type Item = Result<EngineRequest, fidl::Error>;
1246
1247    fn poll_next(
1248        mut self: std::pin::Pin<&mut Self>,
1249        cx: &mut std::task::Context<'_>,
1250    ) -> std::task::Poll<Option<Self::Item>> {
1251        let this = &mut *self;
1252        if this.inner.check_shutdown(cx) {
1253            this.is_terminated = true;
1254            return std::task::Poll::Ready(None);
1255        }
1256        if this.is_terminated {
1257            panic!("polled EngineRequestStream after completion");
1258        }
1259        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1260            |bytes, handles| {
1261                match this.inner.channel().read_etc(cx, bytes, handles) {
1262                    std::task::Poll::Ready(Ok(())) => {}
1263                    std::task::Poll::Pending => return std::task::Poll::Pending,
1264                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1265                        this.is_terminated = true;
1266                        return std::task::Poll::Ready(None);
1267                    }
1268                    std::task::Poll::Ready(Err(e)) => {
1269                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1270                            e.into(),
1271                        ))));
1272                    }
1273                }
1274
1275                // A message has been received from the channel
1276                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1277
1278                std::task::Poll::Ready(Some(match header.ordinal {
1279                    0x6f649b7dbbc904fb => {
1280                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1281                        let mut req = fidl::new_empty!(
1282                            EngineStartEditTransactionRequest,
1283                            fidl::encoding::DefaultFuchsiaResourceDialect
1284                        );
1285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineStartEditTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
1286                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1287                        Ok(EngineRequest::StartEditTransaction {
1288                            transaction: req.transaction,
1289
1290                            control_handle,
1291                        })
1292                    }
1293                    0xccbc8b5cb10ad14 => {
1294                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1295                        let mut req = fidl::new_empty!(
1296                            EngineListRequest,
1297                            fidl::encoding::DefaultFuchsiaResourceDialect
1298                        );
1299                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListRequest>(&header, _body_bytes, handles, &mut req)?;
1300                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1301                        Ok(EngineRequest::List { iterator: req.iterator, control_handle })
1302                    }
1303                    0x5416f92d0bac1b30 => {
1304                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1305                        let mut req = fidl::new_empty!(
1306                            EngineListStaticRequest,
1307                            fidl::encoding::DefaultFuchsiaResourceDialect
1308                        );
1309                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineListStaticRequest>(&header, _body_bytes, handles, &mut req)?;
1310                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1311                        Ok(EngineRequest::ListStatic { iterator: req.iterator, control_handle })
1312                    }
1313                    0xc8826a2b36fca39 => {
1314                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1315                        let mut req = fidl::new_empty!(
1316                            EngineTestApplyRequest,
1317                            fidl::encoding::DefaultFuchsiaResourceDialect
1318                        );
1319                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EngineTestApplyRequest>(&header, _body_bytes, handles, &mut req)?;
1320                        let control_handle = EngineControlHandle { inner: this.inner.clone() };
1321                        Ok(EngineRequest::TestApply {
1322                            url: req.url,
1323
1324                            responder: EngineTestApplyResponder {
1325                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1326                                tx_id: header.tx_id,
1327                            },
1328                        })
1329                    }
1330                    _ => Err(fidl::Error::UnknownOrdinal {
1331                        ordinal: header.ordinal,
1332                        protocol_name:
1333                            <EngineMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1334                    }),
1335                }))
1336            },
1337        )
1338    }
1339}
1340
1341/// This manages fuchsia-pkg:// rewrite rules.
1342///
1343/// When a package resolver is asked to resolve a fuchsia-pkg URL, it must first
1344/// iterate through its sequence of rewrite rules (given by [`List`]). The
1345/// rewrite engine will rewrite the given URL with the first rule that:
1346/// * matches the given URL
1347/// * produces a valid URL when applied to the given URL
1348///
1349/// If no rules match, the URL is resolved as-is.
1350///
1351/// This is intended to be implemented by package resolver components,
1352/// and used by repository administration tools.
1353#[derive(Debug)]
1354pub enum EngineRequest {
1355    /// Begins a rule edit transaction.
1356    ///
1357    /// + request `transaction` a request for an [`EditTransaction`].
1358    StartEditTransaction {
1359        transaction: fidl::endpoints::ServerEnd<EditTransactionMarker>,
1360        control_handle: EngineControlHandle,
1361    },
1362    /// Returns an iterator over all rewrite rules.
1363    ///
1364    /// + request `iterator` a request for an iterator.
1365    List {
1366        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1367        control_handle: EngineControlHandle,
1368    },
1369    /// Returns an iterator over all static (immutable) rewrite rules. These
1370    /// rules are handled as lower priority than dynamic rules and cannot be
1371    /// modified (although they can be overridden) by [`EditTransaction`]s.
1372    ///
1373    /// + request `iterator` a request for an iterator.
1374    ListStatic {
1375        iterator: fidl::endpoints::ServerEnd<RuleIteratorMarker>,
1376        control_handle: EngineControlHandle,
1377    },
1378    /// Rewrites the given `url` with the current rewrite rule set, returning the
1379    /// `rewritten` url.  If no rules match or a rule matches but performs an
1380    /// identity transformation, this API returns `url` unchanged.
1381    ///
1382    /// This API is intended only for reflecting on rule side effects. Using
1383    /// this API to pre-apply the rules, then passing the result to
1384    /// [`fuchsia.pkg/PackageResolver.Resolve`] would apply the rules twice.
1385    ///
1386    /// + request `url` the url to rewrite.
1387    /// - response `rewritten` the rewritten url.
1388    /// * error a zx_status value indicating failure. One of the following:
1389    ///     * `ZX_ERR_INVALID_ARGS` if `url` is not a valid `fuchsia-pkg://`
1390    ///       URL. See [`fuchsia-pkg URL`].
1391    ///
1392    /// [`fuchsia-pkg URL`]:
1393    ///    https://fuchsia.dev/fuchsia-src/concepts/storage/package_url
1394    TestApply { url: String, responder: EngineTestApplyResponder },
1395}
1396
1397impl EngineRequest {
1398    #[allow(irrefutable_let_patterns)]
1399    pub fn into_start_edit_transaction(
1400        self,
1401    ) -> Option<(fidl::endpoints::ServerEnd<EditTransactionMarker>, EngineControlHandle)> {
1402        if let EngineRequest::StartEditTransaction { transaction, control_handle } = self {
1403            Some((transaction, control_handle))
1404        } else {
1405            None
1406        }
1407    }
1408
1409    #[allow(irrefutable_let_patterns)]
1410    pub fn into_list(
1411        self,
1412    ) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
1413        if let EngineRequest::List { iterator, control_handle } = self {
1414            Some((iterator, control_handle))
1415        } else {
1416            None
1417        }
1418    }
1419
1420    #[allow(irrefutable_let_patterns)]
1421    pub fn into_list_static(
1422        self,
1423    ) -> Option<(fidl::endpoints::ServerEnd<RuleIteratorMarker>, EngineControlHandle)> {
1424        if let EngineRequest::ListStatic { iterator, control_handle } = self {
1425            Some((iterator, control_handle))
1426        } else {
1427            None
1428        }
1429    }
1430
1431    #[allow(irrefutable_let_patterns)]
1432    pub fn into_test_apply(self) -> Option<(String, EngineTestApplyResponder)> {
1433        if let EngineRequest::TestApply { url, responder } = self {
1434            Some((url, responder))
1435        } else {
1436            None
1437        }
1438    }
1439
1440    /// Name of the method defined in FIDL
1441    pub fn method_name(&self) -> &'static str {
1442        match *self {
1443            EngineRequest::StartEditTransaction { .. } => "start_edit_transaction",
1444            EngineRequest::List { .. } => "list",
1445            EngineRequest::ListStatic { .. } => "list_static",
1446            EngineRequest::TestApply { .. } => "test_apply",
1447        }
1448    }
1449}
1450
1451#[derive(Debug, Clone)]
1452pub struct EngineControlHandle {
1453    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1454}
1455
1456impl fidl::endpoints::ControlHandle for EngineControlHandle {
1457    fn shutdown(&self) {
1458        self.inner.shutdown()
1459    }
1460
1461    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1462        self.inner.shutdown_with_epitaph(status)
1463    }
1464
1465    fn is_closed(&self) -> bool {
1466        self.inner.channel().is_closed()
1467    }
1468    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1469        self.inner.channel().on_closed()
1470    }
1471
1472    #[cfg(target_os = "fuchsia")]
1473    fn signal_peer(
1474        &self,
1475        clear_mask: zx::Signals,
1476        set_mask: zx::Signals,
1477    ) -> Result<(), zx_status::Status> {
1478        use fidl::Peered;
1479        self.inner.channel().signal_peer(clear_mask, set_mask)
1480    }
1481}
1482
1483impl EngineControlHandle {}
1484
1485#[must_use = "FIDL methods require a response to be sent"]
1486#[derive(Debug)]
1487pub struct EngineTestApplyResponder {
1488    control_handle: std::mem::ManuallyDrop<EngineControlHandle>,
1489    tx_id: u32,
1490}
1491
1492/// Set the the channel to be shutdown (see [`EngineControlHandle::shutdown`])
1493/// if the responder is dropped without sending a response, so that the client
1494/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1495impl std::ops::Drop for EngineTestApplyResponder {
1496    fn drop(&mut self) {
1497        self.control_handle.shutdown();
1498        // Safety: drops once, never accessed again
1499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500    }
1501}
1502
1503impl fidl::endpoints::Responder for EngineTestApplyResponder {
1504    type ControlHandle = EngineControlHandle;
1505
1506    fn control_handle(&self) -> &EngineControlHandle {
1507        &self.control_handle
1508    }
1509
1510    fn drop_without_shutdown(mut self) {
1511        // Safety: drops once, never accessed again due to mem::forget
1512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1513        // Prevent Drop from running (which would shut down the channel)
1514        std::mem::forget(self);
1515    }
1516}
1517
1518impl EngineTestApplyResponder {
1519    /// Sends a response to the FIDL transaction.
1520    ///
1521    /// Sets the channel to shutdown if an error occurs.
1522    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1523        let _result = self.send_raw(result);
1524        if _result.is_err() {
1525            self.control_handle.shutdown();
1526        }
1527        self.drop_without_shutdown();
1528        _result
1529    }
1530
1531    /// Similar to "send" but does not shutdown the channel if an error occurs.
1532    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1533        let _result = self.send_raw(result);
1534        self.drop_without_shutdown();
1535        _result
1536    }
1537
1538    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1539        self.control_handle.inner.send::<fidl::encoding::ResultType<EngineTestApplyResponse, i32>>(
1540            result.map(|rewritten| (rewritten,)),
1541            self.tx_id,
1542            0xc8826a2b36fca39,
1543            fidl::encoding::DynamicFlags::empty(),
1544        )
1545    }
1546}
1547
1548#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1549pub struct RuleIteratorMarker;
1550
1551impl fidl::endpoints::ProtocolMarker for RuleIteratorMarker {
1552    type Proxy = RuleIteratorProxy;
1553    type RequestStream = RuleIteratorRequestStream;
1554    #[cfg(target_os = "fuchsia")]
1555    type SynchronousProxy = RuleIteratorSynchronousProxy;
1556
1557    const DEBUG_NAME: &'static str = "(anonymous) RuleIterator";
1558}
1559
1560pub trait RuleIteratorProxyInterface: Send + Sync {
1561    type NextResponseFut: std::future::Future<Output = Result<Vec<Rule>, fidl::Error>> + Send;
1562    fn r#next(&self) -> Self::NextResponseFut;
1563}
1564#[derive(Debug)]
1565#[cfg(target_os = "fuchsia")]
1566pub struct RuleIteratorSynchronousProxy {
1567    client: fidl::client::sync::Client,
1568}
1569
1570#[cfg(target_os = "fuchsia")]
1571impl fidl::endpoints::SynchronousProxy for RuleIteratorSynchronousProxy {
1572    type Proxy = RuleIteratorProxy;
1573    type Protocol = RuleIteratorMarker;
1574
1575    fn from_channel(inner: fidl::Channel) -> Self {
1576        Self::new(inner)
1577    }
1578
1579    fn into_channel(self) -> fidl::Channel {
1580        self.client.into_channel()
1581    }
1582
1583    fn as_channel(&self) -> &fidl::Channel {
1584        self.client.as_channel()
1585    }
1586}
1587
1588#[cfg(target_os = "fuchsia")]
1589impl RuleIteratorSynchronousProxy {
1590    pub fn new(channel: fidl::Channel) -> Self {
1591        let protocol_name = <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1592        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1593    }
1594
1595    pub fn into_channel(self) -> fidl::Channel {
1596        self.client.into_channel()
1597    }
1598
1599    /// Waits until an event arrives and returns it. It is safe for other
1600    /// threads to make concurrent requests while waiting for an event.
1601    pub fn wait_for_event(
1602        &self,
1603        deadline: zx::MonotonicInstant,
1604    ) -> Result<RuleIteratorEvent, fidl::Error> {
1605        RuleIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1606    }
1607
1608    /// Advances the iterator and returns the next batch of rules.
1609    ///
1610    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1611    ///    vector and then close the channel when there are no more rules.
1612    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Rule>, fidl::Error> {
1613        let _response =
1614            self.client.send_query::<fidl::encoding::EmptyPayload, RuleIteratorNextResponse>(
1615                (),
1616                0x1007ff472e2fcd45,
1617                fidl::encoding::DynamicFlags::empty(),
1618                ___deadline,
1619            )?;
1620        Ok(_response.rules)
1621    }
1622}
1623
1624#[cfg(target_os = "fuchsia")]
1625impl From<RuleIteratorSynchronousProxy> for zx::NullableHandle {
1626    fn from(value: RuleIteratorSynchronousProxy) -> Self {
1627        value.into_channel().into()
1628    }
1629}
1630
1631#[cfg(target_os = "fuchsia")]
1632impl From<fidl::Channel> for RuleIteratorSynchronousProxy {
1633    fn from(value: fidl::Channel) -> Self {
1634        Self::new(value)
1635    }
1636}
1637
1638#[cfg(target_os = "fuchsia")]
1639impl fidl::endpoints::FromClient for RuleIteratorSynchronousProxy {
1640    type Protocol = RuleIteratorMarker;
1641
1642    fn from_client(value: fidl::endpoints::ClientEnd<RuleIteratorMarker>) -> Self {
1643        Self::new(value.into_channel())
1644    }
1645}
1646
1647#[derive(Debug, Clone)]
1648pub struct RuleIteratorProxy {
1649    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1650}
1651
1652impl fidl::endpoints::Proxy for RuleIteratorProxy {
1653    type Protocol = RuleIteratorMarker;
1654
1655    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1656        Self::new(inner)
1657    }
1658
1659    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1660        self.client.into_channel().map_err(|client| Self { client })
1661    }
1662
1663    fn as_channel(&self) -> &::fidl::AsyncChannel {
1664        self.client.as_channel()
1665    }
1666}
1667
1668impl RuleIteratorProxy {
1669    /// Create a new Proxy for fuchsia.pkg.rewrite/RuleIterator.
1670    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1671        let protocol_name = <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1672        Self { client: fidl::client::Client::new(channel, protocol_name) }
1673    }
1674
1675    /// Get a Stream of events from the remote end of the protocol.
1676    ///
1677    /// # Panics
1678    ///
1679    /// Panics if the event stream was already taken.
1680    pub fn take_event_stream(&self) -> RuleIteratorEventStream {
1681        RuleIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1682    }
1683
1684    /// Advances the iterator and returns the next batch of rules.
1685    ///
1686    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1687    ///    vector and then close the channel when there are no more rules.
1688    pub fn r#next(
1689        &self,
1690    ) -> fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>
1691    {
1692        RuleIteratorProxyInterface::r#next(self)
1693    }
1694}
1695
1696impl RuleIteratorProxyInterface for RuleIteratorProxy {
1697    type NextResponseFut =
1698        fidl::client::QueryResponseFut<Vec<Rule>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1699    fn r#next(&self) -> Self::NextResponseFut {
1700        fn _decode(
1701            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1702        ) -> Result<Vec<Rule>, fidl::Error> {
1703            let _response = fidl::client::decode_transaction_body::<
1704                RuleIteratorNextResponse,
1705                fidl::encoding::DefaultFuchsiaResourceDialect,
1706                0x1007ff472e2fcd45,
1707            >(_buf?)?;
1708            Ok(_response.rules)
1709        }
1710        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Rule>>(
1711            (),
1712            0x1007ff472e2fcd45,
1713            fidl::encoding::DynamicFlags::empty(),
1714            _decode,
1715        )
1716    }
1717}
1718
1719pub struct RuleIteratorEventStream {
1720    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1721}
1722
1723impl std::marker::Unpin for RuleIteratorEventStream {}
1724
1725impl futures::stream::FusedStream for RuleIteratorEventStream {
1726    fn is_terminated(&self) -> bool {
1727        self.event_receiver.is_terminated()
1728    }
1729}
1730
1731impl futures::Stream for RuleIteratorEventStream {
1732    type Item = Result<RuleIteratorEvent, fidl::Error>;
1733
1734    fn poll_next(
1735        mut self: std::pin::Pin<&mut Self>,
1736        cx: &mut std::task::Context<'_>,
1737    ) -> std::task::Poll<Option<Self::Item>> {
1738        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1739            &mut self.event_receiver,
1740            cx
1741        )?) {
1742            Some(buf) => std::task::Poll::Ready(Some(RuleIteratorEvent::decode(buf))),
1743            None => std::task::Poll::Ready(None),
1744        }
1745    }
1746}
1747
1748#[derive(Debug)]
1749pub enum RuleIteratorEvent {}
1750
1751impl RuleIteratorEvent {
1752    /// Decodes a message buffer as a [`RuleIteratorEvent`].
1753    fn decode(
1754        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1755    ) -> Result<RuleIteratorEvent, fidl::Error> {
1756        let (bytes, _handles) = buf.split_mut();
1757        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1758        debug_assert_eq!(tx_header.tx_id, 0);
1759        match tx_header.ordinal {
1760            _ => Err(fidl::Error::UnknownOrdinal {
1761                ordinal: tx_header.ordinal,
1762                protocol_name: <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1763            }),
1764        }
1765    }
1766}
1767
1768/// A Stream of incoming requests for fuchsia.pkg.rewrite/RuleIterator.
1769pub struct RuleIteratorRequestStream {
1770    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1771    is_terminated: bool,
1772}
1773
1774impl std::marker::Unpin for RuleIteratorRequestStream {}
1775
1776impl futures::stream::FusedStream for RuleIteratorRequestStream {
1777    fn is_terminated(&self) -> bool {
1778        self.is_terminated
1779    }
1780}
1781
1782impl fidl::endpoints::RequestStream for RuleIteratorRequestStream {
1783    type Protocol = RuleIteratorMarker;
1784    type ControlHandle = RuleIteratorControlHandle;
1785
1786    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1787        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1788    }
1789
1790    fn control_handle(&self) -> Self::ControlHandle {
1791        RuleIteratorControlHandle { inner: self.inner.clone() }
1792    }
1793
1794    fn into_inner(
1795        self,
1796    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1797    {
1798        (self.inner, self.is_terminated)
1799    }
1800
1801    fn from_inner(
1802        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1803        is_terminated: bool,
1804    ) -> Self {
1805        Self { inner, is_terminated }
1806    }
1807}
1808
1809impl futures::Stream for RuleIteratorRequestStream {
1810    type Item = Result<RuleIteratorRequest, fidl::Error>;
1811
1812    fn poll_next(
1813        mut self: std::pin::Pin<&mut Self>,
1814        cx: &mut std::task::Context<'_>,
1815    ) -> std::task::Poll<Option<Self::Item>> {
1816        let this = &mut *self;
1817        if this.inner.check_shutdown(cx) {
1818            this.is_terminated = true;
1819            return std::task::Poll::Ready(None);
1820        }
1821        if this.is_terminated {
1822            panic!("polled RuleIteratorRequestStream after completion");
1823        }
1824        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1825            |bytes, handles| {
1826                match this.inner.channel().read_etc(cx, bytes, handles) {
1827                    std::task::Poll::Ready(Ok(())) => {}
1828                    std::task::Poll::Pending => return std::task::Poll::Pending,
1829                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1830                        this.is_terminated = true;
1831                        return std::task::Poll::Ready(None);
1832                    }
1833                    std::task::Poll::Ready(Err(e)) => {
1834                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1835                            e.into(),
1836                        ))));
1837                    }
1838                }
1839
1840                // A message has been received from the channel
1841                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1842
1843                std::task::Poll::Ready(Some(match header.ordinal {
1844                    0x1007ff472e2fcd45 => {
1845                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1846                        let mut req = fidl::new_empty!(
1847                            fidl::encoding::EmptyPayload,
1848                            fidl::encoding::DefaultFuchsiaResourceDialect
1849                        );
1850                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1851                        let control_handle =
1852                            RuleIteratorControlHandle { inner: this.inner.clone() };
1853                        Ok(RuleIteratorRequest::Next {
1854                            responder: RuleIteratorNextResponder {
1855                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1856                                tx_id: header.tx_id,
1857                            },
1858                        })
1859                    }
1860                    _ => Err(fidl::Error::UnknownOrdinal {
1861                        ordinal: header.ordinal,
1862                        protocol_name:
1863                            <RuleIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1864                    }),
1865                }))
1866            },
1867        )
1868    }
1869}
1870
1871/// The iterator over all the rewrite rules defined in a [`Engine`].
1872#[derive(Debug)]
1873pub enum RuleIteratorRequest {
1874    /// Advances the iterator and returns the next batch of rules.
1875    ///
1876    /// - response `rules` a vector of [`Rule`] rules. Will return an empty
1877    ///    vector and then close the channel when there are no more rules.
1878    Next { responder: RuleIteratorNextResponder },
1879}
1880
1881impl RuleIteratorRequest {
1882    #[allow(irrefutable_let_patterns)]
1883    pub fn into_next(self) -> Option<(RuleIteratorNextResponder)> {
1884        if let RuleIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1885    }
1886
1887    /// Name of the method defined in FIDL
1888    pub fn method_name(&self) -> &'static str {
1889        match *self {
1890            RuleIteratorRequest::Next { .. } => "next",
1891        }
1892    }
1893}
1894
1895#[derive(Debug, Clone)]
1896pub struct RuleIteratorControlHandle {
1897    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1898}
1899
1900impl fidl::endpoints::ControlHandle for RuleIteratorControlHandle {
1901    fn shutdown(&self) {
1902        self.inner.shutdown()
1903    }
1904
1905    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1906        self.inner.shutdown_with_epitaph(status)
1907    }
1908
1909    fn is_closed(&self) -> bool {
1910        self.inner.channel().is_closed()
1911    }
1912    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1913        self.inner.channel().on_closed()
1914    }
1915
1916    #[cfg(target_os = "fuchsia")]
1917    fn signal_peer(
1918        &self,
1919        clear_mask: zx::Signals,
1920        set_mask: zx::Signals,
1921    ) -> Result<(), zx_status::Status> {
1922        use fidl::Peered;
1923        self.inner.channel().signal_peer(clear_mask, set_mask)
1924    }
1925}
1926
1927impl RuleIteratorControlHandle {}
1928
1929#[must_use = "FIDL methods require a response to be sent"]
1930#[derive(Debug)]
1931pub struct RuleIteratorNextResponder {
1932    control_handle: std::mem::ManuallyDrop<RuleIteratorControlHandle>,
1933    tx_id: u32,
1934}
1935
1936/// Set the the channel to be shutdown (see [`RuleIteratorControlHandle::shutdown`])
1937/// if the responder is dropped without sending a response, so that the client
1938/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1939impl std::ops::Drop for RuleIteratorNextResponder {
1940    fn drop(&mut self) {
1941        self.control_handle.shutdown();
1942        // Safety: drops once, never accessed again
1943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1944    }
1945}
1946
1947impl fidl::endpoints::Responder for RuleIteratorNextResponder {
1948    type ControlHandle = RuleIteratorControlHandle;
1949
1950    fn control_handle(&self) -> &RuleIteratorControlHandle {
1951        &self.control_handle
1952    }
1953
1954    fn drop_without_shutdown(mut self) {
1955        // Safety: drops once, never accessed again due to mem::forget
1956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1957        // Prevent Drop from running (which would shut down the channel)
1958        std::mem::forget(self);
1959    }
1960}
1961
1962impl RuleIteratorNextResponder {
1963    /// Sends a response to the FIDL transaction.
1964    ///
1965    /// Sets the channel to shutdown if an error occurs.
1966    pub fn send(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1967        let _result = self.send_raw(rules);
1968        if _result.is_err() {
1969            self.control_handle.shutdown();
1970        }
1971        self.drop_without_shutdown();
1972        _result
1973    }
1974
1975    /// Similar to "send" but does not shutdown the channel if an error occurs.
1976    pub fn send_no_shutdown_on_err(self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1977        let _result = self.send_raw(rules);
1978        self.drop_without_shutdown();
1979        _result
1980    }
1981
1982    fn send_raw(&self, mut rules: &[Rule]) -> Result<(), fidl::Error> {
1983        self.control_handle.inner.send::<RuleIteratorNextResponse>(
1984            (rules,),
1985            self.tx_id,
1986            0x1007ff472e2fcd45,
1987            fidl::encoding::DynamicFlags::empty(),
1988        )
1989    }
1990}
1991
1992mod internal {
1993    use super::*;
1994
1995    impl fidl::encoding::ResourceTypeMarker for EditTransactionListDynamicRequest {
1996        type Borrowed<'a> = &'a mut Self;
1997        fn take_or_borrow<'a>(
1998            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1999        ) -> Self::Borrowed<'a> {
2000            value
2001        }
2002    }
2003
2004    unsafe impl fidl::encoding::TypeMarker for EditTransactionListDynamicRequest {
2005        type Owned = Self;
2006
2007        #[inline(always)]
2008        fn inline_align(_context: fidl::encoding::Context) -> usize {
2009            4
2010        }
2011
2012        #[inline(always)]
2013        fn inline_size(_context: fidl::encoding::Context) -> usize {
2014            4
2015        }
2016    }
2017
2018    unsafe impl
2019        fidl::encoding::Encode<
2020            EditTransactionListDynamicRequest,
2021            fidl::encoding::DefaultFuchsiaResourceDialect,
2022        > for &mut EditTransactionListDynamicRequest
2023    {
2024        #[inline]
2025        unsafe fn encode(
2026            self,
2027            encoder: &mut fidl::encoding::Encoder<
2028                '_,
2029                fidl::encoding::DefaultFuchsiaResourceDialect,
2030            >,
2031            offset: usize,
2032            _depth: fidl::encoding::Depth,
2033        ) -> fidl::Result<()> {
2034            encoder.debug_check_bounds::<EditTransactionListDynamicRequest>(offset);
2035            // Delegate to tuple encoding.
2036            fidl::encoding::Encode::<EditTransactionListDynamicRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2037                (
2038                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2039                ),
2040                encoder, offset, _depth
2041            )
2042        }
2043    }
2044    unsafe impl<
2045        T0: fidl::encoding::Encode<
2046                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2047                fidl::encoding::DefaultFuchsiaResourceDialect,
2048            >,
2049    >
2050        fidl::encoding::Encode<
2051            EditTransactionListDynamicRequest,
2052            fidl::encoding::DefaultFuchsiaResourceDialect,
2053        > for (T0,)
2054    {
2055        #[inline]
2056        unsafe fn encode(
2057            self,
2058            encoder: &mut fidl::encoding::Encoder<
2059                '_,
2060                fidl::encoding::DefaultFuchsiaResourceDialect,
2061            >,
2062            offset: usize,
2063            depth: fidl::encoding::Depth,
2064        ) -> fidl::Result<()> {
2065            encoder.debug_check_bounds::<EditTransactionListDynamicRequest>(offset);
2066            // Zero out padding regions. There's no need to apply masks
2067            // because the unmasked parts will be overwritten by fields.
2068            // Write the fields.
2069            self.0.encode(encoder, offset + 0, depth)?;
2070            Ok(())
2071        }
2072    }
2073
2074    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2075        for EditTransactionListDynamicRequest
2076    {
2077        #[inline(always)]
2078        fn new_empty() -> Self {
2079            Self {
2080                iterator: fidl::new_empty!(
2081                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2082                    fidl::encoding::DefaultFuchsiaResourceDialect
2083                ),
2084            }
2085        }
2086
2087        #[inline]
2088        unsafe fn decode(
2089            &mut self,
2090            decoder: &mut fidl::encoding::Decoder<
2091                '_,
2092                fidl::encoding::DefaultFuchsiaResourceDialect,
2093            >,
2094            offset: usize,
2095            _depth: fidl::encoding::Depth,
2096        ) -> fidl::Result<()> {
2097            decoder.debug_check_bounds::<Self>(offset);
2098            // Verify that padding bytes are zero.
2099            fidl::decode!(
2100                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2101                fidl::encoding::DefaultFuchsiaResourceDialect,
2102                &mut self.iterator,
2103                decoder,
2104                offset + 0,
2105                _depth
2106            )?;
2107            Ok(())
2108        }
2109    }
2110
2111    impl fidl::encoding::ResourceTypeMarker for EngineListRequest {
2112        type Borrowed<'a> = &'a mut Self;
2113        fn take_or_borrow<'a>(
2114            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2115        ) -> Self::Borrowed<'a> {
2116            value
2117        }
2118    }
2119
2120    unsafe impl fidl::encoding::TypeMarker for EngineListRequest {
2121        type Owned = Self;
2122
2123        #[inline(always)]
2124        fn inline_align(_context: fidl::encoding::Context) -> usize {
2125            4
2126        }
2127
2128        #[inline(always)]
2129        fn inline_size(_context: fidl::encoding::Context) -> usize {
2130            4
2131        }
2132    }
2133
2134    unsafe impl
2135        fidl::encoding::Encode<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2136        for &mut EngineListRequest
2137    {
2138        #[inline]
2139        unsafe fn encode(
2140            self,
2141            encoder: &mut fidl::encoding::Encoder<
2142                '_,
2143                fidl::encoding::DefaultFuchsiaResourceDialect,
2144            >,
2145            offset: usize,
2146            _depth: fidl::encoding::Depth,
2147        ) -> fidl::Result<()> {
2148            encoder.debug_check_bounds::<EngineListRequest>(offset);
2149            // Delegate to tuple encoding.
2150            fidl::encoding::Encode::<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2151                (
2152                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2153                ),
2154                encoder, offset, _depth
2155            )
2156        }
2157    }
2158    unsafe impl<
2159        T0: fidl::encoding::Encode<
2160                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2161                fidl::encoding::DefaultFuchsiaResourceDialect,
2162            >,
2163    > fidl::encoding::Encode<EngineListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2164        for (T0,)
2165    {
2166        #[inline]
2167        unsafe fn encode(
2168            self,
2169            encoder: &mut fidl::encoding::Encoder<
2170                '_,
2171                fidl::encoding::DefaultFuchsiaResourceDialect,
2172            >,
2173            offset: usize,
2174            depth: fidl::encoding::Depth,
2175        ) -> fidl::Result<()> {
2176            encoder.debug_check_bounds::<EngineListRequest>(offset);
2177            // Zero out padding regions. There's no need to apply masks
2178            // because the unmasked parts will be overwritten by fields.
2179            // Write the fields.
2180            self.0.encode(encoder, offset + 0, depth)?;
2181            Ok(())
2182        }
2183    }
2184
2185    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2186        for EngineListRequest
2187    {
2188        #[inline(always)]
2189        fn new_empty() -> Self {
2190            Self {
2191                iterator: fidl::new_empty!(
2192                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2193                    fidl::encoding::DefaultFuchsiaResourceDialect
2194                ),
2195            }
2196        }
2197
2198        #[inline]
2199        unsafe fn decode(
2200            &mut self,
2201            decoder: &mut fidl::encoding::Decoder<
2202                '_,
2203                fidl::encoding::DefaultFuchsiaResourceDialect,
2204            >,
2205            offset: usize,
2206            _depth: fidl::encoding::Depth,
2207        ) -> fidl::Result<()> {
2208            decoder.debug_check_bounds::<Self>(offset);
2209            // Verify that padding bytes are zero.
2210            fidl::decode!(
2211                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2212                fidl::encoding::DefaultFuchsiaResourceDialect,
2213                &mut self.iterator,
2214                decoder,
2215                offset + 0,
2216                _depth
2217            )?;
2218            Ok(())
2219        }
2220    }
2221
2222    impl fidl::encoding::ResourceTypeMarker for EngineListStaticRequest {
2223        type Borrowed<'a> = &'a mut Self;
2224        fn take_or_borrow<'a>(
2225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2226        ) -> Self::Borrowed<'a> {
2227            value
2228        }
2229    }
2230
2231    unsafe impl fidl::encoding::TypeMarker for EngineListStaticRequest {
2232        type Owned = Self;
2233
2234        #[inline(always)]
2235        fn inline_align(_context: fidl::encoding::Context) -> usize {
2236            4
2237        }
2238
2239        #[inline(always)]
2240        fn inline_size(_context: fidl::encoding::Context) -> usize {
2241            4
2242        }
2243    }
2244
2245    unsafe impl
2246        fidl::encoding::Encode<
2247            EngineListStaticRequest,
2248            fidl::encoding::DefaultFuchsiaResourceDialect,
2249        > for &mut EngineListStaticRequest
2250    {
2251        #[inline]
2252        unsafe fn encode(
2253            self,
2254            encoder: &mut fidl::encoding::Encoder<
2255                '_,
2256                fidl::encoding::DefaultFuchsiaResourceDialect,
2257            >,
2258            offset: usize,
2259            _depth: fidl::encoding::Depth,
2260        ) -> fidl::Result<()> {
2261            encoder.debug_check_bounds::<EngineListStaticRequest>(offset);
2262            // Delegate to tuple encoding.
2263            fidl::encoding::Encode::<EngineListStaticRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2264                (
2265                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2266                ),
2267                encoder, offset, _depth
2268            )
2269        }
2270    }
2271    unsafe impl<
2272        T0: fidl::encoding::Encode<
2273                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2274                fidl::encoding::DefaultFuchsiaResourceDialect,
2275            >,
2276    >
2277        fidl::encoding::Encode<
2278            EngineListStaticRequest,
2279            fidl::encoding::DefaultFuchsiaResourceDialect,
2280        > for (T0,)
2281    {
2282        #[inline]
2283        unsafe fn encode(
2284            self,
2285            encoder: &mut fidl::encoding::Encoder<
2286                '_,
2287                fidl::encoding::DefaultFuchsiaResourceDialect,
2288            >,
2289            offset: usize,
2290            depth: fidl::encoding::Depth,
2291        ) -> fidl::Result<()> {
2292            encoder.debug_check_bounds::<EngineListStaticRequest>(offset);
2293            // Zero out padding regions. There's no need to apply masks
2294            // because the unmasked parts will be overwritten by fields.
2295            // Write the fields.
2296            self.0.encode(encoder, offset + 0, depth)?;
2297            Ok(())
2298        }
2299    }
2300
2301    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2302        for EngineListStaticRequest
2303    {
2304        #[inline(always)]
2305        fn new_empty() -> Self {
2306            Self {
2307                iterator: fidl::new_empty!(
2308                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2309                    fidl::encoding::DefaultFuchsiaResourceDialect
2310                ),
2311            }
2312        }
2313
2314        #[inline]
2315        unsafe fn decode(
2316            &mut self,
2317            decoder: &mut fidl::encoding::Decoder<
2318                '_,
2319                fidl::encoding::DefaultFuchsiaResourceDialect,
2320            >,
2321            offset: usize,
2322            _depth: fidl::encoding::Depth,
2323        ) -> fidl::Result<()> {
2324            decoder.debug_check_bounds::<Self>(offset);
2325            // Verify that padding bytes are zero.
2326            fidl::decode!(
2327                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleIteratorMarker>>,
2328                fidl::encoding::DefaultFuchsiaResourceDialect,
2329                &mut self.iterator,
2330                decoder,
2331                offset + 0,
2332                _depth
2333            )?;
2334            Ok(())
2335        }
2336    }
2337
2338    impl fidl::encoding::ResourceTypeMarker for EngineStartEditTransactionRequest {
2339        type Borrowed<'a> = &'a mut Self;
2340        fn take_or_borrow<'a>(
2341            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2342        ) -> Self::Borrowed<'a> {
2343            value
2344        }
2345    }
2346
2347    unsafe impl fidl::encoding::TypeMarker for EngineStartEditTransactionRequest {
2348        type Owned = Self;
2349
2350        #[inline(always)]
2351        fn inline_align(_context: fidl::encoding::Context) -> usize {
2352            4
2353        }
2354
2355        #[inline(always)]
2356        fn inline_size(_context: fidl::encoding::Context) -> usize {
2357            4
2358        }
2359    }
2360
2361    unsafe impl
2362        fidl::encoding::Encode<
2363            EngineStartEditTransactionRequest,
2364            fidl::encoding::DefaultFuchsiaResourceDialect,
2365        > for &mut EngineStartEditTransactionRequest
2366    {
2367        #[inline]
2368        unsafe fn encode(
2369            self,
2370            encoder: &mut fidl::encoding::Encoder<
2371                '_,
2372                fidl::encoding::DefaultFuchsiaResourceDialect,
2373            >,
2374            offset: usize,
2375            _depth: fidl::encoding::Depth,
2376        ) -> fidl::Result<()> {
2377            encoder.debug_check_bounds::<EngineStartEditTransactionRequest>(offset);
2378            // Delegate to tuple encoding.
2379            fidl::encoding::Encode::<EngineStartEditTransactionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2380                (
2381                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.transaction),
2382                ),
2383                encoder, offset, _depth
2384            )
2385        }
2386    }
2387    unsafe impl<
2388        T0: fidl::encoding::Encode<
2389                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2390                fidl::encoding::DefaultFuchsiaResourceDialect,
2391            >,
2392    >
2393        fidl::encoding::Encode<
2394            EngineStartEditTransactionRequest,
2395            fidl::encoding::DefaultFuchsiaResourceDialect,
2396        > for (T0,)
2397    {
2398        #[inline]
2399        unsafe fn encode(
2400            self,
2401            encoder: &mut fidl::encoding::Encoder<
2402                '_,
2403                fidl::encoding::DefaultFuchsiaResourceDialect,
2404            >,
2405            offset: usize,
2406            depth: fidl::encoding::Depth,
2407        ) -> fidl::Result<()> {
2408            encoder.debug_check_bounds::<EngineStartEditTransactionRequest>(offset);
2409            // Zero out padding regions. There's no need to apply masks
2410            // because the unmasked parts will be overwritten by fields.
2411            // Write the fields.
2412            self.0.encode(encoder, offset + 0, depth)?;
2413            Ok(())
2414        }
2415    }
2416
2417    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2418        for EngineStartEditTransactionRequest
2419    {
2420        #[inline(always)]
2421        fn new_empty() -> Self {
2422            Self {
2423                transaction: fidl::new_empty!(
2424                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2425                    fidl::encoding::DefaultFuchsiaResourceDialect
2426                ),
2427            }
2428        }
2429
2430        #[inline]
2431        unsafe fn decode(
2432            &mut self,
2433            decoder: &mut fidl::encoding::Decoder<
2434                '_,
2435                fidl::encoding::DefaultFuchsiaResourceDialect,
2436            >,
2437            offset: usize,
2438            _depth: fidl::encoding::Depth,
2439        ) -> fidl::Result<()> {
2440            decoder.debug_check_bounds::<Self>(offset);
2441            // Verify that padding bytes are zero.
2442            fidl::decode!(
2443                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EditTransactionMarker>>,
2444                fidl::encoding::DefaultFuchsiaResourceDialect,
2445                &mut self.transaction,
2446                decoder,
2447                offset + 0,
2448                _depth
2449            )?;
2450            Ok(())
2451        }
2452    }
2453}