Skip to main content

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