fidl_fuchsia_stash/
fidl_fuchsia_stash.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_stash__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct GetIteratorGetNextResponse {
16    pub kvs: Vec<KeyValue>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for GetIteratorGetNextResponse
21{
22}
23
24/// KeyValue is used when a series of keys are being read, or the default state
25/// for the store is being set.
26#[derive(Debug, PartialEq)]
27pub struct KeyValue {
28    pub key: String,
29    pub val: Value,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for KeyValue {}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct StoreAccessorGetPrefixRequest {
36    pub prefix: String,
37    pub it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for StoreAccessorGetPrefixRequest
42{
43}
44
45#[derive(Debug, PartialEq)]
46pub struct StoreAccessorGetValueResponse {
47    pub val: Option<Box<Value>>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for StoreAccessorGetValueResponse
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct StoreAccessorListPrefixRequest {
57    pub prefix: String,
58    pub it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62    for StoreAccessorListPrefixRequest
63{
64}
65
66#[derive(Debug, PartialEq)]
67pub struct StoreAccessorSetValueRequest {
68    pub key: String,
69    pub val: Value,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
73    for StoreAccessorSetValueRequest
74{
75}
76
77#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct StoreCreateAccessorRequest {
79    pub read_only: bool,
80    pub accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
84    for StoreCreateAccessorRequest
85{
86}
87
88/// Value holds a value for a given key.
89#[derive(Debug, PartialEq)]
90pub enum Value {
91    Intval(i64),
92    Floatval(f64),
93    Boolval(bool),
94    Stringval(String),
95    Bytesval(fidl_fuchsia_mem::Buffer),
96}
97
98impl Value {
99    #[inline]
100    pub fn ordinal(&self) -> u64 {
101        match *self {
102            Self::Intval(_) => 1,
103            Self::Floatval(_) => 2,
104            Self::Boolval(_) => 3,
105            Self::Stringval(_) => 4,
106            Self::Bytesval(_) => 5,
107        }
108    }
109}
110
111impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Value {}
112
113#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
114pub struct GetIteratorMarker;
115
116impl fidl::endpoints::ProtocolMarker for GetIteratorMarker {
117    type Proxy = GetIteratorProxy;
118    type RequestStream = GetIteratorRequestStream;
119    #[cfg(target_os = "fuchsia")]
120    type SynchronousProxy = GetIteratorSynchronousProxy;
121
122    const DEBUG_NAME: &'static str = "(anonymous) GetIterator";
123}
124
125pub trait GetIteratorProxyInterface: Send + Sync {
126    type GetNextResponseFut: std::future::Future<Output = Result<Vec<KeyValue>, fidl::Error>> + Send;
127    fn r#get_next(&self) -> Self::GetNextResponseFut;
128}
129#[derive(Debug)]
130#[cfg(target_os = "fuchsia")]
131pub struct GetIteratorSynchronousProxy {
132    client: fidl::client::sync::Client,
133}
134
135#[cfg(target_os = "fuchsia")]
136impl fidl::endpoints::SynchronousProxy for GetIteratorSynchronousProxy {
137    type Proxy = GetIteratorProxy;
138    type Protocol = GetIteratorMarker;
139
140    fn from_channel(inner: fidl::Channel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> fidl::Channel {
145        self.client.into_channel()
146    }
147
148    fn as_channel(&self) -> &fidl::Channel {
149        self.client.as_channel()
150    }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl GetIteratorSynchronousProxy {
155    pub fn new(channel: fidl::Channel) -> Self {
156        let protocol_name = <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
158    }
159
160    pub fn into_channel(self) -> fidl::Channel {
161        self.client.into_channel()
162    }
163
164    /// Waits until an event arrives and returns it. It is safe for other
165    /// threads to make concurrent requests while waiting for an event.
166    pub fn wait_for_event(
167        &self,
168        deadline: zx::MonotonicInstant,
169    ) -> Result<GetIteratorEvent, fidl::Error> {
170        GetIteratorEvent::decode(self.client.wait_for_event(deadline)?)
171    }
172
173    pub fn r#get_next(
174        &self,
175        ___deadline: zx::MonotonicInstant,
176    ) -> Result<Vec<KeyValue>, fidl::Error> {
177        let _response =
178            self.client.send_query::<fidl::encoding::EmptyPayload, GetIteratorGetNextResponse>(
179                (),
180                0xe0a5a8ea5dbfbf5,
181                fidl::encoding::DynamicFlags::empty(),
182                ___deadline,
183            )?;
184        Ok(_response.kvs)
185    }
186}
187
188#[cfg(target_os = "fuchsia")]
189impl From<GetIteratorSynchronousProxy> for zx::Handle {
190    fn from(value: GetIteratorSynchronousProxy) -> Self {
191        value.into_channel().into()
192    }
193}
194
195#[cfg(target_os = "fuchsia")]
196impl From<fidl::Channel> for GetIteratorSynchronousProxy {
197    fn from(value: fidl::Channel) -> Self {
198        Self::new(value)
199    }
200}
201
202#[cfg(target_os = "fuchsia")]
203impl fidl::endpoints::FromClient for GetIteratorSynchronousProxy {
204    type Protocol = GetIteratorMarker;
205
206    fn from_client(value: fidl::endpoints::ClientEnd<GetIteratorMarker>) -> Self {
207        Self::new(value.into_channel())
208    }
209}
210
211#[derive(Debug, Clone)]
212pub struct GetIteratorProxy {
213    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
214}
215
216impl fidl::endpoints::Proxy for GetIteratorProxy {
217    type Protocol = GetIteratorMarker;
218
219    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
220        Self::new(inner)
221    }
222
223    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
224        self.client.into_channel().map_err(|client| Self { client })
225    }
226
227    fn as_channel(&self) -> &::fidl::AsyncChannel {
228        self.client.as_channel()
229    }
230}
231
232impl GetIteratorProxy {
233    /// Create a new Proxy for fuchsia.stash/GetIterator.
234    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
235        let protocol_name = <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
236        Self { client: fidl::client::Client::new(channel, protocol_name) }
237    }
238
239    /// Get a Stream of events from the remote end of the protocol.
240    ///
241    /// # Panics
242    ///
243    /// Panics if the event stream was already taken.
244    pub fn take_event_stream(&self) -> GetIteratorEventStream {
245        GetIteratorEventStream { event_receiver: self.client.take_event_receiver() }
246    }
247
248    pub fn r#get_next(
249        &self,
250    ) -> fidl::client::QueryResponseFut<Vec<KeyValue>, fidl::encoding::DefaultFuchsiaResourceDialect>
251    {
252        GetIteratorProxyInterface::r#get_next(self)
253    }
254}
255
256impl GetIteratorProxyInterface for GetIteratorProxy {
257    type GetNextResponseFut = fidl::client::QueryResponseFut<
258        Vec<KeyValue>,
259        fidl::encoding::DefaultFuchsiaResourceDialect,
260    >;
261    fn r#get_next(&self) -> Self::GetNextResponseFut {
262        fn _decode(
263            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
264        ) -> Result<Vec<KeyValue>, fidl::Error> {
265            let _response = fidl::client::decode_transaction_body::<
266                GetIteratorGetNextResponse,
267                fidl::encoding::DefaultFuchsiaResourceDialect,
268                0xe0a5a8ea5dbfbf5,
269            >(_buf?)?;
270            Ok(_response.kvs)
271        }
272        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<KeyValue>>(
273            (),
274            0xe0a5a8ea5dbfbf5,
275            fidl::encoding::DynamicFlags::empty(),
276            _decode,
277        )
278    }
279}
280
281pub struct GetIteratorEventStream {
282    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
283}
284
285impl std::marker::Unpin for GetIteratorEventStream {}
286
287impl futures::stream::FusedStream for GetIteratorEventStream {
288    fn is_terminated(&self) -> bool {
289        self.event_receiver.is_terminated()
290    }
291}
292
293impl futures::Stream for GetIteratorEventStream {
294    type Item = Result<GetIteratorEvent, fidl::Error>;
295
296    fn poll_next(
297        mut self: std::pin::Pin<&mut Self>,
298        cx: &mut std::task::Context<'_>,
299    ) -> std::task::Poll<Option<Self::Item>> {
300        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
301            &mut self.event_receiver,
302            cx
303        )?) {
304            Some(buf) => std::task::Poll::Ready(Some(GetIteratorEvent::decode(buf))),
305            None => std::task::Poll::Ready(None),
306        }
307    }
308}
309
310#[derive(Debug)]
311pub enum GetIteratorEvent {}
312
313impl GetIteratorEvent {
314    /// Decodes a message buffer as a [`GetIteratorEvent`].
315    fn decode(
316        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
317    ) -> Result<GetIteratorEvent, fidl::Error> {
318        let (bytes, _handles) = buf.split_mut();
319        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
320        debug_assert_eq!(tx_header.tx_id, 0);
321        match tx_header.ordinal {
322            _ => Err(fidl::Error::UnknownOrdinal {
323                ordinal: tx_header.ordinal,
324                protocol_name: <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
325            }),
326        }
327    }
328}
329
330/// A Stream of incoming requests for fuchsia.stash/GetIterator.
331pub struct GetIteratorRequestStream {
332    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
333    is_terminated: bool,
334}
335
336impl std::marker::Unpin for GetIteratorRequestStream {}
337
338impl futures::stream::FusedStream for GetIteratorRequestStream {
339    fn is_terminated(&self) -> bool {
340        self.is_terminated
341    }
342}
343
344impl fidl::endpoints::RequestStream for GetIteratorRequestStream {
345    type Protocol = GetIteratorMarker;
346    type ControlHandle = GetIteratorControlHandle;
347
348    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
349        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
350    }
351
352    fn control_handle(&self) -> Self::ControlHandle {
353        GetIteratorControlHandle { inner: self.inner.clone() }
354    }
355
356    fn into_inner(
357        self,
358    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
359    {
360        (self.inner, self.is_terminated)
361    }
362
363    fn from_inner(
364        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
365        is_terminated: bool,
366    ) -> Self {
367        Self { inner, is_terminated }
368    }
369}
370
371impl futures::Stream for GetIteratorRequestStream {
372    type Item = Result<GetIteratorRequest, fidl::Error>;
373
374    fn poll_next(
375        mut self: std::pin::Pin<&mut Self>,
376        cx: &mut std::task::Context<'_>,
377    ) -> std::task::Poll<Option<Self::Item>> {
378        let this = &mut *self;
379        if this.inner.check_shutdown(cx) {
380            this.is_terminated = true;
381            return std::task::Poll::Ready(None);
382        }
383        if this.is_terminated {
384            panic!("polled GetIteratorRequestStream after completion");
385        }
386        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
387            |bytes, handles| {
388                match this.inner.channel().read_etc(cx, bytes, handles) {
389                    std::task::Poll::Ready(Ok(())) => {}
390                    std::task::Poll::Pending => return std::task::Poll::Pending,
391                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
392                        this.is_terminated = true;
393                        return std::task::Poll::Ready(None);
394                    }
395                    std::task::Poll::Ready(Err(e)) => {
396                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
397                            e.into(),
398                        ))));
399                    }
400                }
401
402                // A message has been received from the channel
403                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
404
405                std::task::Poll::Ready(Some(match header.ordinal {
406                    0xe0a5a8ea5dbfbf5 => {
407                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
408                        let mut req = fidl::new_empty!(
409                            fidl::encoding::EmptyPayload,
410                            fidl::encoding::DefaultFuchsiaResourceDialect
411                        );
412                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
413                        let control_handle = GetIteratorControlHandle { inner: this.inner.clone() };
414                        Ok(GetIteratorRequest::GetNext {
415                            responder: GetIteratorGetNextResponder {
416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
417                                tx_id: header.tx_id,
418                            },
419                        })
420                    }
421                    _ => Err(fidl::Error::UnknownOrdinal {
422                        ordinal: header.ordinal,
423                        protocol_name:
424                            <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
425                    }),
426                }))
427            },
428        )
429    }
430}
431
432/// The iterator returned when a series of keys are being read. Returns an
433/// empty vector when there are no more remaining KeyValues.
434#[derive(Debug)]
435pub enum GetIteratorRequest {
436    GetNext { responder: GetIteratorGetNextResponder },
437}
438
439impl GetIteratorRequest {
440    #[allow(irrefutable_let_patterns)]
441    pub fn into_get_next(self) -> Option<(GetIteratorGetNextResponder)> {
442        if let GetIteratorRequest::GetNext { responder } = self { Some((responder)) } else { None }
443    }
444
445    /// Name of the method defined in FIDL
446    pub fn method_name(&self) -> &'static str {
447        match *self {
448            GetIteratorRequest::GetNext { .. } => "get_next",
449        }
450    }
451}
452
453#[derive(Debug, Clone)]
454pub struct GetIteratorControlHandle {
455    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
456}
457
458impl fidl::endpoints::ControlHandle for GetIteratorControlHandle {
459    fn shutdown(&self) {
460        self.inner.shutdown()
461    }
462    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
463        self.inner.shutdown_with_epitaph(status)
464    }
465
466    fn is_closed(&self) -> bool {
467        self.inner.channel().is_closed()
468    }
469    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
470        self.inner.channel().on_closed()
471    }
472
473    #[cfg(target_os = "fuchsia")]
474    fn signal_peer(
475        &self,
476        clear_mask: zx::Signals,
477        set_mask: zx::Signals,
478    ) -> Result<(), zx_status::Status> {
479        use fidl::Peered;
480        self.inner.channel().signal_peer(clear_mask, set_mask)
481    }
482}
483
484impl GetIteratorControlHandle {}
485
486#[must_use = "FIDL methods require a response to be sent"]
487#[derive(Debug)]
488pub struct GetIteratorGetNextResponder {
489    control_handle: std::mem::ManuallyDrop<GetIteratorControlHandle>,
490    tx_id: u32,
491}
492
493/// Set the the channel to be shutdown (see [`GetIteratorControlHandle::shutdown`])
494/// if the responder is dropped without sending a response, so that the client
495/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
496impl std::ops::Drop for GetIteratorGetNextResponder {
497    fn drop(&mut self) {
498        self.control_handle.shutdown();
499        // Safety: drops once, never accessed again
500        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
501    }
502}
503
504impl fidl::endpoints::Responder for GetIteratorGetNextResponder {
505    type ControlHandle = GetIteratorControlHandle;
506
507    fn control_handle(&self) -> &GetIteratorControlHandle {
508        &self.control_handle
509    }
510
511    fn drop_without_shutdown(mut self) {
512        // Safety: drops once, never accessed again due to mem::forget
513        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
514        // Prevent Drop from running (which would shut down the channel)
515        std::mem::forget(self);
516    }
517}
518
519impl GetIteratorGetNextResponder {
520    /// Sends a response to the FIDL transaction.
521    ///
522    /// Sets the channel to shutdown if an error occurs.
523    pub fn send(self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
524        let _result = self.send_raw(kvs);
525        if _result.is_err() {
526            self.control_handle.shutdown();
527        }
528        self.drop_without_shutdown();
529        _result
530    }
531
532    /// Similar to "send" but does not shutdown the channel if an error occurs.
533    pub fn send_no_shutdown_on_err(self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
534        let _result = self.send_raw(kvs);
535        self.drop_without_shutdown();
536        _result
537    }
538
539    fn send_raw(&self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
540        self.control_handle.inner.send::<GetIteratorGetNextResponse>(
541            (kvs.as_mut(),),
542            self.tx_id,
543            0xe0a5a8ea5dbfbf5,
544            fidl::encoding::DynamicFlags::empty(),
545        )
546    }
547}
548
549#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
550pub struct ListIteratorMarker;
551
552impl fidl::endpoints::ProtocolMarker for ListIteratorMarker {
553    type Proxy = ListIteratorProxy;
554    type RequestStream = ListIteratorRequestStream;
555    #[cfg(target_os = "fuchsia")]
556    type SynchronousProxy = ListIteratorSynchronousProxy;
557
558    const DEBUG_NAME: &'static str = "(anonymous) ListIterator";
559}
560
561pub trait ListIteratorProxyInterface: Send + Sync {
562    type GetNextResponseFut: std::future::Future<Output = Result<Vec<ListItem>, fidl::Error>> + Send;
563    fn r#get_next(&self) -> Self::GetNextResponseFut;
564}
565#[derive(Debug)]
566#[cfg(target_os = "fuchsia")]
567pub struct ListIteratorSynchronousProxy {
568    client: fidl::client::sync::Client,
569}
570
571#[cfg(target_os = "fuchsia")]
572impl fidl::endpoints::SynchronousProxy for ListIteratorSynchronousProxy {
573    type Proxy = ListIteratorProxy;
574    type Protocol = ListIteratorMarker;
575
576    fn from_channel(inner: fidl::Channel) -> Self {
577        Self::new(inner)
578    }
579
580    fn into_channel(self) -> fidl::Channel {
581        self.client.into_channel()
582    }
583
584    fn as_channel(&self) -> &fidl::Channel {
585        self.client.as_channel()
586    }
587}
588
589#[cfg(target_os = "fuchsia")]
590impl ListIteratorSynchronousProxy {
591    pub fn new(channel: fidl::Channel) -> Self {
592        let protocol_name = <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
593        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
594    }
595
596    pub fn into_channel(self) -> fidl::Channel {
597        self.client.into_channel()
598    }
599
600    /// Waits until an event arrives and returns it. It is safe for other
601    /// threads to make concurrent requests while waiting for an event.
602    pub fn wait_for_event(
603        &self,
604        deadline: zx::MonotonicInstant,
605    ) -> Result<ListIteratorEvent, fidl::Error> {
606        ListIteratorEvent::decode(self.client.wait_for_event(deadline)?)
607    }
608
609    pub fn r#get_next(
610        &self,
611        ___deadline: zx::MonotonicInstant,
612    ) -> Result<Vec<ListItem>, fidl::Error> {
613        let _response =
614            self.client.send_query::<fidl::encoding::EmptyPayload, ListIteratorGetNextResponse>(
615                (),
616                0x6d8646b717dd56a2,
617                fidl::encoding::DynamicFlags::empty(),
618                ___deadline,
619            )?;
620        Ok(_response.keys)
621    }
622}
623
624#[cfg(target_os = "fuchsia")]
625impl From<ListIteratorSynchronousProxy> for zx::Handle {
626    fn from(value: ListIteratorSynchronousProxy) -> Self {
627        value.into_channel().into()
628    }
629}
630
631#[cfg(target_os = "fuchsia")]
632impl From<fidl::Channel> for ListIteratorSynchronousProxy {
633    fn from(value: fidl::Channel) -> Self {
634        Self::new(value)
635    }
636}
637
638#[cfg(target_os = "fuchsia")]
639impl fidl::endpoints::FromClient for ListIteratorSynchronousProxy {
640    type Protocol = ListIteratorMarker;
641
642    fn from_client(value: fidl::endpoints::ClientEnd<ListIteratorMarker>) -> Self {
643        Self::new(value.into_channel())
644    }
645}
646
647#[derive(Debug, Clone)]
648pub struct ListIteratorProxy {
649    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
650}
651
652impl fidl::endpoints::Proxy for ListIteratorProxy {
653    type Protocol = ListIteratorMarker;
654
655    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
656        Self::new(inner)
657    }
658
659    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
660        self.client.into_channel().map_err(|client| Self { client })
661    }
662
663    fn as_channel(&self) -> &::fidl::AsyncChannel {
664        self.client.as_channel()
665    }
666}
667
668impl ListIteratorProxy {
669    /// Create a new Proxy for fuchsia.stash/ListIterator.
670    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
671        let protocol_name = <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
672        Self { client: fidl::client::Client::new(channel, protocol_name) }
673    }
674
675    /// Get a Stream of events from the remote end of the protocol.
676    ///
677    /// # Panics
678    ///
679    /// Panics if the event stream was already taken.
680    pub fn take_event_stream(&self) -> ListIteratorEventStream {
681        ListIteratorEventStream { event_receiver: self.client.take_event_receiver() }
682    }
683
684    pub fn r#get_next(
685        &self,
686    ) -> fidl::client::QueryResponseFut<Vec<ListItem>, fidl::encoding::DefaultFuchsiaResourceDialect>
687    {
688        ListIteratorProxyInterface::r#get_next(self)
689    }
690}
691
692impl ListIteratorProxyInterface for ListIteratorProxy {
693    type GetNextResponseFut = fidl::client::QueryResponseFut<
694        Vec<ListItem>,
695        fidl::encoding::DefaultFuchsiaResourceDialect,
696    >;
697    fn r#get_next(&self) -> Self::GetNextResponseFut {
698        fn _decode(
699            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
700        ) -> Result<Vec<ListItem>, fidl::Error> {
701            let _response = fidl::client::decode_transaction_body::<
702                ListIteratorGetNextResponse,
703                fidl::encoding::DefaultFuchsiaResourceDialect,
704                0x6d8646b717dd56a2,
705            >(_buf?)?;
706            Ok(_response.keys)
707        }
708        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ListItem>>(
709            (),
710            0x6d8646b717dd56a2,
711            fidl::encoding::DynamicFlags::empty(),
712            _decode,
713        )
714    }
715}
716
717pub struct ListIteratorEventStream {
718    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
719}
720
721impl std::marker::Unpin for ListIteratorEventStream {}
722
723impl futures::stream::FusedStream for ListIteratorEventStream {
724    fn is_terminated(&self) -> bool {
725        self.event_receiver.is_terminated()
726    }
727}
728
729impl futures::Stream for ListIteratorEventStream {
730    type Item = Result<ListIteratorEvent, fidl::Error>;
731
732    fn poll_next(
733        mut self: std::pin::Pin<&mut Self>,
734        cx: &mut std::task::Context<'_>,
735    ) -> std::task::Poll<Option<Self::Item>> {
736        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
737            &mut self.event_receiver,
738            cx
739        )?) {
740            Some(buf) => std::task::Poll::Ready(Some(ListIteratorEvent::decode(buf))),
741            None => std::task::Poll::Ready(None),
742        }
743    }
744}
745
746#[derive(Debug)]
747pub enum ListIteratorEvent {}
748
749impl ListIteratorEvent {
750    /// Decodes a message buffer as a [`ListIteratorEvent`].
751    fn decode(
752        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
753    ) -> Result<ListIteratorEvent, fidl::Error> {
754        let (bytes, _handles) = buf.split_mut();
755        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
756        debug_assert_eq!(tx_header.tx_id, 0);
757        match tx_header.ordinal {
758            _ => Err(fidl::Error::UnknownOrdinal {
759                ordinal: tx_header.ordinal,
760                protocol_name: <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
761            }),
762        }
763    }
764}
765
766/// A Stream of incoming requests for fuchsia.stash/ListIterator.
767pub struct ListIteratorRequestStream {
768    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
769    is_terminated: bool,
770}
771
772impl std::marker::Unpin for ListIteratorRequestStream {}
773
774impl futures::stream::FusedStream for ListIteratorRequestStream {
775    fn is_terminated(&self) -> bool {
776        self.is_terminated
777    }
778}
779
780impl fidl::endpoints::RequestStream for ListIteratorRequestStream {
781    type Protocol = ListIteratorMarker;
782    type ControlHandle = ListIteratorControlHandle;
783
784    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
785        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
786    }
787
788    fn control_handle(&self) -> Self::ControlHandle {
789        ListIteratorControlHandle { inner: self.inner.clone() }
790    }
791
792    fn into_inner(
793        self,
794    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
795    {
796        (self.inner, self.is_terminated)
797    }
798
799    fn from_inner(
800        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
801        is_terminated: bool,
802    ) -> Self {
803        Self { inner, is_terminated }
804    }
805}
806
807impl futures::Stream for ListIteratorRequestStream {
808    type Item = Result<ListIteratorRequest, fidl::Error>;
809
810    fn poll_next(
811        mut self: std::pin::Pin<&mut Self>,
812        cx: &mut std::task::Context<'_>,
813    ) -> std::task::Poll<Option<Self::Item>> {
814        let this = &mut *self;
815        if this.inner.check_shutdown(cx) {
816            this.is_terminated = true;
817            return std::task::Poll::Ready(None);
818        }
819        if this.is_terminated {
820            panic!("polled ListIteratorRequestStream after completion");
821        }
822        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
823            |bytes, handles| {
824                match this.inner.channel().read_etc(cx, bytes, handles) {
825                    std::task::Poll::Ready(Ok(())) => {}
826                    std::task::Poll::Pending => return std::task::Poll::Pending,
827                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
828                        this.is_terminated = true;
829                        return std::task::Poll::Ready(None);
830                    }
831                    std::task::Poll::Ready(Err(e)) => {
832                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
833                            e.into(),
834                        ))));
835                    }
836                }
837
838                // A message has been received from the channel
839                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
840
841                std::task::Poll::Ready(Some(match header.ordinal {
842                    0x6d8646b717dd56a2 => {
843                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
844                        let mut req = fidl::new_empty!(
845                            fidl::encoding::EmptyPayload,
846                            fidl::encoding::DefaultFuchsiaResourceDialect
847                        );
848                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
849                        let control_handle =
850                            ListIteratorControlHandle { inner: this.inner.clone() };
851                        Ok(ListIteratorRequest::GetNext {
852                            responder: ListIteratorGetNextResponder {
853                                control_handle: std::mem::ManuallyDrop::new(control_handle),
854                                tx_id: header.tx_id,
855                            },
856                        })
857                    }
858                    _ => Err(fidl::Error::UnknownOrdinal {
859                        ordinal: header.ordinal,
860                        protocol_name:
861                            <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
862                    }),
863                }))
864            },
865        )
866    }
867}
868
869/// The iterator returned when a series of keys are being listed. Returns an
870/// empty vector when there are no more remaining ListItems.
871#[derive(Debug)]
872pub enum ListIteratorRequest {
873    GetNext { responder: ListIteratorGetNextResponder },
874}
875
876impl ListIteratorRequest {
877    #[allow(irrefutable_let_patterns)]
878    pub fn into_get_next(self) -> Option<(ListIteratorGetNextResponder)> {
879        if let ListIteratorRequest::GetNext { responder } = self { Some((responder)) } else { None }
880    }
881
882    /// Name of the method defined in FIDL
883    pub fn method_name(&self) -> &'static str {
884        match *self {
885            ListIteratorRequest::GetNext { .. } => "get_next",
886        }
887    }
888}
889
890#[derive(Debug, Clone)]
891pub struct ListIteratorControlHandle {
892    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
893}
894
895impl fidl::endpoints::ControlHandle for ListIteratorControlHandle {
896    fn shutdown(&self) {
897        self.inner.shutdown()
898    }
899    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
900        self.inner.shutdown_with_epitaph(status)
901    }
902
903    fn is_closed(&self) -> bool {
904        self.inner.channel().is_closed()
905    }
906    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
907        self.inner.channel().on_closed()
908    }
909
910    #[cfg(target_os = "fuchsia")]
911    fn signal_peer(
912        &self,
913        clear_mask: zx::Signals,
914        set_mask: zx::Signals,
915    ) -> Result<(), zx_status::Status> {
916        use fidl::Peered;
917        self.inner.channel().signal_peer(clear_mask, set_mask)
918    }
919}
920
921impl ListIteratorControlHandle {}
922
923#[must_use = "FIDL methods require a response to be sent"]
924#[derive(Debug)]
925pub struct ListIteratorGetNextResponder {
926    control_handle: std::mem::ManuallyDrop<ListIteratorControlHandle>,
927    tx_id: u32,
928}
929
930/// Set the the channel to be shutdown (see [`ListIteratorControlHandle::shutdown`])
931/// if the responder is dropped without sending a response, so that the client
932/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
933impl std::ops::Drop for ListIteratorGetNextResponder {
934    fn drop(&mut self) {
935        self.control_handle.shutdown();
936        // Safety: drops once, never accessed again
937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
938    }
939}
940
941impl fidl::endpoints::Responder for ListIteratorGetNextResponder {
942    type ControlHandle = ListIteratorControlHandle;
943
944    fn control_handle(&self) -> &ListIteratorControlHandle {
945        &self.control_handle
946    }
947
948    fn drop_without_shutdown(mut self) {
949        // Safety: drops once, never accessed again due to mem::forget
950        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
951        // Prevent Drop from running (which would shut down the channel)
952        std::mem::forget(self);
953    }
954}
955
956impl ListIteratorGetNextResponder {
957    /// Sends a response to the FIDL transaction.
958    ///
959    /// Sets the channel to shutdown if an error occurs.
960    pub fn send(self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
961        let _result = self.send_raw(keys);
962        if _result.is_err() {
963            self.control_handle.shutdown();
964        }
965        self.drop_without_shutdown();
966        _result
967    }
968
969    /// Similar to "send" but does not shutdown the channel if an error occurs.
970    pub fn send_no_shutdown_on_err(self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
971        let _result = self.send_raw(keys);
972        self.drop_without_shutdown();
973        _result
974    }
975
976    fn send_raw(&self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
977        self.control_handle.inner.send::<ListIteratorGetNextResponse>(
978            (keys,),
979            self.tx_id,
980            0x6d8646b717dd56a2,
981            fidl::encoding::DynamicFlags::empty(),
982        )
983    }
984}
985
986#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
987pub struct SecureStoreMarker;
988
989impl fidl::endpoints::ProtocolMarker for SecureStoreMarker {
990    type Proxy = SecureStoreProxy;
991    type RequestStream = SecureStoreRequestStream;
992    #[cfg(target_os = "fuchsia")]
993    type SynchronousProxy = SecureStoreSynchronousProxy;
994
995    const DEBUG_NAME: &'static str = "fuchsia.stash.SecureStore";
996}
997impl fidl::endpoints::DiscoverableProtocolMarker for SecureStoreMarker {}
998
999pub trait SecureStoreProxyInterface: Send + Sync {
1000    fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
1001    fn r#create_accessor(
1002        &self,
1003        read_only: bool,
1004        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1005    ) -> Result<(), fidl::Error>;
1006}
1007#[derive(Debug)]
1008#[cfg(target_os = "fuchsia")]
1009pub struct SecureStoreSynchronousProxy {
1010    client: fidl::client::sync::Client,
1011}
1012
1013#[cfg(target_os = "fuchsia")]
1014impl fidl::endpoints::SynchronousProxy for SecureStoreSynchronousProxy {
1015    type Proxy = SecureStoreProxy;
1016    type Protocol = SecureStoreMarker;
1017
1018    fn from_channel(inner: fidl::Channel) -> Self {
1019        Self::new(inner)
1020    }
1021
1022    fn into_channel(self) -> fidl::Channel {
1023        self.client.into_channel()
1024    }
1025
1026    fn as_channel(&self) -> &fidl::Channel {
1027        self.client.as_channel()
1028    }
1029}
1030
1031#[cfg(target_os = "fuchsia")]
1032impl SecureStoreSynchronousProxy {
1033    pub fn new(channel: fidl::Channel) -> Self {
1034        let protocol_name = <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1035        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1036    }
1037
1038    pub fn into_channel(self) -> fidl::Channel {
1039        self.client.into_channel()
1040    }
1041
1042    /// Waits until an event arrives and returns it. It is safe for other
1043    /// threads to make concurrent requests while waiting for an event.
1044    pub fn wait_for_event(
1045        &self,
1046        deadline: zx::MonotonicInstant,
1047    ) -> Result<SecureStoreEvent, fidl::Error> {
1048        SecureStoreEvent::decode(self.client.wait_for_event(deadline)?)
1049    }
1050
1051    /// Identify should be called at the beginning of a connection to identify
1052    /// which client service's store is to be accessed. In the future this will
1053    /// be deprecated in favor of component monikers, and each client will only
1054    /// be able to access its own store.
1055    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1056        self.client.send::<StoreIdentifyRequest>(
1057            (name,),
1058            0x4327d0764bed131b,
1059            fidl::encoding::DynamicFlags::empty(),
1060        )
1061    }
1062
1063    /// Creates a accessor for interacting with the store. The resulting
1064    /// interface can be used to inspect and modify the state of the store.
1065    pub fn r#create_accessor(
1066        &self,
1067        mut read_only: bool,
1068        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1069    ) -> Result<(), fidl::Error> {
1070        self.client.send::<StoreCreateAccessorRequest>(
1071            (read_only, accessor_request),
1072            0x5aaed3604b3bcfbb,
1073            fidl::encoding::DynamicFlags::empty(),
1074        )
1075    }
1076}
1077
1078#[cfg(target_os = "fuchsia")]
1079impl From<SecureStoreSynchronousProxy> for zx::Handle {
1080    fn from(value: SecureStoreSynchronousProxy) -> Self {
1081        value.into_channel().into()
1082    }
1083}
1084
1085#[cfg(target_os = "fuchsia")]
1086impl From<fidl::Channel> for SecureStoreSynchronousProxy {
1087    fn from(value: fidl::Channel) -> Self {
1088        Self::new(value)
1089    }
1090}
1091
1092#[cfg(target_os = "fuchsia")]
1093impl fidl::endpoints::FromClient for SecureStoreSynchronousProxy {
1094    type Protocol = SecureStoreMarker;
1095
1096    fn from_client(value: fidl::endpoints::ClientEnd<SecureStoreMarker>) -> Self {
1097        Self::new(value.into_channel())
1098    }
1099}
1100
1101#[derive(Debug, Clone)]
1102pub struct SecureStoreProxy {
1103    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1104}
1105
1106impl fidl::endpoints::Proxy for SecureStoreProxy {
1107    type Protocol = SecureStoreMarker;
1108
1109    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1110        Self::new(inner)
1111    }
1112
1113    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1114        self.client.into_channel().map_err(|client| Self { client })
1115    }
1116
1117    fn as_channel(&self) -> &::fidl::AsyncChannel {
1118        self.client.as_channel()
1119    }
1120}
1121
1122impl SecureStoreProxy {
1123    /// Create a new Proxy for fuchsia.stash/SecureStore.
1124    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1125        let protocol_name = <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1126        Self { client: fidl::client::Client::new(channel, protocol_name) }
1127    }
1128
1129    /// Get a Stream of events from the remote end of the protocol.
1130    ///
1131    /// # Panics
1132    ///
1133    /// Panics if the event stream was already taken.
1134    pub fn take_event_stream(&self) -> SecureStoreEventStream {
1135        SecureStoreEventStream { event_receiver: self.client.take_event_receiver() }
1136    }
1137
1138    /// Identify should be called at the beginning of a connection to identify
1139    /// which client service's store is to be accessed. In the future this will
1140    /// be deprecated in favor of component monikers, and each client will only
1141    /// be able to access its own store.
1142    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1143        SecureStoreProxyInterface::r#identify(self, name)
1144    }
1145
1146    /// Creates a accessor for interacting with the store. The resulting
1147    /// interface can be used to inspect and modify the state of the store.
1148    pub fn r#create_accessor(
1149        &self,
1150        mut read_only: bool,
1151        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1152    ) -> Result<(), fidl::Error> {
1153        SecureStoreProxyInterface::r#create_accessor(self, read_only, accessor_request)
1154    }
1155}
1156
1157impl SecureStoreProxyInterface for SecureStoreProxy {
1158    fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1159        self.client.send::<StoreIdentifyRequest>(
1160            (name,),
1161            0x4327d0764bed131b,
1162            fidl::encoding::DynamicFlags::empty(),
1163        )
1164    }
1165
1166    fn r#create_accessor(
1167        &self,
1168        mut read_only: bool,
1169        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1170    ) -> Result<(), fidl::Error> {
1171        self.client.send::<StoreCreateAccessorRequest>(
1172            (read_only, accessor_request),
1173            0x5aaed3604b3bcfbb,
1174            fidl::encoding::DynamicFlags::empty(),
1175        )
1176    }
1177}
1178
1179pub struct SecureStoreEventStream {
1180    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1181}
1182
1183impl std::marker::Unpin for SecureStoreEventStream {}
1184
1185impl futures::stream::FusedStream for SecureStoreEventStream {
1186    fn is_terminated(&self) -> bool {
1187        self.event_receiver.is_terminated()
1188    }
1189}
1190
1191impl futures::Stream for SecureStoreEventStream {
1192    type Item = Result<SecureStoreEvent, fidl::Error>;
1193
1194    fn poll_next(
1195        mut self: std::pin::Pin<&mut Self>,
1196        cx: &mut std::task::Context<'_>,
1197    ) -> std::task::Poll<Option<Self::Item>> {
1198        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1199            &mut self.event_receiver,
1200            cx
1201        )?) {
1202            Some(buf) => std::task::Poll::Ready(Some(SecureStoreEvent::decode(buf))),
1203            None => std::task::Poll::Ready(None),
1204        }
1205    }
1206}
1207
1208#[derive(Debug)]
1209pub enum SecureStoreEvent {}
1210
1211impl SecureStoreEvent {
1212    /// Decodes a message buffer as a [`SecureStoreEvent`].
1213    fn decode(
1214        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1215    ) -> Result<SecureStoreEvent, fidl::Error> {
1216        let (bytes, _handles) = buf.split_mut();
1217        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1218        debug_assert_eq!(tx_header.tx_id, 0);
1219        match tx_header.ordinal {
1220            _ => Err(fidl::Error::UnknownOrdinal {
1221                ordinal: tx_header.ordinal,
1222                protocol_name: <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1223            }),
1224        }
1225    }
1226}
1227
1228/// A Stream of incoming requests for fuchsia.stash/SecureStore.
1229pub struct SecureStoreRequestStream {
1230    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1231    is_terminated: bool,
1232}
1233
1234impl std::marker::Unpin for SecureStoreRequestStream {}
1235
1236impl futures::stream::FusedStream for SecureStoreRequestStream {
1237    fn is_terminated(&self) -> bool {
1238        self.is_terminated
1239    }
1240}
1241
1242impl fidl::endpoints::RequestStream for SecureStoreRequestStream {
1243    type Protocol = SecureStoreMarker;
1244    type ControlHandle = SecureStoreControlHandle;
1245
1246    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1247        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1248    }
1249
1250    fn control_handle(&self) -> Self::ControlHandle {
1251        SecureStoreControlHandle { inner: self.inner.clone() }
1252    }
1253
1254    fn into_inner(
1255        self,
1256    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1257    {
1258        (self.inner, self.is_terminated)
1259    }
1260
1261    fn from_inner(
1262        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1263        is_terminated: bool,
1264    ) -> Self {
1265        Self { inner, is_terminated }
1266    }
1267}
1268
1269impl futures::Stream for SecureStoreRequestStream {
1270    type Item = Result<SecureStoreRequest, fidl::Error>;
1271
1272    fn poll_next(
1273        mut self: std::pin::Pin<&mut Self>,
1274        cx: &mut std::task::Context<'_>,
1275    ) -> std::task::Poll<Option<Self::Item>> {
1276        let this = &mut *self;
1277        if this.inner.check_shutdown(cx) {
1278            this.is_terminated = true;
1279            return std::task::Poll::Ready(None);
1280        }
1281        if this.is_terminated {
1282            panic!("polled SecureStoreRequestStream after completion");
1283        }
1284        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1285            |bytes, handles| {
1286                match this.inner.channel().read_etc(cx, bytes, handles) {
1287                    std::task::Poll::Ready(Ok(())) => {}
1288                    std::task::Poll::Pending => return std::task::Poll::Pending,
1289                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1290                        this.is_terminated = true;
1291                        return std::task::Poll::Ready(None);
1292                    }
1293                    std::task::Poll::Ready(Err(e)) => {
1294                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1295                            e.into(),
1296                        ))));
1297                    }
1298                }
1299
1300                // A message has been received from the channel
1301                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1302
1303                std::task::Poll::Ready(Some(match header.ordinal {
1304                    0x4327d0764bed131b => {
1305                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1306                        let mut req = fidl::new_empty!(
1307                            StoreIdentifyRequest,
1308                            fidl::encoding::DefaultFuchsiaResourceDialect
1309                        );
1310                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreIdentifyRequest>(&header, _body_bytes, handles, &mut req)?;
1311                        let control_handle = SecureStoreControlHandle { inner: this.inner.clone() };
1312                        Ok(SecureStoreRequest::Identify { name: req.name, control_handle })
1313                    }
1314                    0x5aaed3604b3bcfbb => {
1315                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1316                        let mut req = fidl::new_empty!(
1317                            StoreCreateAccessorRequest,
1318                            fidl::encoding::DefaultFuchsiaResourceDialect
1319                        );
1320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreCreateAccessorRequest>(&header, _body_bytes, handles, &mut req)?;
1321                        let control_handle = SecureStoreControlHandle { inner: this.inner.clone() };
1322                        Ok(SecureStoreRequest::CreateAccessor {
1323                            read_only: req.read_only,
1324                            accessor_request: req.accessor_request,
1325
1326                            control_handle,
1327                        })
1328                    }
1329                    _ => Err(fidl::Error::UnknownOrdinal {
1330                        ordinal: header.ordinal,
1331                        protocol_name:
1332                            <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1333                    }),
1334                }))
1335            },
1336        )
1337    }
1338}
1339
1340/// Interface used to interact with a given client's key/value store. The bytes
1341/// type is disabled in this store.
1342#[derive(Debug)]
1343pub enum SecureStoreRequest {
1344    /// Identify should be called at the beginning of a connection to identify
1345    /// which client service's store is to be accessed. In the future this will
1346    /// be deprecated in favor of component monikers, and each client will only
1347    /// be able to access its own store.
1348    Identify { name: String, control_handle: SecureStoreControlHandle },
1349    /// Creates a accessor for interacting with the store. The resulting
1350    /// interface can be used to inspect and modify the state of the store.
1351    CreateAccessor {
1352        read_only: bool,
1353        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1354        control_handle: SecureStoreControlHandle,
1355    },
1356}
1357
1358impl SecureStoreRequest {
1359    #[allow(irrefutable_let_patterns)]
1360    pub fn into_identify(self) -> Option<(String, SecureStoreControlHandle)> {
1361        if let SecureStoreRequest::Identify { name, control_handle } = self {
1362            Some((name, control_handle))
1363        } else {
1364            None
1365        }
1366    }
1367
1368    #[allow(irrefutable_let_patterns)]
1369    pub fn into_create_accessor(
1370        self,
1371    ) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, SecureStoreControlHandle)>
1372    {
1373        if let SecureStoreRequest::CreateAccessor { read_only, accessor_request, control_handle } =
1374            self
1375        {
1376            Some((read_only, accessor_request, control_handle))
1377        } else {
1378            None
1379        }
1380    }
1381
1382    /// Name of the method defined in FIDL
1383    pub fn method_name(&self) -> &'static str {
1384        match *self {
1385            SecureStoreRequest::Identify { .. } => "identify",
1386            SecureStoreRequest::CreateAccessor { .. } => "create_accessor",
1387        }
1388    }
1389}
1390
1391#[derive(Debug, Clone)]
1392pub struct SecureStoreControlHandle {
1393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1394}
1395
1396impl fidl::endpoints::ControlHandle for SecureStoreControlHandle {
1397    fn shutdown(&self) {
1398        self.inner.shutdown()
1399    }
1400    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1401        self.inner.shutdown_with_epitaph(status)
1402    }
1403
1404    fn is_closed(&self) -> bool {
1405        self.inner.channel().is_closed()
1406    }
1407    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1408        self.inner.channel().on_closed()
1409    }
1410
1411    #[cfg(target_os = "fuchsia")]
1412    fn signal_peer(
1413        &self,
1414        clear_mask: zx::Signals,
1415        set_mask: zx::Signals,
1416    ) -> Result<(), zx_status::Status> {
1417        use fidl::Peered;
1418        self.inner.channel().signal_peer(clear_mask, set_mask)
1419    }
1420}
1421
1422impl SecureStoreControlHandle {}
1423
1424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1425pub struct StoreMarker;
1426
1427impl fidl::endpoints::ProtocolMarker for StoreMarker {
1428    type Proxy = StoreProxy;
1429    type RequestStream = StoreRequestStream;
1430    #[cfg(target_os = "fuchsia")]
1431    type SynchronousProxy = StoreSynchronousProxy;
1432
1433    const DEBUG_NAME: &'static str = "fuchsia.stash.Store";
1434}
1435impl fidl::endpoints::DiscoverableProtocolMarker for StoreMarker {}
1436
1437pub trait StoreProxyInterface: Send + Sync {
1438    fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
1439    fn r#create_accessor(
1440        &self,
1441        read_only: bool,
1442        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1443    ) -> Result<(), fidl::Error>;
1444}
1445#[derive(Debug)]
1446#[cfg(target_os = "fuchsia")]
1447pub struct StoreSynchronousProxy {
1448    client: fidl::client::sync::Client,
1449}
1450
1451#[cfg(target_os = "fuchsia")]
1452impl fidl::endpoints::SynchronousProxy for StoreSynchronousProxy {
1453    type Proxy = StoreProxy;
1454    type Protocol = StoreMarker;
1455
1456    fn from_channel(inner: fidl::Channel) -> Self {
1457        Self::new(inner)
1458    }
1459
1460    fn into_channel(self) -> fidl::Channel {
1461        self.client.into_channel()
1462    }
1463
1464    fn as_channel(&self) -> &fidl::Channel {
1465        self.client.as_channel()
1466    }
1467}
1468
1469#[cfg(target_os = "fuchsia")]
1470impl StoreSynchronousProxy {
1471    pub fn new(channel: fidl::Channel) -> Self {
1472        let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1473        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1474    }
1475
1476    pub fn into_channel(self) -> fidl::Channel {
1477        self.client.into_channel()
1478    }
1479
1480    /// Waits until an event arrives and returns it. It is safe for other
1481    /// threads to make concurrent requests while waiting for an event.
1482    pub fn wait_for_event(
1483        &self,
1484        deadline: zx::MonotonicInstant,
1485    ) -> Result<StoreEvent, fidl::Error> {
1486        StoreEvent::decode(self.client.wait_for_event(deadline)?)
1487    }
1488
1489    /// Identify should be called at the beginning of a connection to identify
1490    /// which client service's store is to be accessed. In the future this will
1491    /// be deprecated in favor of component monikers, and each client will only
1492    /// be able to access its own store.
1493    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1494        self.client.send::<StoreIdentifyRequest>(
1495            (name,),
1496            0x4327d0764bed131b,
1497            fidl::encoding::DynamicFlags::empty(),
1498        )
1499    }
1500
1501    /// Creates a accessor for interacting with the store. The resulting
1502    /// interface can be used to inspect and modify the state of the store.
1503    pub fn r#create_accessor(
1504        &self,
1505        mut read_only: bool,
1506        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1507    ) -> Result<(), fidl::Error> {
1508        self.client.send::<StoreCreateAccessorRequest>(
1509            (read_only, accessor_request),
1510            0x5aaed3604b3bcfbb,
1511            fidl::encoding::DynamicFlags::empty(),
1512        )
1513    }
1514}
1515
1516#[cfg(target_os = "fuchsia")]
1517impl From<StoreSynchronousProxy> for zx::Handle {
1518    fn from(value: StoreSynchronousProxy) -> Self {
1519        value.into_channel().into()
1520    }
1521}
1522
1523#[cfg(target_os = "fuchsia")]
1524impl From<fidl::Channel> for StoreSynchronousProxy {
1525    fn from(value: fidl::Channel) -> Self {
1526        Self::new(value)
1527    }
1528}
1529
1530#[cfg(target_os = "fuchsia")]
1531impl fidl::endpoints::FromClient for StoreSynchronousProxy {
1532    type Protocol = StoreMarker;
1533
1534    fn from_client(value: fidl::endpoints::ClientEnd<StoreMarker>) -> Self {
1535        Self::new(value.into_channel())
1536    }
1537}
1538
1539#[derive(Debug, Clone)]
1540pub struct StoreProxy {
1541    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1542}
1543
1544impl fidl::endpoints::Proxy for StoreProxy {
1545    type Protocol = StoreMarker;
1546
1547    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1548        Self::new(inner)
1549    }
1550
1551    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1552        self.client.into_channel().map_err(|client| Self { client })
1553    }
1554
1555    fn as_channel(&self) -> &::fidl::AsyncChannel {
1556        self.client.as_channel()
1557    }
1558}
1559
1560impl StoreProxy {
1561    /// Create a new Proxy for fuchsia.stash/Store.
1562    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1563        let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1564        Self { client: fidl::client::Client::new(channel, protocol_name) }
1565    }
1566
1567    /// Get a Stream of events from the remote end of the protocol.
1568    ///
1569    /// # Panics
1570    ///
1571    /// Panics if the event stream was already taken.
1572    pub fn take_event_stream(&self) -> StoreEventStream {
1573        StoreEventStream { event_receiver: self.client.take_event_receiver() }
1574    }
1575
1576    /// Identify should be called at the beginning of a connection to identify
1577    /// which client service's store is to be accessed. In the future this will
1578    /// be deprecated in favor of component monikers, and each client will only
1579    /// be able to access its own store.
1580    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1581        StoreProxyInterface::r#identify(self, name)
1582    }
1583
1584    /// Creates a accessor for interacting with the store. The resulting
1585    /// interface can be used to inspect and modify the state of the store.
1586    pub fn r#create_accessor(
1587        &self,
1588        mut read_only: bool,
1589        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1590    ) -> Result<(), fidl::Error> {
1591        StoreProxyInterface::r#create_accessor(self, read_only, accessor_request)
1592    }
1593}
1594
1595impl StoreProxyInterface for StoreProxy {
1596    fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1597        self.client.send::<StoreIdentifyRequest>(
1598            (name,),
1599            0x4327d0764bed131b,
1600            fidl::encoding::DynamicFlags::empty(),
1601        )
1602    }
1603
1604    fn r#create_accessor(
1605        &self,
1606        mut read_only: bool,
1607        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1608    ) -> Result<(), fidl::Error> {
1609        self.client.send::<StoreCreateAccessorRequest>(
1610            (read_only, accessor_request),
1611            0x5aaed3604b3bcfbb,
1612            fidl::encoding::DynamicFlags::empty(),
1613        )
1614    }
1615}
1616
1617pub struct StoreEventStream {
1618    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1619}
1620
1621impl std::marker::Unpin for StoreEventStream {}
1622
1623impl futures::stream::FusedStream for StoreEventStream {
1624    fn is_terminated(&self) -> bool {
1625        self.event_receiver.is_terminated()
1626    }
1627}
1628
1629impl futures::Stream for StoreEventStream {
1630    type Item = Result<StoreEvent, fidl::Error>;
1631
1632    fn poll_next(
1633        mut self: std::pin::Pin<&mut Self>,
1634        cx: &mut std::task::Context<'_>,
1635    ) -> std::task::Poll<Option<Self::Item>> {
1636        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1637            &mut self.event_receiver,
1638            cx
1639        )?) {
1640            Some(buf) => std::task::Poll::Ready(Some(StoreEvent::decode(buf))),
1641            None => std::task::Poll::Ready(None),
1642        }
1643    }
1644}
1645
1646#[derive(Debug)]
1647pub enum StoreEvent {}
1648
1649impl StoreEvent {
1650    /// Decodes a message buffer as a [`StoreEvent`].
1651    fn decode(
1652        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1653    ) -> Result<StoreEvent, fidl::Error> {
1654        let (bytes, _handles) = buf.split_mut();
1655        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1656        debug_assert_eq!(tx_header.tx_id, 0);
1657        match tx_header.ordinal {
1658            _ => Err(fidl::Error::UnknownOrdinal {
1659                ordinal: tx_header.ordinal,
1660                protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1661            }),
1662        }
1663    }
1664}
1665
1666/// A Stream of incoming requests for fuchsia.stash/Store.
1667pub struct StoreRequestStream {
1668    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1669    is_terminated: bool,
1670}
1671
1672impl std::marker::Unpin for StoreRequestStream {}
1673
1674impl futures::stream::FusedStream for StoreRequestStream {
1675    fn is_terminated(&self) -> bool {
1676        self.is_terminated
1677    }
1678}
1679
1680impl fidl::endpoints::RequestStream for StoreRequestStream {
1681    type Protocol = StoreMarker;
1682    type ControlHandle = StoreControlHandle;
1683
1684    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1685        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1686    }
1687
1688    fn control_handle(&self) -> Self::ControlHandle {
1689        StoreControlHandle { inner: self.inner.clone() }
1690    }
1691
1692    fn into_inner(
1693        self,
1694    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1695    {
1696        (self.inner, self.is_terminated)
1697    }
1698
1699    fn from_inner(
1700        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1701        is_terminated: bool,
1702    ) -> Self {
1703        Self { inner, is_terminated }
1704    }
1705}
1706
1707impl futures::Stream for StoreRequestStream {
1708    type Item = Result<StoreRequest, fidl::Error>;
1709
1710    fn poll_next(
1711        mut self: std::pin::Pin<&mut Self>,
1712        cx: &mut std::task::Context<'_>,
1713    ) -> std::task::Poll<Option<Self::Item>> {
1714        let this = &mut *self;
1715        if this.inner.check_shutdown(cx) {
1716            this.is_terminated = true;
1717            return std::task::Poll::Ready(None);
1718        }
1719        if this.is_terminated {
1720            panic!("polled StoreRequestStream after completion");
1721        }
1722        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1723            |bytes, handles| {
1724                match this.inner.channel().read_etc(cx, bytes, handles) {
1725                    std::task::Poll::Ready(Ok(())) => {}
1726                    std::task::Poll::Pending => return std::task::Poll::Pending,
1727                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1728                        this.is_terminated = true;
1729                        return std::task::Poll::Ready(None);
1730                    }
1731                    std::task::Poll::Ready(Err(e)) => {
1732                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1733                            e.into(),
1734                        ))));
1735                    }
1736                }
1737
1738                // A message has been received from the channel
1739                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1740
1741                std::task::Poll::Ready(Some(match header.ordinal {
1742                    0x4327d0764bed131b => {
1743                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1744                        let mut req = fidl::new_empty!(
1745                            StoreIdentifyRequest,
1746                            fidl::encoding::DefaultFuchsiaResourceDialect
1747                        );
1748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreIdentifyRequest>(&header, _body_bytes, handles, &mut req)?;
1749                        let control_handle = StoreControlHandle { inner: this.inner.clone() };
1750                        Ok(StoreRequest::Identify { name: req.name, control_handle })
1751                    }
1752                    0x5aaed3604b3bcfbb => {
1753                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1754                        let mut req = fidl::new_empty!(
1755                            StoreCreateAccessorRequest,
1756                            fidl::encoding::DefaultFuchsiaResourceDialect
1757                        );
1758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreCreateAccessorRequest>(&header, _body_bytes, handles, &mut req)?;
1759                        let control_handle = StoreControlHandle { inner: this.inner.clone() };
1760                        Ok(StoreRequest::CreateAccessor {
1761                            read_only: req.read_only,
1762                            accessor_request: req.accessor_request,
1763
1764                            control_handle,
1765                        })
1766                    }
1767                    _ => Err(fidl::Error::UnknownOrdinal {
1768                        ordinal: header.ordinal,
1769                        protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1770                    }),
1771                }))
1772            },
1773        )
1774    }
1775}
1776
1777/// Interface used to interact with a given client's key/value store
1778#[derive(Debug)]
1779pub enum StoreRequest {
1780    /// Identify should be called at the beginning of a connection to identify
1781    /// which client service's store is to be accessed. In the future this will
1782    /// be deprecated in favor of component monikers, and each client will only
1783    /// be able to access its own store.
1784    Identify { name: String, control_handle: StoreControlHandle },
1785    /// Creates a accessor for interacting with the store. The resulting
1786    /// interface can be used to inspect and modify the state of the store.
1787    CreateAccessor {
1788        read_only: bool,
1789        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1790        control_handle: StoreControlHandle,
1791    },
1792}
1793
1794impl StoreRequest {
1795    #[allow(irrefutable_let_patterns)]
1796    pub fn into_identify(self) -> Option<(String, StoreControlHandle)> {
1797        if let StoreRequest::Identify { name, control_handle } = self {
1798            Some((name, control_handle))
1799        } else {
1800            None
1801        }
1802    }
1803
1804    #[allow(irrefutable_let_patterns)]
1805    pub fn into_create_accessor(
1806        self,
1807    ) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, StoreControlHandle)> {
1808        if let StoreRequest::CreateAccessor { read_only, accessor_request, control_handle } = self {
1809            Some((read_only, accessor_request, control_handle))
1810        } else {
1811            None
1812        }
1813    }
1814
1815    /// Name of the method defined in FIDL
1816    pub fn method_name(&self) -> &'static str {
1817        match *self {
1818            StoreRequest::Identify { .. } => "identify",
1819            StoreRequest::CreateAccessor { .. } => "create_accessor",
1820        }
1821    }
1822}
1823
1824#[derive(Debug, Clone)]
1825pub struct StoreControlHandle {
1826    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1827}
1828
1829impl fidl::endpoints::ControlHandle for StoreControlHandle {
1830    fn shutdown(&self) {
1831        self.inner.shutdown()
1832    }
1833    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1834        self.inner.shutdown_with_epitaph(status)
1835    }
1836
1837    fn is_closed(&self) -> bool {
1838        self.inner.channel().is_closed()
1839    }
1840    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1841        self.inner.channel().on_closed()
1842    }
1843
1844    #[cfg(target_os = "fuchsia")]
1845    fn signal_peer(
1846        &self,
1847        clear_mask: zx::Signals,
1848        set_mask: zx::Signals,
1849    ) -> Result<(), zx_status::Status> {
1850        use fidl::Peered;
1851        self.inner.channel().signal_peer(clear_mask, set_mask)
1852    }
1853}
1854
1855impl StoreControlHandle {}
1856
1857#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1858pub struct Store2Marker;
1859
1860impl fidl::endpoints::ProtocolMarker for Store2Marker {
1861    type Proxy = Store2Proxy;
1862    type RequestStream = Store2RequestStream;
1863    #[cfg(target_os = "fuchsia")]
1864    type SynchronousProxy = Store2SynchronousProxy;
1865
1866    const DEBUG_NAME: &'static str = "fuchsia.stash.Store2";
1867}
1868impl fidl::endpoints::DiscoverableProtocolMarker for Store2Marker {}
1869
1870pub trait Store2ProxyInterface: Send + Sync {
1871    fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
1872    fn r#create_accessor(
1873        &self,
1874        read_only: bool,
1875        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1876    ) -> Result<(), fidl::Error>;
1877}
1878#[derive(Debug)]
1879#[cfg(target_os = "fuchsia")]
1880pub struct Store2SynchronousProxy {
1881    client: fidl::client::sync::Client,
1882}
1883
1884#[cfg(target_os = "fuchsia")]
1885impl fidl::endpoints::SynchronousProxy for Store2SynchronousProxy {
1886    type Proxy = Store2Proxy;
1887    type Protocol = Store2Marker;
1888
1889    fn from_channel(inner: fidl::Channel) -> Self {
1890        Self::new(inner)
1891    }
1892
1893    fn into_channel(self) -> fidl::Channel {
1894        self.client.into_channel()
1895    }
1896
1897    fn as_channel(&self) -> &fidl::Channel {
1898        self.client.as_channel()
1899    }
1900}
1901
1902#[cfg(target_os = "fuchsia")]
1903impl Store2SynchronousProxy {
1904    pub fn new(channel: fidl::Channel) -> Self {
1905        let protocol_name = <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1906        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1907    }
1908
1909    pub fn into_channel(self) -> fidl::Channel {
1910        self.client.into_channel()
1911    }
1912
1913    /// Waits until an event arrives and returns it. It is safe for other
1914    /// threads to make concurrent requests while waiting for an event.
1915    pub fn wait_for_event(
1916        &self,
1917        deadline: zx::MonotonicInstant,
1918    ) -> Result<Store2Event, fidl::Error> {
1919        Store2Event::decode(self.client.wait_for_event(deadline)?)
1920    }
1921
1922    /// Identify should be called at the beginning of a connection to identify
1923    /// which client service's store is to be accessed. In the future this will
1924    /// be deprecated in favor of component monikers, and each client will only
1925    /// be able to access its own store.
1926    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
1927        self.client.send::<StoreIdentifyRequest>(
1928            (name,),
1929            0x4327d0764bed131b,
1930            fidl::encoding::DynamicFlags::empty(),
1931        )
1932    }
1933
1934    /// Creates a accessor for interacting with the store. The resulting
1935    /// interface can be used to inspect and modify the state of the store.
1936    pub fn r#create_accessor(
1937        &self,
1938        mut read_only: bool,
1939        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
1940    ) -> Result<(), fidl::Error> {
1941        self.client.send::<StoreCreateAccessorRequest>(
1942            (read_only, accessor_request),
1943            0x5aaed3604b3bcfbb,
1944            fidl::encoding::DynamicFlags::empty(),
1945        )
1946    }
1947}
1948
1949#[cfg(target_os = "fuchsia")]
1950impl From<Store2SynchronousProxy> for zx::Handle {
1951    fn from(value: Store2SynchronousProxy) -> Self {
1952        value.into_channel().into()
1953    }
1954}
1955
1956#[cfg(target_os = "fuchsia")]
1957impl From<fidl::Channel> for Store2SynchronousProxy {
1958    fn from(value: fidl::Channel) -> Self {
1959        Self::new(value)
1960    }
1961}
1962
1963#[cfg(target_os = "fuchsia")]
1964impl fidl::endpoints::FromClient for Store2SynchronousProxy {
1965    type Protocol = Store2Marker;
1966
1967    fn from_client(value: fidl::endpoints::ClientEnd<Store2Marker>) -> Self {
1968        Self::new(value.into_channel())
1969    }
1970}
1971
1972#[derive(Debug, Clone)]
1973pub struct Store2Proxy {
1974    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1975}
1976
1977impl fidl::endpoints::Proxy for Store2Proxy {
1978    type Protocol = Store2Marker;
1979
1980    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1981        Self::new(inner)
1982    }
1983
1984    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1985        self.client.into_channel().map_err(|client| Self { client })
1986    }
1987
1988    fn as_channel(&self) -> &::fidl::AsyncChannel {
1989        self.client.as_channel()
1990    }
1991}
1992
1993impl Store2Proxy {
1994    /// Create a new Proxy for fuchsia.stash/Store2.
1995    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1996        let protocol_name = <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1997        Self { client: fidl::client::Client::new(channel, protocol_name) }
1998    }
1999
2000    /// Get a Stream of events from the remote end of the protocol.
2001    ///
2002    /// # Panics
2003    ///
2004    /// Panics if the event stream was already taken.
2005    pub fn take_event_stream(&self) -> Store2EventStream {
2006        Store2EventStream { event_receiver: self.client.take_event_receiver() }
2007    }
2008
2009    /// Identify should be called at the beginning of a connection to identify
2010    /// which client service's store is to be accessed. In the future this will
2011    /// be deprecated in favor of component monikers, and each client will only
2012    /// be able to access its own store.
2013    pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
2014        Store2ProxyInterface::r#identify(self, name)
2015    }
2016
2017    /// Creates a accessor for interacting with the store. The resulting
2018    /// interface can be used to inspect and modify the state of the store.
2019    pub fn r#create_accessor(
2020        &self,
2021        mut read_only: bool,
2022        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
2023    ) -> Result<(), fidl::Error> {
2024        Store2ProxyInterface::r#create_accessor(self, read_only, accessor_request)
2025    }
2026}
2027
2028impl Store2ProxyInterface for Store2Proxy {
2029    fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
2030        self.client.send::<StoreIdentifyRequest>(
2031            (name,),
2032            0x4327d0764bed131b,
2033            fidl::encoding::DynamicFlags::empty(),
2034        )
2035    }
2036
2037    fn r#create_accessor(
2038        &self,
2039        mut read_only: bool,
2040        mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
2041    ) -> Result<(), fidl::Error> {
2042        self.client.send::<StoreCreateAccessorRequest>(
2043            (read_only, accessor_request),
2044            0x5aaed3604b3bcfbb,
2045            fidl::encoding::DynamicFlags::empty(),
2046        )
2047    }
2048}
2049
2050pub struct Store2EventStream {
2051    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2052}
2053
2054impl std::marker::Unpin for Store2EventStream {}
2055
2056impl futures::stream::FusedStream for Store2EventStream {
2057    fn is_terminated(&self) -> bool {
2058        self.event_receiver.is_terminated()
2059    }
2060}
2061
2062impl futures::Stream for Store2EventStream {
2063    type Item = Result<Store2Event, fidl::Error>;
2064
2065    fn poll_next(
2066        mut self: std::pin::Pin<&mut Self>,
2067        cx: &mut std::task::Context<'_>,
2068    ) -> std::task::Poll<Option<Self::Item>> {
2069        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2070            &mut self.event_receiver,
2071            cx
2072        )?) {
2073            Some(buf) => std::task::Poll::Ready(Some(Store2Event::decode(buf))),
2074            None => std::task::Poll::Ready(None),
2075        }
2076    }
2077}
2078
2079#[derive(Debug)]
2080pub enum Store2Event {}
2081
2082impl Store2Event {
2083    /// Decodes a message buffer as a [`Store2Event`].
2084    fn decode(
2085        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2086    ) -> Result<Store2Event, fidl::Error> {
2087        let (bytes, _handles) = buf.split_mut();
2088        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2089        debug_assert_eq!(tx_header.tx_id, 0);
2090        match tx_header.ordinal {
2091            _ => Err(fidl::Error::UnknownOrdinal {
2092                ordinal: tx_header.ordinal,
2093                protocol_name: <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2094            }),
2095        }
2096    }
2097}
2098
2099/// A Stream of incoming requests for fuchsia.stash/Store2.
2100pub struct Store2RequestStream {
2101    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2102    is_terminated: bool,
2103}
2104
2105impl std::marker::Unpin for Store2RequestStream {}
2106
2107impl futures::stream::FusedStream for Store2RequestStream {
2108    fn is_terminated(&self) -> bool {
2109        self.is_terminated
2110    }
2111}
2112
2113impl fidl::endpoints::RequestStream for Store2RequestStream {
2114    type Protocol = Store2Marker;
2115    type ControlHandle = Store2ControlHandle;
2116
2117    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2118        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2119    }
2120
2121    fn control_handle(&self) -> Self::ControlHandle {
2122        Store2ControlHandle { inner: self.inner.clone() }
2123    }
2124
2125    fn into_inner(
2126        self,
2127    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2128    {
2129        (self.inner, self.is_terminated)
2130    }
2131
2132    fn from_inner(
2133        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2134        is_terminated: bool,
2135    ) -> Self {
2136        Self { inner, is_terminated }
2137    }
2138}
2139
2140impl futures::Stream for Store2RequestStream {
2141    type Item = Result<Store2Request, fidl::Error>;
2142
2143    fn poll_next(
2144        mut self: std::pin::Pin<&mut Self>,
2145        cx: &mut std::task::Context<'_>,
2146    ) -> std::task::Poll<Option<Self::Item>> {
2147        let this = &mut *self;
2148        if this.inner.check_shutdown(cx) {
2149            this.is_terminated = true;
2150            return std::task::Poll::Ready(None);
2151        }
2152        if this.is_terminated {
2153            panic!("polled Store2RequestStream after completion");
2154        }
2155        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2156            |bytes, handles| {
2157                match this.inner.channel().read_etc(cx, bytes, handles) {
2158                    std::task::Poll::Ready(Ok(())) => {}
2159                    std::task::Poll::Pending => return std::task::Poll::Pending,
2160                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2161                        this.is_terminated = true;
2162                        return std::task::Poll::Ready(None);
2163                    }
2164                    std::task::Poll::Ready(Err(e)) => {
2165                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2166                            e.into(),
2167                        ))));
2168                    }
2169                }
2170
2171                // A message has been received from the channel
2172                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2173
2174                std::task::Poll::Ready(Some(match header.ordinal {
2175                    0x4327d0764bed131b => {
2176                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2177                        let mut req = fidl::new_empty!(
2178                            StoreIdentifyRequest,
2179                            fidl::encoding::DefaultFuchsiaResourceDialect
2180                        );
2181                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreIdentifyRequest>(&header, _body_bytes, handles, &mut req)?;
2182                        let control_handle = Store2ControlHandle { inner: this.inner.clone() };
2183                        Ok(Store2Request::Identify { name: req.name, control_handle })
2184                    }
2185                    0x5aaed3604b3bcfbb => {
2186                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2187                        let mut req = fidl::new_empty!(
2188                            StoreCreateAccessorRequest,
2189                            fidl::encoding::DefaultFuchsiaResourceDialect
2190                        );
2191                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreCreateAccessorRequest>(&header, _body_bytes, handles, &mut req)?;
2192                        let control_handle = Store2ControlHandle { inner: this.inner.clone() };
2193                        Ok(Store2Request::CreateAccessor {
2194                            read_only: req.read_only,
2195                            accessor_request: req.accessor_request,
2196
2197                            control_handle,
2198                        })
2199                    }
2200                    _ => Err(fidl::Error::UnknownOrdinal {
2201                        ordinal: header.ordinal,
2202                        protocol_name:
2203                            <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2204                    }),
2205                }))
2206            },
2207        )
2208    }
2209}
2210
2211/// A copy of |Store| in all but name. Behaves identically to |Store|.
2212/// See: https://fxbug.dev/42125700
2213#[derive(Debug)]
2214pub enum Store2Request {
2215    /// Identify should be called at the beginning of a connection to identify
2216    /// which client service's store is to be accessed. In the future this will
2217    /// be deprecated in favor of component monikers, and each client will only
2218    /// be able to access its own store.
2219    Identify { name: String, control_handle: Store2ControlHandle },
2220    /// Creates a accessor for interacting with the store. The resulting
2221    /// interface can be used to inspect and modify the state of the store.
2222    CreateAccessor {
2223        read_only: bool,
2224        accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
2225        control_handle: Store2ControlHandle,
2226    },
2227}
2228
2229impl Store2Request {
2230    #[allow(irrefutable_let_patterns)]
2231    pub fn into_identify(self) -> Option<(String, Store2ControlHandle)> {
2232        if let Store2Request::Identify { name, control_handle } = self {
2233            Some((name, control_handle))
2234        } else {
2235            None
2236        }
2237    }
2238
2239    #[allow(irrefutable_let_patterns)]
2240    pub fn into_create_accessor(
2241        self,
2242    ) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, Store2ControlHandle)> {
2243        if let Store2Request::CreateAccessor { read_only, accessor_request, control_handle } = self
2244        {
2245            Some((read_only, accessor_request, control_handle))
2246        } else {
2247            None
2248        }
2249    }
2250
2251    /// Name of the method defined in FIDL
2252    pub fn method_name(&self) -> &'static str {
2253        match *self {
2254            Store2Request::Identify { .. } => "identify",
2255            Store2Request::CreateAccessor { .. } => "create_accessor",
2256        }
2257    }
2258}
2259
2260#[derive(Debug, Clone)]
2261pub struct Store2ControlHandle {
2262    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2263}
2264
2265impl fidl::endpoints::ControlHandle for Store2ControlHandle {
2266    fn shutdown(&self) {
2267        self.inner.shutdown()
2268    }
2269    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2270        self.inner.shutdown_with_epitaph(status)
2271    }
2272
2273    fn is_closed(&self) -> bool {
2274        self.inner.channel().is_closed()
2275    }
2276    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2277        self.inner.channel().on_closed()
2278    }
2279
2280    #[cfg(target_os = "fuchsia")]
2281    fn signal_peer(
2282        &self,
2283        clear_mask: zx::Signals,
2284        set_mask: zx::Signals,
2285    ) -> Result<(), zx_status::Status> {
2286        use fidl::Peered;
2287        self.inner.channel().signal_peer(clear_mask, set_mask)
2288    }
2289}
2290
2291impl Store2ControlHandle {}
2292
2293#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2294pub struct StoreAccessorMarker;
2295
2296impl fidl::endpoints::ProtocolMarker for StoreAccessorMarker {
2297    type Proxy = StoreAccessorProxy;
2298    type RequestStream = StoreAccessorRequestStream;
2299    #[cfg(target_os = "fuchsia")]
2300    type SynchronousProxy = StoreAccessorSynchronousProxy;
2301
2302    const DEBUG_NAME: &'static str = "(anonymous) StoreAccessor";
2303}
2304pub type StoreAccessorFlushResult = Result<(), FlushError>;
2305
2306pub trait StoreAccessorProxyInterface: Send + Sync {
2307    type GetValueResponseFut: std::future::Future<Output = Result<Option<Box<Value>>, fidl::Error>>
2308        + Send;
2309    fn r#get_value(&self, key: &str) -> Self::GetValueResponseFut;
2310    fn r#set_value(&self, key: &str, val: Value) -> Result<(), fidl::Error>;
2311    fn r#delete_value(&self, key: &str) -> Result<(), fidl::Error>;
2312    fn r#list_prefix(
2313        &self,
2314        prefix: &str,
2315        it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
2316    ) -> Result<(), fidl::Error>;
2317    fn r#get_prefix(
2318        &self,
2319        prefix: &str,
2320        it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
2321    ) -> Result<(), fidl::Error>;
2322    fn r#delete_prefix(&self, prefix: &str) -> Result<(), fidl::Error>;
2323    fn r#commit(&self) -> Result<(), fidl::Error>;
2324    type FlushResponseFut: std::future::Future<Output = Result<StoreAccessorFlushResult, fidl::Error>>
2325        + Send;
2326    fn r#flush(&self) -> Self::FlushResponseFut;
2327}
2328#[derive(Debug)]
2329#[cfg(target_os = "fuchsia")]
2330pub struct StoreAccessorSynchronousProxy {
2331    client: fidl::client::sync::Client,
2332}
2333
2334#[cfg(target_os = "fuchsia")]
2335impl fidl::endpoints::SynchronousProxy for StoreAccessorSynchronousProxy {
2336    type Proxy = StoreAccessorProxy;
2337    type Protocol = StoreAccessorMarker;
2338
2339    fn from_channel(inner: fidl::Channel) -> Self {
2340        Self::new(inner)
2341    }
2342
2343    fn into_channel(self) -> fidl::Channel {
2344        self.client.into_channel()
2345    }
2346
2347    fn as_channel(&self) -> &fidl::Channel {
2348        self.client.as_channel()
2349    }
2350}
2351
2352#[cfg(target_os = "fuchsia")]
2353impl StoreAccessorSynchronousProxy {
2354    pub fn new(channel: fidl::Channel) -> Self {
2355        let protocol_name = <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2356        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2357    }
2358
2359    pub fn into_channel(self) -> fidl::Channel {
2360        self.client.into_channel()
2361    }
2362
2363    /// Waits until an event arrives and returns it. It is safe for other
2364    /// threads to make concurrent requests while waiting for an event.
2365    pub fn wait_for_event(
2366        &self,
2367        deadline: zx::MonotonicInstant,
2368    ) -> Result<StoreAccessorEvent, fidl::Error> {
2369        StoreAccessorEvent::decode(self.client.wait_for_event(deadline)?)
2370    }
2371
2372    /// Gets a single value from the store.
2373    pub fn r#get_value(
2374        &self,
2375        mut key: &str,
2376        ___deadline: zx::MonotonicInstant,
2377    ) -> Result<Option<Box<Value>>, fidl::Error> {
2378        let _response =
2379            self.client.send_query::<StoreAccessorGetValueRequest, StoreAccessorGetValueResponse>(
2380                (key,),
2381                0x757e8893d1347630,
2382                fidl::encoding::DynamicFlags::empty(),
2383                ___deadline,
2384            )?;
2385        Ok(_response.val)
2386    }
2387
2388    /// Sets a single value in the store. Overwrites existing values. Commit()
2389    /// must be called for this change to take effect.
2390    pub fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
2391        self.client.send::<StoreAccessorSetValueRequest>(
2392            (key, &mut val),
2393            0x58365315c2f38e1c,
2394            fidl::encoding::DynamicFlags::empty(),
2395        )
2396    }
2397
2398    /// Deletes a single value in the store. Does nothing if the value doesn't
2399    /// exist. Commit() must be called for this change to take effect.
2400    pub fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
2401        self.client.send::<StoreAccessorDeleteValueRequest>(
2402            (key,),
2403            0x64e331813e30ec12,
2404            fidl::encoding::DynamicFlags::empty(),
2405        )
2406    }
2407
2408    /// Lists all keys under a given prefix.
2409    pub fn r#list_prefix(
2410        &self,
2411        mut prefix: &str,
2412        mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
2413    ) -> Result<(), fidl::Error> {
2414        self.client.send::<StoreAccessorListPrefixRequest>(
2415            (prefix, it),
2416            0x2e25291acf25331e,
2417            fidl::encoding::DynamicFlags::empty(),
2418        )
2419    }
2420
2421    /// Reads the values of all keys under a given prefix.
2422    pub fn r#get_prefix(
2423        &self,
2424        mut prefix: &str,
2425        mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
2426    ) -> Result<(), fidl::Error> {
2427        self.client.send::<StoreAccessorGetPrefixRequest>(
2428            (prefix, it),
2429            0x753ca25534a85c38,
2430            fidl::encoding::DynamicFlags::empty(),
2431        )
2432    }
2433
2434    /// Deletes the all keys under a given prefix.
2435    pub fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
2436        self.client.send::<StoreAccessorDeletePrefixRequest>(
2437            (prefix,),
2438            0x468405bac20649c9,
2439            fidl::encoding::DynamicFlags::empty(),
2440        )
2441    }
2442
2443    /// Atomically causes all of the state modifications that happened in this
2444    /// accessor to take place.
2445    pub fn r#commit(&self) -> Result<(), fidl::Error> {
2446        self.client.send::<fidl::encoding::EmptyPayload>(
2447            (),
2448            0x6daf402bf765768c,
2449            fidl::encoding::DynamicFlags::empty(),
2450        )
2451    }
2452
2453    /// Atomically causes all of the state modifications that happened
2454    /// in this accessor to take place, returning only when those
2455    /// modifications were written to disk.
2456    /// This operation is equivalent to Commit.
2457    /// Returns a FlushError if this operations could not be committed.
2458    pub fn r#flush(
2459        &self,
2460        ___deadline: zx::MonotonicInstant,
2461    ) -> Result<StoreAccessorFlushResult, fidl::Error> {
2462        let _response = self.client.send_query::<
2463            fidl::encoding::EmptyPayload,
2464            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>,
2465        >(
2466            (),
2467            0x463d057712847d12,
2468            fidl::encoding::DynamicFlags::empty(),
2469            ___deadline,
2470        )?;
2471        Ok(_response.map(|x| x))
2472    }
2473}
2474
2475#[cfg(target_os = "fuchsia")]
2476impl From<StoreAccessorSynchronousProxy> for zx::Handle {
2477    fn from(value: StoreAccessorSynchronousProxy) -> Self {
2478        value.into_channel().into()
2479    }
2480}
2481
2482#[cfg(target_os = "fuchsia")]
2483impl From<fidl::Channel> for StoreAccessorSynchronousProxy {
2484    fn from(value: fidl::Channel) -> Self {
2485        Self::new(value)
2486    }
2487}
2488
2489#[cfg(target_os = "fuchsia")]
2490impl fidl::endpoints::FromClient for StoreAccessorSynchronousProxy {
2491    type Protocol = StoreAccessorMarker;
2492
2493    fn from_client(value: fidl::endpoints::ClientEnd<StoreAccessorMarker>) -> Self {
2494        Self::new(value.into_channel())
2495    }
2496}
2497
2498#[derive(Debug, Clone)]
2499pub struct StoreAccessorProxy {
2500    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2501}
2502
2503impl fidl::endpoints::Proxy for StoreAccessorProxy {
2504    type Protocol = StoreAccessorMarker;
2505
2506    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2507        Self::new(inner)
2508    }
2509
2510    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2511        self.client.into_channel().map_err(|client| Self { client })
2512    }
2513
2514    fn as_channel(&self) -> &::fidl::AsyncChannel {
2515        self.client.as_channel()
2516    }
2517}
2518
2519impl StoreAccessorProxy {
2520    /// Create a new Proxy for fuchsia.stash/StoreAccessor.
2521    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2522        let protocol_name = <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2523        Self { client: fidl::client::Client::new(channel, protocol_name) }
2524    }
2525
2526    /// Get a Stream of events from the remote end of the protocol.
2527    ///
2528    /// # Panics
2529    ///
2530    /// Panics if the event stream was already taken.
2531    pub fn take_event_stream(&self) -> StoreAccessorEventStream {
2532        StoreAccessorEventStream { event_receiver: self.client.take_event_receiver() }
2533    }
2534
2535    /// Gets a single value from the store.
2536    pub fn r#get_value(
2537        &self,
2538        mut key: &str,
2539    ) -> fidl::client::QueryResponseFut<
2540        Option<Box<Value>>,
2541        fidl::encoding::DefaultFuchsiaResourceDialect,
2542    > {
2543        StoreAccessorProxyInterface::r#get_value(self, key)
2544    }
2545
2546    /// Sets a single value in the store. Overwrites existing values. Commit()
2547    /// must be called for this change to take effect.
2548    pub fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
2549        StoreAccessorProxyInterface::r#set_value(self, key, val)
2550    }
2551
2552    /// Deletes a single value in the store. Does nothing if the value doesn't
2553    /// exist. Commit() must be called for this change to take effect.
2554    pub fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
2555        StoreAccessorProxyInterface::r#delete_value(self, key)
2556    }
2557
2558    /// Lists all keys under a given prefix.
2559    pub fn r#list_prefix(
2560        &self,
2561        mut prefix: &str,
2562        mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
2563    ) -> Result<(), fidl::Error> {
2564        StoreAccessorProxyInterface::r#list_prefix(self, prefix, it)
2565    }
2566
2567    /// Reads the values of all keys under a given prefix.
2568    pub fn r#get_prefix(
2569        &self,
2570        mut prefix: &str,
2571        mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
2572    ) -> Result<(), fidl::Error> {
2573        StoreAccessorProxyInterface::r#get_prefix(self, prefix, it)
2574    }
2575
2576    /// Deletes the all keys under a given prefix.
2577    pub fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
2578        StoreAccessorProxyInterface::r#delete_prefix(self, prefix)
2579    }
2580
2581    /// Atomically causes all of the state modifications that happened in this
2582    /// accessor to take place.
2583    pub fn r#commit(&self) -> Result<(), fidl::Error> {
2584        StoreAccessorProxyInterface::r#commit(self)
2585    }
2586
2587    /// Atomically causes all of the state modifications that happened
2588    /// in this accessor to take place, returning only when those
2589    /// modifications were written to disk.
2590    /// This operation is equivalent to Commit.
2591    /// Returns a FlushError if this operations could not be committed.
2592    pub fn r#flush(
2593        &self,
2594    ) -> fidl::client::QueryResponseFut<
2595        StoreAccessorFlushResult,
2596        fidl::encoding::DefaultFuchsiaResourceDialect,
2597    > {
2598        StoreAccessorProxyInterface::r#flush(self)
2599    }
2600}
2601
2602impl StoreAccessorProxyInterface for StoreAccessorProxy {
2603    type GetValueResponseFut = fidl::client::QueryResponseFut<
2604        Option<Box<Value>>,
2605        fidl::encoding::DefaultFuchsiaResourceDialect,
2606    >;
2607    fn r#get_value(&self, mut key: &str) -> Self::GetValueResponseFut {
2608        fn _decode(
2609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2610        ) -> Result<Option<Box<Value>>, fidl::Error> {
2611            let _response = fidl::client::decode_transaction_body::<
2612                StoreAccessorGetValueResponse,
2613                fidl::encoding::DefaultFuchsiaResourceDialect,
2614                0x757e8893d1347630,
2615            >(_buf?)?;
2616            Ok(_response.val)
2617        }
2618        self.client.send_query_and_decode::<StoreAccessorGetValueRequest, Option<Box<Value>>>(
2619            (key,),
2620            0x757e8893d1347630,
2621            fidl::encoding::DynamicFlags::empty(),
2622            _decode,
2623        )
2624    }
2625
2626    fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
2627        self.client.send::<StoreAccessorSetValueRequest>(
2628            (key, &mut val),
2629            0x58365315c2f38e1c,
2630            fidl::encoding::DynamicFlags::empty(),
2631        )
2632    }
2633
2634    fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
2635        self.client.send::<StoreAccessorDeleteValueRequest>(
2636            (key,),
2637            0x64e331813e30ec12,
2638            fidl::encoding::DynamicFlags::empty(),
2639        )
2640    }
2641
2642    fn r#list_prefix(
2643        &self,
2644        mut prefix: &str,
2645        mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
2646    ) -> Result<(), fidl::Error> {
2647        self.client.send::<StoreAccessorListPrefixRequest>(
2648            (prefix, it),
2649            0x2e25291acf25331e,
2650            fidl::encoding::DynamicFlags::empty(),
2651        )
2652    }
2653
2654    fn r#get_prefix(
2655        &self,
2656        mut prefix: &str,
2657        mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
2658    ) -> Result<(), fidl::Error> {
2659        self.client.send::<StoreAccessorGetPrefixRequest>(
2660            (prefix, it),
2661            0x753ca25534a85c38,
2662            fidl::encoding::DynamicFlags::empty(),
2663        )
2664    }
2665
2666    fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
2667        self.client.send::<StoreAccessorDeletePrefixRequest>(
2668            (prefix,),
2669            0x468405bac20649c9,
2670            fidl::encoding::DynamicFlags::empty(),
2671        )
2672    }
2673
2674    fn r#commit(&self) -> Result<(), fidl::Error> {
2675        self.client.send::<fidl::encoding::EmptyPayload>(
2676            (),
2677            0x6daf402bf765768c,
2678            fidl::encoding::DynamicFlags::empty(),
2679        )
2680    }
2681
2682    type FlushResponseFut = fidl::client::QueryResponseFut<
2683        StoreAccessorFlushResult,
2684        fidl::encoding::DefaultFuchsiaResourceDialect,
2685    >;
2686    fn r#flush(&self) -> Self::FlushResponseFut {
2687        fn _decode(
2688            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2689        ) -> Result<StoreAccessorFlushResult, fidl::Error> {
2690            let _response = fidl::client::decode_transaction_body::<
2691                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>,
2692                fidl::encoding::DefaultFuchsiaResourceDialect,
2693                0x463d057712847d12,
2694            >(_buf?)?;
2695            Ok(_response.map(|x| x))
2696        }
2697        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StoreAccessorFlushResult>(
2698            (),
2699            0x463d057712847d12,
2700            fidl::encoding::DynamicFlags::empty(),
2701            _decode,
2702        )
2703    }
2704}
2705
2706pub struct StoreAccessorEventStream {
2707    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2708}
2709
2710impl std::marker::Unpin for StoreAccessorEventStream {}
2711
2712impl futures::stream::FusedStream for StoreAccessorEventStream {
2713    fn is_terminated(&self) -> bool {
2714        self.event_receiver.is_terminated()
2715    }
2716}
2717
2718impl futures::Stream for StoreAccessorEventStream {
2719    type Item = Result<StoreAccessorEvent, fidl::Error>;
2720
2721    fn poll_next(
2722        mut self: std::pin::Pin<&mut Self>,
2723        cx: &mut std::task::Context<'_>,
2724    ) -> std::task::Poll<Option<Self::Item>> {
2725        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2726            &mut self.event_receiver,
2727            cx
2728        )?) {
2729            Some(buf) => std::task::Poll::Ready(Some(StoreAccessorEvent::decode(buf))),
2730            None => std::task::Poll::Ready(None),
2731        }
2732    }
2733}
2734
2735#[derive(Debug)]
2736pub enum StoreAccessorEvent {}
2737
2738impl StoreAccessorEvent {
2739    /// Decodes a message buffer as a [`StoreAccessorEvent`].
2740    fn decode(
2741        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2742    ) -> Result<StoreAccessorEvent, fidl::Error> {
2743        let (bytes, _handles) = buf.split_mut();
2744        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2745        debug_assert_eq!(tx_header.tx_id, 0);
2746        match tx_header.ordinal {
2747            _ => Err(fidl::Error::UnknownOrdinal {
2748                ordinal: tx_header.ordinal,
2749                protocol_name: <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2750            }),
2751        }
2752    }
2753}
2754
2755/// A Stream of incoming requests for fuchsia.stash/StoreAccessor.
2756pub struct StoreAccessorRequestStream {
2757    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2758    is_terminated: bool,
2759}
2760
2761impl std::marker::Unpin for StoreAccessorRequestStream {}
2762
2763impl futures::stream::FusedStream for StoreAccessorRequestStream {
2764    fn is_terminated(&self) -> bool {
2765        self.is_terminated
2766    }
2767}
2768
2769impl fidl::endpoints::RequestStream for StoreAccessorRequestStream {
2770    type Protocol = StoreAccessorMarker;
2771    type ControlHandle = StoreAccessorControlHandle;
2772
2773    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2774        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2775    }
2776
2777    fn control_handle(&self) -> Self::ControlHandle {
2778        StoreAccessorControlHandle { inner: self.inner.clone() }
2779    }
2780
2781    fn into_inner(
2782        self,
2783    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2784    {
2785        (self.inner, self.is_terminated)
2786    }
2787
2788    fn from_inner(
2789        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2790        is_terminated: bool,
2791    ) -> Self {
2792        Self { inner, is_terminated }
2793    }
2794}
2795
2796impl futures::Stream for StoreAccessorRequestStream {
2797    type Item = Result<StoreAccessorRequest, fidl::Error>;
2798
2799    fn poll_next(
2800        mut self: std::pin::Pin<&mut Self>,
2801        cx: &mut std::task::Context<'_>,
2802    ) -> std::task::Poll<Option<Self::Item>> {
2803        let this = &mut *self;
2804        if this.inner.check_shutdown(cx) {
2805            this.is_terminated = true;
2806            return std::task::Poll::Ready(None);
2807        }
2808        if this.is_terminated {
2809            panic!("polled StoreAccessorRequestStream after completion");
2810        }
2811        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2812            |bytes, handles| {
2813                match this.inner.channel().read_etc(cx, bytes, handles) {
2814                    std::task::Poll::Ready(Ok(())) => {}
2815                    std::task::Poll::Pending => return std::task::Poll::Pending,
2816                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2817                        this.is_terminated = true;
2818                        return std::task::Poll::Ready(None);
2819                    }
2820                    std::task::Poll::Ready(Err(e)) => {
2821                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2822                            e.into(),
2823                        ))));
2824                    }
2825                }
2826
2827                // A message has been received from the channel
2828                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2829
2830                std::task::Poll::Ready(Some(match header.ordinal {
2831                    0x757e8893d1347630 => {
2832                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2833                        let mut req = fidl::new_empty!(
2834                            StoreAccessorGetValueRequest,
2835                            fidl::encoding::DefaultFuchsiaResourceDialect
2836                        );
2837                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorGetValueRequest>(&header, _body_bytes, handles, &mut req)?;
2838                        let control_handle =
2839                            StoreAccessorControlHandle { inner: this.inner.clone() };
2840                        Ok(StoreAccessorRequest::GetValue {
2841                            key: req.key,
2842
2843                            responder: StoreAccessorGetValueResponder {
2844                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2845                                tx_id: header.tx_id,
2846                            },
2847                        })
2848                    }
2849                    0x58365315c2f38e1c => {
2850                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2851                        let mut req = fidl::new_empty!(
2852                            StoreAccessorSetValueRequest,
2853                            fidl::encoding::DefaultFuchsiaResourceDialect
2854                        );
2855                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorSetValueRequest>(&header, _body_bytes, handles, &mut req)?;
2856                        let control_handle =
2857                            StoreAccessorControlHandle { inner: this.inner.clone() };
2858                        Ok(StoreAccessorRequest::SetValue {
2859                            key: req.key,
2860                            val: req.val,
2861
2862                            control_handle,
2863                        })
2864                    }
2865                    0x64e331813e30ec12 => {
2866                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2867                        let mut req = fidl::new_empty!(
2868                            StoreAccessorDeleteValueRequest,
2869                            fidl::encoding::DefaultFuchsiaResourceDialect
2870                        );
2871                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorDeleteValueRequest>(&header, _body_bytes, handles, &mut req)?;
2872                        let control_handle =
2873                            StoreAccessorControlHandle { inner: this.inner.clone() };
2874                        Ok(StoreAccessorRequest::DeleteValue { key: req.key, control_handle })
2875                    }
2876                    0x2e25291acf25331e => {
2877                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2878                        let mut req = fidl::new_empty!(
2879                            StoreAccessorListPrefixRequest,
2880                            fidl::encoding::DefaultFuchsiaResourceDialect
2881                        );
2882                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorListPrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2883                        let control_handle =
2884                            StoreAccessorControlHandle { inner: this.inner.clone() };
2885                        Ok(StoreAccessorRequest::ListPrefix {
2886                            prefix: req.prefix,
2887                            it: req.it,
2888
2889                            control_handle,
2890                        })
2891                    }
2892                    0x753ca25534a85c38 => {
2893                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2894                        let mut req = fidl::new_empty!(
2895                            StoreAccessorGetPrefixRequest,
2896                            fidl::encoding::DefaultFuchsiaResourceDialect
2897                        );
2898                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorGetPrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2899                        let control_handle =
2900                            StoreAccessorControlHandle { inner: this.inner.clone() };
2901                        Ok(StoreAccessorRequest::GetPrefix {
2902                            prefix: req.prefix,
2903                            it: req.it,
2904
2905                            control_handle,
2906                        })
2907                    }
2908                    0x468405bac20649c9 => {
2909                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2910                        let mut req = fidl::new_empty!(
2911                            StoreAccessorDeletePrefixRequest,
2912                            fidl::encoding::DefaultFuchsiaResourceDialect
2913                        );
2914                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreAccessorDeletePrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2915                        let control_handle =
2916                            StoreAccessorControlHandle { inner: this.inner.clone() };
2917                        Ok(StoreAccessorRequest::DeletePrefix {
2918                            prefix: req.prefix,
2919
2920                            control_handle,
2921                        })
2922                    }
2923                    0x6daf402bf765768c => {
2924                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2925                        let mut req = fidl::new_empty!(
2926                            fidl::encoding::EmptyPayload,
2927                            fidl::encoding::DefaultFuchsiaResourceDialect
2928                        );
2929                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2930                        let control_handle =
2931                            StoreAccessorControlHandle { inner: this.inner.clone() };
2932                        Ok(StoreAccessorRequest::Commit { control_handle })
2933                    }
2934                    0x463d057712847d12 => {
2935                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2936                        let mut req = fidl::new_empty!(
2937                            fidl::encoding::EmptyPayload,
2938                            fidl::encoding::DefaultFuchsiaResourceDialect
2939                        );
2940                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2941                        let control_handle =
2942                            StoreAccessorControlHandle { inner: this.inner.clone() };
2943                        Ok(StoreAccessorRequest::Flush {
2944                            responder: StoreAccessorFlushResponder {
2945                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2946                                tx_id: header.tx_id,
2947                            },
2948                        })
2949                    }
2950                    _ => Err(fidl::Error::UnknownOrdinal {
2951                        ordinal: header.ordinal,
2952                        protocol_name:
2953                            <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2954                    }),
2955                }))
2956            },
2957        )
2958    }
2959}
2960
2961/// The interface returned when a new accessor is created.
2962#[derive(Debug)]
2963pub enum StoreAccessorRequest {
2964    /// Gets a single value from the store.
2965    GetValue { key: String, responder: StoreAccessorGetValueResponder },
2966    /// Sets a single value in the store. Overwrites existing values. Commit()
2967    /// must be called for this change to take effect.
2968    SetValue { key: String, val: Value, control_handle: StoreAccessorControlHandle },
2969    /// Deletes a single value in the store. Does nothing if the value doesn't
2970    /// exist. Commit() must be called for this change to take effect.
2971    DeleteValue { key: String, control_handle: StoreAccessorControlHandle },
2972    /// Lists all keys under a given prefix.
2973    ListPrefix {
2974        prefix: String,
2975        it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
2976        control_handle: StoreAccessorControlHandle,
2977    },
2978    /// Reads the values of all keys under a given prefix.
2979    GetPrefix {
2980        prefix: String,
2981        it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
2982        control_handle: StoreAccessorControlHandle,
2983    },
2984    /// Deletes the all keys under a given prefix.
2985    DeletePrefix { prefix: String, control_handle: StoreAccessorControlHandle },
2986    /// Atomically causes all of the state modifications that happened in this
2987    /// accessor to take place.
2988    Commit { control_handle: StoreAccessorControlHandle },
2989    /// Atomically causes all of the state modifications that happened
2990    /// in this accessor to take place, returning only when those
2991    /// modifications were written to disk.
2992    /// This operation is equivalent to Commit.
2993    /// Returns a FlushError if this operations could not be committed.
2994    Flush { responder: StoreAccessorFlushResponder },
2995}
2996
2997impl StoreAccessorRequest {
2998    #[allow(irrefutable_let_patterns)]
2999    pub fn into_get_value(self) -> Option<(String, StoreAccessorGetValueResponder)> {
3000        if let StoreAccessorRequest::GetValue { key, responder } = self {
3001            Some((key, responder))
3002        } else {
3003            None
3004        }
3005    }
3006
3007    #[allow(irrefutable_let_patterns)]
3008    pub fn into_set_value(self) -> Option<(String, Value, StoreAccessorControlHandle)> {
3009        if let StoreAccessorRequest::SetValue { key, val, control_handle } = self {
3010            Some((key, val, control_handle))
3011        } else {
3012            None
3013        }
3014    }
3015
3016    #[allow(irrefutable_let_patterns)]
3017    pub fn into_delete_value(self) -> Option<(String, StoreAccessorControlHandle)> {
3018        if let StoreAccessorRequest::DeleteValue { key, control_handle } = self {
3019            Some((key, control_handle))
3020        } else {
3021            None
3022        }
3023    }
3024
3025    #[allow(irrefutable_let_patterns)]
3026    pub fn into_list_prefix(
3027        self,
3028    ) -> Option<(String, fidl::endpoints::ServerEnd<ListIteratorMarker>, StoreAccessorControlHandle)>
3029    {
3030        if let StoreAccessorRequest::ListPrefix { prefix, it, control_handle } = self {
3031            Some((prefix, it, control_handle))
3032        } else {
3033            None
3034        }
3035    }
3036
3037    #[allow(irrefutable_let_patterns)]
3038    pub fn into_get_prefix(
3039        self,
3040    ) -> Option<(String, fidl::endpoints::ServerEnd<GetIteratorMarker>, StoreAccessorControlHandle)>
3041    {
3042        if let StoreAccessorRequest::GetPrefix { prefix, it, control_handle } = self {
3043            Some((prefix, it, control_handle))
3044        } else {
3045            None
3046        }
3047    }
3048
3049    #[allow(irrefutable_let_patterns)]
3050    pub fn into_delete_prefix(self) -> Option<(String, StoreAccessorControlHandle)> {
3051        if let StoreAccessorRequest::DeletePrefix { prefix, control_handle } = self {
3052            Some((prefix, control_handle))
3053        } else {
3054            None
3055        }
3056    }
3057
3058    #[allow(irrefutable_let_patterns)]
3059    pub fn into_commit(self) -> Option<(StoreAccessorControlHandle)> {
3060        if let StoreAccessorRequest::Commit { control_handle } = self {
3061            Some((control_handle))
3062        } else {
3063            None
3064        }
3065    }
3066
3067    #[allow(irrefutable_let_patterns)]
3068    pub fn into_flush(self) -> Option<(StoreAccessorFlushResponder)> {
3069        if let StoreAccessorRequest::Flush { responder } = self { Some((responder)) } else { None }
3070    }
3071
3072    /// Name of the method defined in FIDL
3073    pub fn method_name(&self) -> &'static str {
3074        match *self {
3075            StoreAccessorRequest::GetValue { .. } => "get_value",
3076            StoreAccessorRequest::SetValue { .. } => "set_value",
3077            StoreAccessorRequest::DeleteValue { .. } => "delete_value",
3078            StoreAccessorRequest::ListPrefix { .. } => "list_prefix",
3079            StoreAccessorRequest::GetPrefix { .. } => "get_prefix",
3080            StoreAccessorRequest::DeletePrefix { .. } => "delete_prefix",
3081            StoreAccessorRequest::Commit { .. } => "commit",
3082            StoreAccessorRequest::Flush { .. } => "flush",
3083        }
3084    }
3085}
3086
3087#[derive(Debug, Clone)]
3088pub struct StoreAccessorControlHandle {
3089    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3090}
3091
3092impl fidl::endpoints::ControlHandle for StoreAccessorControlHandle {
3093    fn shutdown(&self) {
3094        self.inner.shutdown()
3095    }
3096    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3097        self.inner.shutdown_with_epitaph(status)
3098    }
3099
3100    fn is_closed(&self) -> bool {
3101        self.inner.channel().is_closed()
3102    }
3103    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3104        self.inner.channel().on_closed()
3105    }
3106
3107    #[cfg(target_os = "fuchsia")]
3108    fn signal_peer(
3109        &self,
3110        clear_mask: zx::Signals,
3111        set_mask: zx::Signals,
3112    ) -> Result<(), zx_status::Status> {
3113        use fidl::Peered;
3114        self.inner.channel().signal_peer(clear_mask, set_mask)
3115    }
3116}
3117
3118impl StoreAccessorControlHandle {}
3119
3120#[must_use = "FIDL methods require a response to be sent"]
3121#[derive(Debug)]
3122pub struct StoreAccessorGetValueResponder {
3123    control_handle: std::mem::ManuallyDrop<StoreAccessorControlHandle>,
3124    tx_id: u32,
3125}
3126
3127/// Set the the channel to be shutdown (see [`StoreAccessorControlHandle::shutdown`])
3128/// if the responder is dropped without sending a response, so that the client
3129/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3130impl std::ops::Drop for StoreAccessorGetValueResponder {
3131    fn drop(&mut self) {
3132        self.control_handle.shutdown();
3133        // Safety: drops once, never accessed again
3134        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3135    }
3136}
3137
3138impl fidl::endpoints::Responder for StoreAccessorGetValueResponder {
3139    type ControlHandle = StoreAccessorControlHandle;
3140
3141    fn control_handle(&self) -> &StoreAccessorControlHandle {
3142        &self.control_handle
3143    }
3144
3145    fn drop_without_shutdown(mut self) {
3146        // Safety: drops once, never accessed again due to mem::forget
3147        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3148        // Prevent Drop from running (which would shut down the channel)
3149        std::mem::forget(self);
3150    }
3151}
3152
3153impl StoreAccessorGetValueResponder {
3154    /// Sends a response to the FIDL transaction.
3155    ///
3156    /// Sets the channel to shutdown if an error occurs.
3157    pub fn send(self, mut val: Option<Value>) -> Result<(), fidl::Error> {
3158        let _result = self.send_raw(val);
3159        if _result.is_err() {
3160            self.control_handle.shutdown();
3161        }
3162        self.drop_without_shutdown();
3163        _result
3164    }
3165
3166    /// Similar to "send" but does not shutdown the channel if an error occurs.
3167    pub fn send_no_shutdown_on_err(self, mut val: Option<Value>) -> Result<(), fidl::Error> {
3168        let _result = self.send_raw(val);
3169        self.drop_without_shutdown();
3170        _result
3171    }
3172
3173    fn send_raw(&self, mut val: Option<Value>) -> Result<(), fidl::Error> {
3174        self.control_handle.inner.send::<StoreAccessorGetValueResponse>(
3175            (val.as_mut(),),
3176            self.tx_id,
3177            0x757e8893d1347630,
3178            fidl::encoding::DynamicFlags::empty(),
3179        )
3180    }
3181}
3182
3183#[must_use = "FIDL methods require a response to be sent"]
3184#[derive(Debug)]
3185pub struct StoreAccessorFlushResponder {
3186    control_handle: std::mem::ManuallyDrop<StoreAccessorControlHandle>,
3187    tx_id: u32,
3188}
3189
3190/// Set the the channel to be shutdown (see [`StoreAccessorControlHandle::shutdown`])
3191/// if the responder is dropped without sending a response, so that the client
3192/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3193impl std::ops::Drop for StoreAccessorFlushResponder {
3194    fn drop(&mut self) {
3195        self.control_handle.shutdown();
3196        // Safety: drops once, never accessed again
3197        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3198    }
3199}
3200
3201impl fidl::endpoints::Responder for StoreAccessorFlushResponder {
3202    type ControlHandle = StoreAccessorControlHandle;
3203
3204    fn control_handle(&self) -> &StoreAccessorControlHandle {
3205        &self.control_handle
3206    }
3207
3208    fn drop_without_shutdown(mut self) {
3209        // Safety: drops once, never accessed again due to mem::forget
3210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3211        // Prevent Drop from running (which would shut down the channel)
3212        std::mem::forget(self);
3213    }
3214}
3215
3216impl StoreAccessorFlushResponder {
3217    /// Sends a response to the FIDL transaction.
3218    ///
3219    /// Sets the channel to shutdown if an error occurs.
3220    pub fn send(self, mut result: Result<(), FlushError>) -> Result<(), fidl::Error> {
3221        let _result = self.send_raw(result);
3222        if _result.is_err() {
3223            self.control_handle.shutdown();
3224        }
3225        self.drop_without_shutdown();
3226        _result
3227    }
3228
3229    /// Similar to "send" but does not shutdown the channel if an error occurs.
3230    pub fn send_no_shutdown_on_err(
3231        self,
3232        mut result: Result<(), FlushError>,
3233    ) -> Result<(), fidl::Error> {
3234        let _result = self.send_raw(result);
3235        self.drop_without_shutdown();
3236        _result
3237    }
3238
3239    fn send_raw(&self, mut result: Result<(), FlushError>) -> Result<(), fidl::Error> {
3240        self.control_handle
3241            .inner
3242            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>>(
3243                result,
3244                self.tx_id,
3245                0x463d057712847d12,
3246                fidl::encoding::DynamicFlags::empty(),
3247            )
3248    }
3249}
3250
3251mod internal {
3252    use super::*;
3253
3254    impl fidl::encoding::ResourceTypeMarker for GetIteratorGetNextResponse {
3255        type Borrowed<'a> = &'a mut Self;
3256        fn take_or_borrow<'a>(
3257            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3258        ) -> Self::Borrowed<'a> {
3259            value
3260        }
3261    }
3262
3263    unsafe impl fidl::encoding::TypeMarker for GetIteratorGetNextResponse {
3264        type Owned = Self;
3265
3266        #[inline(always)]
3267        fn inline_align(_context: fidl::encoding::Context) -> usize {
3268            8
3269        }
3270
3271        #[inline(always)]
3272        fn inline_size(_context: fidl::encoding::Context) -> usize {
3273            16
3274        }
3275    }
3276
3277    unsafe impl
3278        fidl::encoding::Encode<
3279            GetIteratorGetNextResponse,
3280            fidl::encoding::DefaultFuchsiaResourceDialect,
3281        > for &mut GetIteratorGetNextResponse
3282    {
3283        #[inline]
3284        unsafe fn encode(
3285            self,
3286            encoder: &mut fidl::encoding::Encoder<
3287                '_,
3288                fidl::encoding::DefaultFuchsiaResourceDialect,
3289            >,
3290            offset: usize,
3291            _depth: fidl::encoding::Depth,
3292        ) -> fidl::Result<()> {
3293            encoder.debug_check_bounds::<GetIteratorGetNextResponse>(offset);
3294            // Delegate to tuple encoding.
3295            fidl::encoding::Encode::<GetIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3296                (
3297                    <fidl::encoding::UnboundedVector<KeyValue> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kvs),
3298                ),
3299                encoder, offset, _depth
3300            )
3301        }
3302    }
3303    unsafe impl<
3304        T0: fidl::encoding::Encode<
3305                fidl::encoding::UnboundedVector<KeyValue>,
3306                fidl::encoding::DefaultFuchsiaResourceDialect,
3307            >,
3308    >
3309        fidl::encoding::Encode<
3310            GetIteratorGetNextResponse,
3311            fidl::encoding::DefaultFuchsiaResourceDialect,
3312        > for (T0,)
3313    {
3314        #[inline]
3315        unsafe fn encode(
3316            self,
3317            encoder: &mut fidl::encoding::Encoder<
3318                '_,
3319                fidl::encoding::DefaultFuchsiaResourceDialect,
3320            >,
3321            offset: usize,
3322            depth: fidl::encoding::Depth,
3323        ) -> fidl::Result<()> {
3324            encoder.debug_check_bounds::<GetIteratorGetNextResponse>(offset);
3325            // Zero out padding regions. There's no need to apply masks
3326            // because the unmasked parts will be overwritten by fields.
3327            // Write the fields.
3328            self.0.encode(encoder, offset + 0, depth)?;
3329            Ok(())
3330        }
3331    }
3332
3333    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3334        for GetIteratorGetNextResponse
3335    {
3336        #[inline(always)]
3337        fn new_empty() -> Self {
3338            Self {
3339                kvs: fidl::new_empty!(
3340                    fidl::encoding::UnboundedVector<KeyValue>,
3341                    fidl::encoding::DefaultFuchsiaResourceDialect
3342                ),
3343            }
3344        }
3345
3346        #[inline]
3347        unsafe fn decode(
3348            &mut self,
3349            decoder: &mut fidl::encoding::Decoder<
3350                '_,
3351                fidl::encoding::DefaultFuchsiaResourceDialect,
3352            >,
3353            offset: usize,
3354            _depth: fidl::encoding::Depth,
3355        ) -> fidl::Result<()> {
3356            decoder.debug_check_bounds::<Self>(offset);
3357            // Verify that padding bytes are zero.
3358            fidl::decode!(
3359                fidl::encoding::UnboundedVector<KeyValue>,
3360                fidl::encoding::DefaultFuchsiaResourceDialect,
3361                &mut self.kvs,
3362                decoder,
3363                offset + 0,
3364                _depth
3365            )?;
3366            Ok(())
3367        }
3368    }
3369
3370    impl fidl::encoding::ResourceTypeMarker for KeyValue {
3371        type Borrowed<'a> = &'a mut Self;
3372        fn take_or_borrow<'a>(
3373            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3374        ) -> Self::Borrowed<'a> {
3375            value
3376        }
3377    }
3378
3379    unsafe impl fidl::encoding::TypeMarker for KeyValue {
3380        type Owned = Self;
3381
3382        #[inline(always)]
3383        fn inline_align(_context: fidl::encoding::Context) -> usize {
3384            8
3385        }
3386
3387        #[inline(always)]
3388        fn inline_size(_context: fidl::encoding::Context) -> usize {
3389            32
3390        }
3391    }
3392
3393    unsafe impl fidl::encoding::Encode<KeyValue, fidl::encoding::DefaultFuchsiaResourceDialect>
3394        for &mut KeyValue
3395    {
3396        #[inline]
3397        unsafe fn encode(
3398            self,
3399            encoder: &mut fidl::encoding::Encoder<
3400                '_,
3401                fidl::encoding::DefaultFuchsiaResourceDialect,
3402            >,
3403            offset: usize,
3404            _depth: fidl::encoding::Depth,
3405        ) -> fidl::Result<()> {
3406            encoder.debug_check_bounds::<KeyValue>(offset);
3407            // Delegate to tuple encoding.
3408            fidl::encoding::Encode::<KeyValue, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3409                (
3410                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
3411                    <Value as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
3412                ),
3413                encoder, offset, _depth
3414            )
3415        }
3416    }
3417    unsafe impl<
3418        T0: fidl::encoding::Encode<
3419                fidl::encoding::BoundedString<256>,
3420                fidl::encoding::DefaultFuchsiaResourceDialect,
3421            >,
3422        T1: fidl::encoding::Encode<Value, fidl::encoding::DefaultFuchsiaResourceDialect>,
3423    > fidl::encoding::Encode<KeyValue, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
3424    {
3425        #[inline]
3426        unsafe fn encode(
3427            self,
3428            encoder: &mut fidl::encoding::Encoder<
3429                '_,
3430                fidl::encoding::DefaultFuchsiaResourceDialect,
3431            >,
3432            offset: usize,
3433            depth: fidl::encoding::Depth,
3434        ) -> fidl::Result<()> {
3435            encoder.debug_check_bounds::<KeyValue>(offset);
3436            // Zero out padding regions. There's no need to apply masks
3437            // because the unmasked parts will be overwritten by fields.
3438            // Write the fields.
3439            self.0.encode(encoder, offset + 0, depth)?;
3440            self.1.encode(encoder, offset + 16, depth)?;
3441            Ok(())
3442        }
3443    }
3444
3445    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for KeyValue {
3446        #[inline(always)]
3447        fn new_empty() -> Self {
3448            Self {
3449                key: fidl::new_empty!(
3450                    fidl::encoding::BoundedString<256>,
3451                    fidl::encoding::DefaultFuchsiaResourceDialect
3452                ),
3453                val: fidl::new_empty!(Value, fidl::encoding::DefaultFuchsiaResourceDialect),
3454            }
3455        }
3456
3457        #[inline]
3458        unsafe fn decode(
3459            &mut self,
3460            decoder: &mut fidl::encoding::Decoder<
3461                '_,
3462                fidl::encoding::DefaultFuchsiaResourceDialect,
3463            >,
3464            offset: usize,
3465            _depth: fidl::encoding::Depth,
3466        ) -> fidl::Result<()> {
3467            decoder.debug_check_bounds::<Self>(offset);
3468            // Verify that padding bytes are zero.
3469            fidl::decode!(
3470                fidl::encoding::BoundedString<256>,
3471                fidl::encoding::DefaultFuchsiaResourceDialect,
3472                &mut self.key,
3473                decoder,
3474                offset + 0,
3475                _depth
3476            )?;
3477            fidl::decode!(
3478                Value,
3479                fidl::encoding::DefaultFuchsiaResourceDialect,
3480                &mut self.val,
3481                decoder,
3482                offset + 16,
3483                _depth
3484            )?;
3485            Ok(())
3486        }
3487    }
3488
3489    impl fidl::encoding::ResourceTypeMarker for StoreAccessorGetPrefixRequest {
3490        type Borrowed<'a> = &'a mut Self;
3491        fn take_or_borrow<'a>(
3492            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3493        ) -> Self::Borrowed<'a> {
3494            value
3495        }
3496    }
3497
3498    unsafe impl fidl::encoding::TypeMarker for StoreAccessorGetPrefixRequest {
3499        type Owned = Self;
3500
3501        #[inline(always)]
3502        fn inline_align(_context: fidl::encoding::Context) -> usize {
3503            8
3504        }
3505
3506        #[inline(always)]
3507        fn inline_size(_context: fidl::encoding::Context) -> usize {
3508            24
3509        }
3510    }
3511
3512    unsafe impl
3513        fidl::encoding::Encode<
3514            StoreAccessorGetPrefixRequest,
3515            fidl::encoding::DefaultFuchsiaResourceDialect,
3516        > for &mut StoreAccessorGetPrefixRequest
3517    {
3518        #[inline]
3519        unsafe fn encode(
3520            self,
3521            encoder: &mut fidl::encoding::Encoder<
3522                '_,
3523                fidl::encoding::DefaultFuchsiaResourceDialect,
3524            >,
3525            offset: usize,
3526            _depth: fidl::encoding::Depth,
3527        ) -> fidl::Result<()> {
3528            encoder.debug_check_bounds::<StoreAccessorGetPrefixRequest>(offset);
3529            // Delegate to tuple encoding.
3530            fidl::encoding::Encode::<StoreAccessorGetPrefixRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3531                (
3532                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
3533                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
3534                ),
3535                encoder, offset, _depth
3536            )
3537        }
3538    }
3539    unsafe impl<
3540        T0: fidl::encoding::Encode<
3541                fidl::encoding::BoundedString<256>,
3542                fidl::encoding::DefaultFuchsiaResourceDialect,
3543            >,
3544        T1: fidl::encoding::Encode<
3545                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>,
3546                fidl::encoding::DefaultFuchsiaResourceDialect,
3547            >,
3548    >
3549        fidl::encoding::Encode<
3550            StoreAccessorGetPrefixRequest,
3551            fidl::encoding::DefaultFuchsiaResourceDialect,
3552        > for (T0, T1)
3553    {
3554        #[inline]
3555        unsafe fn encode(
3556            self,
3557            encoder: &mut fidl::encoding::Encoder<
3558                '_,
3559                fidl::encoding::DefaultFuchsiaResourceDialect,
3560            >,
3561            offset: usize,
3562            depth: fidl::encoding::Depth,
3563        ) -> fidl::Result<()> {
3564            encoder.debug_check_bounds::<StoreAccessorGetPrefixRequest>(offset);
3565            // Zero out padding regions. There's no need to apply masks
3566            // because the unmasked parts will be overwritten by fields.
3567            unsafe {
3568                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3569                (ptr as *mut u64).write_unaligned(0);
3570            }
3571            // Write the fields.
3572            self.0.encode(encoder, offset + 0, depth)?;
3573            self.1.encode(encoder, offset + 16, depth)?;
3574            Ok(())
3575        }
3576    }
3577
3578    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3579        for StoreAccessorGetPrefixRequest
3580    {
3581        #[inline(always)]
3582        fn new_empty() -> Self {
3583            Self {
3584                prefix: fidl::new_empty!(
3585                    fidl::encoding::BoundedString<256>,
3586                    fidl::encoding::DefaultFuchsiaResourceDialect
3587                ),
3588                it: fidl::new_empty!(
3589                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>,
3590                    fidl::encoding::DefaultFuchsiaResourceDialect
3591                ),
3592            }
3593        }
3594
3595        #[inline]
3596        unsafe fn decode(
3597            &mut self,
3598            decoder: &mut fidl::encoding::Decoder<
3599                '_,
3600                fidl::encoding::DefaultFuchsiaResourceDialect,
3601            >,
3602            offset: usize,
3603            _depth: fidl::encoding::Depth,
3604        ) -> fidl::Result<()> {
3605            decoder.debug_check_bounds::<Self>(offset);
3606            // Verify that padding bytes are zero.
3607            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3608            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3609            let mask = 0xffffffff00000000u64;
3610            let maskedval = padval & mask;
3611            if maskedval != 0 {
3612                return Err(fidl::Error::NonZeroPadding {
3613                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3614                });
3615            }
3616            fidl::decode!(
3617                fidl::encoding::BoundedString<256>,
3618                fidl::encoding::DefaultFuchsiaResourceDialect,
3619                &mut self.prefix,
3620                decoder,
3621                offset + 0,
3622                _depth
3623            )?;
3624            fidl::decode!(
3625                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>,
3626                fidl::encoding::DefaultFuchsiaResourceDialect,
3627                &mut self.it,
3628                decoder,
3629                offset + 16,
3630                _depth
3631            )?;
3632            Ok(())
3633        }
3634    }
3635
3636    impl fidl::encoding::ResourceTypeMarker for StoreAccessorGetValueResponse {
3637        type Borrowed<'a> = &'a mut Self;
3638        fn take_or_borrow<'a>(
3639            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3640        ) -> Self::Borrowed<'a> {
3641            value
3642        }
3643    }
3644
3645    unsafe impl fidl::encoding::TypeMarker for StoreAccessorGetValueResponse {
3646        type Owned = Self;
3647
3648        #[inline(always)]
3649        fn inline_align(_context: fidl::encoding::Context) -> usize {
3650            8
3651        }
3652
3653        #[inline(always)]
3654        fn inline_size(_context: fidl::encoding::Context) -> usize {
3655            16
3656        }
3657    }
3658
3659    unsafe impl
3660        fidl::encoding::Encode<
3661            StoreAccessorGetValueResponse,
3662            fidl::encoding::DefaultFuchsiaResourceDialect,
3663        > for &mut StoreAccessorGetValueResponse
3664    {
3665        #[inline]
3666        unsafe fn encode(
3667            self,
3668            encoder: &mut fidl::encoding::Encoder<
3669                '_,
3670                fidl::encoding::DefaultFuchsiaResourceDialect,
3671            >,
3672            offset: usize,
3673            _depth: fidl::encoding::Depth,
3674        ) -> fidl::Result<()> {
3675            encoder.debug_check_bounds::<StoreAccessorGetValueResponse>(offset);
3676            // Delegate to tuple encoding.
3677            fidl::encoding::Encode::<StoreAccessorGetValueResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3678                (
3679                    <fidl::encoding::OptionalUnion<Value> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
3680                ),
3681                encoder, offset, _depth
3682            )
3683        }
3684    }
3685    unsafe impl<
3686        T0: fidl::encoding::Encode<
3687                fidl::encoding::OptionalUnion<Value>,
3688                fidl::encoding::DefaultFuchsiaResourceDialect,
3689            >,
3690    >
3691        fidl::encoding::Encode<
3692            StoreAccessorGetValueResponse,
3693            fidl::encoding::DefaultFuchsiaResourceDialect,
3694        > for (T0,)
3695    {
3696        #[inline]
3697        unsafe fn encode(
3698            self,
3699            encoder: &mut fidl::encoding::Encoder<
3700                '_,
3701                fidl::encoding::DefaultFuchsiaResourceDialect,
3702            >,
3703            offset: usize,
3704            depth: fidl::encoding::Depth,
3705        ) -> fidl::Result<()> {
3706            encoder.debug_check_bounds::<StoreAccessorGetValueResponse>(offset);
3707            // Zero out padding regions. There's no need to apply masks
3708            // because the unmasked parts will be overwritten by fields.
3709            // Write the fields.
3710            self.0.encode(encoder, offset + 0, depth)?;
3711            Ok(())
3712        }
3713    }
3714
3715    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3716        for StoreAccessorGetValueResponse
3717    {
3718        #[inline(always)]
3719        fn new_empty() -> Self {
3720            Self {
3721                val: fidl::new_empty!(
3722                    fidl::encoding::OptionalUnion<Value>,
3723                    fidl::encoding::DefaultFuchsiaResourceDialect
3724                ),
3725            }
3726        }
3727
3728        #[inline]
3729        unsafe fn decode(
3730            &mut self,
3731            decoder: &mut fidl::encoding::Decoder<
3732                '_,
3733                fidl::encoding::DefaultFuchsiaResourceDialect,
3734            >,
3735            offset: usize,
3736            _depth: fidl::encoding::Depth,
3737        ) -> fidl::Result<()> {
3738            decoder.debug_check_bounds::<Self>(offset);
3739            // Verify that padding bytes are zero.
3740            fidl::decode!(
3741                fidl::encoding::OptionalUnion<Value>,
3742                fidl::encoding::DefaultFuchsiaResourceDialect,
3743                &mut self.val,
3744                decoder,
3745                offset + 0,
3746                _depth
3747            )?;
3748            Ok(())
3749        }
3750    }
3751
3752    impl fidl::encoding::ResourceTypeMarker for StoreAccessorListPrefixRequest {
3753        type Borrowed<'a> = &'a mut Self;
3754        fn take_or_borrow<'a>(
3755            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3756        ) -> Self::Borrowed<'a> {
3757            value
3758        }
3759    }
3760
3761    unsafe impl fidl::encoding::TypeMarker for StoreAccessorListPrefixRequest {
3762        type Owned = Self;
3763
3764        #[inline(always)]
3765        fn inline_align(_context: fidl::encoding::Context) -> usize {
3766            8
3767        }
3768
3769        #[inline(always)]
3770        fn inline_size(_context: fidl::encoding::Context) -> usize {
3771            24
3772        }
3773    }
3774
3775    unsafe impl
3776        fidl::encoding::Encode<
3777            StoreAccessorListPrefixRequest,
3778            fidl::encoding::DefaultFuchsiaResourceDialect,
3779        > for &mut StoreAccessorListPrefixRequest
3780    {
3781        #[inline]
3782        unsafe fn encode(
3783            self,
3784            encoder: &mut fidl::encoding::Encoder<
3785                '_,
3786                fidl::encoding::DefaultFuchsiaResourceDialect,
3787            >,
3788            offset: usize,
3789            _depth: fidl::encoding::Depth,
3790        ) -> fidl::Result<()> {
3791            encoder.debug_check_bounds::<StoreAccessorListPrefixRequest>(offset);
3792            // Delegate to tuple encoding.
3793            fidl::encoding::Encode::<StoreAccessorListPrefixRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3794                (
3795                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
3796                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
3797                ),
3798                encoder, offset, _depth
3799            )
3800        }
3801    }
3802    unsafe impl<
3803        T0: fidl::encoding::Encode<
3804                fidl::encoding::BoundedString<256>,
3805                fidl::encoding::DefaultFuchsiaResourceDialect,
3806            >,
3807        T1: fidl::encoding::Encode<
3808                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>,
3809                fidl::encoding::DefaultFuchsiaResourceDialect,
3810            >,
3811    >
3812        fidl::encoding::Encode<
3813            StoreAccessorListPrefixRequest,
3814            fidl::encoding::DefaultFuchsiaResourceDialect,
3815        > for (T0, T1)
3816    {
3817        #[inline]
3818        unsafe fn encode(
3819            self,
3820            encoder: &mut fidl::encoding::Encoder<
3821                '_,
3822                fidl::encoding::DefaultFuchsiaResourceDialect,
3823            >,
3824            offset: usize,
3825            depth: fidl::encoding::Depth,
3826        ) -> fidl::Result<()> {
3827            encoder.debug_check_bounds::<StoreAccessorListPrefixRequest>(offset);
3828            // Zero out padding regions. There's no need to apply masks
3829            // because the unmasked parts will be overwritten by fields.
3830            unsafe {
3831                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3832                (ptr as *mut u64).write_unaligned(0);
3833            }
3834            // Write the fields.
3835            self.0.encode(encoder, offset + 0, depth)?;
3836            self.1.encode(encoder, offset + 16, depth)?;
3837            Ok(())
3838        }
3839    }
3840
3841    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3842        for StoreAccessorListPrefixRequest
3843    {
3844        #[inline(always)]
3845        fn new_empty() -> Self {
3846            Self {
3847                prefix: fidl::new_empty!(
3848                    fidl::encoding::BoundedString<256>,
3849                    fidl::encoding::DefaultFuchsiaResourceDialect
3850                ),
3851                it: fidl::new_empty!(
3852                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>,
3853                    fidl::encoding::DefaultFuchsiaResourceDialect
3854                ),
3855            }
3856        }
3857
3858        #[inline]
3859        unsafe fn decode(
3860            &mut self,
3861            decoder: &mut fidl::encoding::Decoder<
3862                '_,
3863                fidl::encoding::DefaultFuchsiaResourceDialect,
3864            >,
3865            offset: usize,
3866            _depth: fidl::encoding::Depth,
3867        ) -> fidl::Result<()> {
3868            decoder.debug_check_bounds::<Self>(offset);
3869            // Verify that padding bytes are zero.
3870            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3871            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3872            let mask = 0xffffffff00000000u64;
3873            let maskedval = padval & mask;
3874            if maskedval != 0 {
3875                return Err(fidl::Error::NonZeroPadding {
3876                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3877                });
3878            }
3879            fidl::decode!(
3880                fidl::encoding::BoundedString<256>,
3881                fidl::encoding::DefaultFuchsiaResourceDialect,
3882                &mut self.prefix,
3883                decoder,
3884                offset + 0,
3885                _depth
3886            )?;
3887            fidl::decode!(
3888                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>,
3889                fidl::encoding::DefaultFuchsiaResourceDialect,
3890                &mut self.it,
3891                decoder,
3892                offset + 16,
3893                _depth
3894            )?;
3895            Ok(())
3896        }
3897    }
3898
3899    impl fidl::encoding::ResourceTypeMarker for StoreAccessorSetValueRequest {
3900        type Borrowed<'a> = &'a mut Self;
3901        fn take_or_borrow<'a>(
3902            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3903        ) -> Self::Borrowed<'a> {
3904            value
3905        }
3906    }
3907
3908    unsafe impl fidl::encoding::TypeMarker for StoreAccessorSetValueRequest {
3909        type Owned = Self;
3910
3911        #[inline(always)]
3912        fn inline_align(_context: fidl::encoding::Context) -> usize {
3913            8
3914        }
3915
3916        #[inline(always)]
3917        fn inline_size(_context: fidl::encoding::Context) -> usize {
3918            32
3919        }
3920    }
3921
3922    unsafe impl
3923        fidl::encoding::Encode<
3924            StoreAccessorSetValueRequest,
3925            fidl::encoding::DefaultFuchsiaResourceDialect,
3926        > for &mut StoreAccessorSetValueRequest
3927    {
3928        #[inline]
3929        unsafe fn encode(
3930            self,
3931            encoder: &mut fidl::encoding::Encoder<
3932                '_,
3933                fidl::encoding::DefaultFuchsiaResourceDialect,
3934            >,
3935            offset: usize,
3936            _depth: fidl::encoding::Depth,
3937        ) -> fidl::Result<()> {
3938            encoder.debug_check_bounds::<StoreAccessorSetValueRequest>(offset);
3939            // Delegate to tuple encoding.
3940            fidl::encoding::Encode::<
3941                StoreAccessorSetValueRequest,
3942                fidl::encoding::DefaultFuchsiaResourceDialect,
3943            >::encode(
3944                (
3945                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
3946                        &self.key,
3947                    ),
3948                    <Value as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
3949                ),
3950                encoder,
3951                offset,
3952                _depth,
3953            )
3954        }
3955    }
3956    unsafe impl<
3957        T0: fidl::encoding::Encode<
3958                fidl::encoding::BoundedString<256>,
3959                fidl::encoding::DefaultFuchsiaResourceDialect,
3960            >,
3961        T1: fidl::encoding::Encode<Value, fidl::encoding::DefaultFuchsiaResourceDialect>,
3962    >
3963        fidl::encoding::Encode<
3964            StoreAccessorSetValueRequest,
3965            fidl::encoding::DefaultFuchsiaResourceDialect,
3966        > for (T0, T1)
3967    {
3968        #[inline]
3969        unsafe fn encode(
3970            self,
3971            encoder: &mut fidl::encoding::Encoder<
3972                '_,
3973                fidl::encoding::DefaultFuchsiaResourceDialect,
3974            >,
3975            offset: usize,
3976            depth: fidl::encoding::Depth,
3977        ) -> fidl::Result<()> {
3978            encoder.debug_check_bounds::<StoreAccessorSetValueRequest>(offset);
3979            // Zero out padding regions. There's no need to apply masks
3980            // because the unmasked parts will be overwritten by fields.
3981            // Write the fields.
3982            self.0.encode(encoder, offset + 0, depth)?;
3983            self.1.encode(encoder, offset + 16, depth)?;
3984            Ok(())
3985        }
3986    }
3987
3988    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3989        for StoreAccessorSetValueRequest
3990    {
3991        #[inline(always)]
3992        fn new_empty() -> Self {
3993            Self {
3994                key: fidl::new_empty!(
3995                    fidl::encoding::BoundedString<256>,
3996                    fidl::encoding::DefaultFuchsiaResourceDialect
3997                ),
3998                val: fidl::new_empty!(Value, fidl::encoding::DefaultFuchsiaResourceDialect),
3999            }
4000        }
4001
4002        #[inline]
4003        unsafe fn decode(
4004            &mut self,
4005            decoder: &mut fidl::encoding::Decoder<
4006                '_,
4007                fidl::encoding::DefaultFuchsiaResourceDialect,
4008            >,
4009            offset: usize,
4010            _depth: fidl::encoding::Depth,
4011        ) -> fidl::Result<()> {
4012            decoder.debug_check_bounds::<Self>(offset);
4013            // Verify that padding bytes are zero.
4014            fidl::decode!(
4015                fidl::encoding::BoundedString<256>,
4016                fidl::encoding::DefaultFuchsiaResourceDialect,
4017                &mut self.key,
4018                decoder,
4019                offset + 0,
4020                _depth
4021            )?;
4022            fidl::decode!(
4023                Value,
4024                fidl::encoding::DefaultFuchsiaResourceDialect,
4025                &mut self.val,
4026                decoder,
4027                offset + 16,
4028                _depth
4029            )?;
4030            Ok(())
4031        }
4032    }
4033
4034    impl fidl::encoding::ResourceTypeMarker for StoreCreateAccessorRequest {
4035        type Borrowed<'a> = &'a mut Self;
4036        fn take_or_borrow<'a>(
4037            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4038        ) -> Self::Borrowed<'a> {
4039            value
4040        }
4041    }
4042
4043    unsafe impl fidl::encoding::TypeMarker for StoreCreateAccessorRequest {
4044        type Owned = Self;
4045
4046        #[inline(always)]
4047        fn inline_align(_context: fidl::encoding::Context) -> usize {
4048            4
4049        }
4050
4051        #[inline(always)]
4052        fn inline_size(_context: fidl::encoding::Context) -> usize {
4053            8
4054        }
4055    }
4056
4057    unsafe impl
4058        fidl::encoding::Encode<
4059            StoreCreateAccessorRequest,
4060            fidl::encoding::DefaultFuchsiaResourceDialect,
4061        > for &mut StoreCreateAccessorRequest
4062    {
4063        #[inline]
4064        unsafe fn encode(
4065            self,
4066            encoder: &mut fidl::encoding::Encoder<
4067                '_,
4068                fidl::encoding::DefaultFuchsiaResourceDialect,
4069            >,
4070            offset: usize,
4071            _depth: fidl::encoding::Depth,
4072        ) -> fidl::Result<()> {
4073            encoder.debug_check_bounds::<StoreCreateAccessorRequest>(offset);
4074            // Delegate to tuple encoding.
4075            fidl::encoding::Encode::<StoreCreateAccessorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4076                (
4077                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.read_only),
4078                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.accessor_request),
4079                ),
4080                encoder, offset, _depth
4081            )
4082        }
4083    }
4084    unsafe impl<
4085        T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
4086        T1: fidl::encoding::Encode<
4087                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>,
4088                fidl::encoding::DefaultFuchsiaResourceDialect,
4089            >,
4090    >
4091        fidl::encoding::Encode<
4092            StoreCreateAccessorRequest,
4093            fidl::encoding::DefaultFuchsiaResourceDialect,
4094        > for (T0, T1)
4095    {
4096        #[inline]
4097        unsafe fn encode(
4098            self,
4099            encoder: &mut fidl::encoding::Encoder<
4100                '_,
4101                fidl::encoding::DefaultFuchsiaResourceDialect,
4102            >,
4103            offset: usize,
4104            depth: fidl::encoding::Depth,
4105        ) -> fidl::Result<()> {
4106            encoder.debug_check_bounds::<StoreCreateAccessorRequest>(offset);
4107            // Zero out padding regions. There's no need to apply masks
4108            // because the unmasked parts will be overwritten by fields.
4109            unsafe {
4110                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4111                (ptr as *mut u32).write_unaligned(0);
4112            }
4113            // Write the fields.
4114            self.0.encode(encoder, offset + 0, depth)?;
4115            self.1.encode(encoder, offset + 4, depth)?;
4116            Ok(())
4117        }
4118    }
4119
4120    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4121        for StoreCreateAccessorRequest
4122    {
4123        #[inline(always)]
4124        fn new_empty() -> Self {
4125            Self {
4126                read_only: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
4127                accessor_request: fidl::new_empty!(
4128                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>,
4129                    fidl::encoding::DefaultFuchsiaResourceDialect
4130                ),
4131            }
4132        }
4133
4134        #[inline]
4135        unsafe fn decode(
4136            &mut self,
4137            decoder: &mut fidl::encoding::Decoder<
4138                '_,
4139                fidl::encoding::DefaultFuchsiaResourceDialect,
4140            >,
4141            offset: usize,
4142            _depth: fidl::encoding::Depth,
4143        ) -> fidl::Result<()> {
4144            decoder.debug_check_bounds::<Self>(offset);
4145            // Verify that padding bytes are zero.
4146            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4147            let padval = unsafe { (ptr as *const u32).read_unaligned() };
4148            let mask = 0xffffff00u32;
4149            let maskedval = padval & mask;
4150            if maskedval != 0 {
4151                return Err(fidl::Error::NonZeroPadding {
4152                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4153                });
4154            }
4155            fidl::decode!(
4156                bool,
4157                fidl::encoding::DefaultFuchsiaResourceDialect,
4158                &mut self.read_only,
4159                decoder,
4160                offset + 0,
4161                _depth
4162            )?;
4163            fidl::decode!(
4164                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>,
4165                fidl::encoding::DefaultFuchsiaResourceDialect,
4166                &mut self.accessor_request,
4167                decoder,
4168                offset + 4,
4169                _depth
4170            )?;
4171            Ok(())
4172        }
4173    }
4174
4175    impl fidl::encoding::ResourceTypeMarker for Value {
4176        type Borrowed<'a> = &'a mut Self;
4177        fn take_or_borrow<'a>(
4178            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4179        ) -> Self::Borrowed<'a> {
4180            value
4181        }
4182    }
4183
4184    unsafe impl fidl::encoding::TypeMarker for Value {
4185        type Owned = Self;
4186
4187        #[inline(always)]
4188        fn inline_align(_context: fidl::encoding::Context) -> usize {
4189            8
4190        }
4191
4192        #[inline(always)]
4193        fn inline_size(_context: fidl::encoding::Context) -> usize {
4194            16
4195        }
4196    }
4197
4198    unsafe impl fidl::encoding::Encode<Value, fidl::encoding::DefaultFuchsiaResourceDialect>
4199        for &mut Value
4200    {
4201        #[inline]
4202        unsafe fn encode(
4203            self,
4204            encoder: &mut fidl::encoding::Encoder<
4205                '_,
4206                fidl::encoding::DefaultFuchsiaResourceDialect,
4207            >,
4208            offset: usize,
4209            _depth: fidl::encoding::Depth,
4210        ) -> fidl::Result<()> {
4211            encoder.debug_check_bounds::<Value>(offset);
4212            encoder.write_num::<u64>(self.ordinal(), offset);
4213            match self {
4214            Value::Intval(ref val) => {
4215                fidl::encoding::encode_in_envelope::<i64, fidl::encoding::DefaultFuchsiaResourceDialect>(
4216                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
4217                    encoder, offset + 8, _depth
4218                )
4219            }
4220            Value::Floatval(ref val) => {
4221                fidl::encoding::encode_in_envelope::<f64, fidl::encoding::DefaultFuchsiaResourceDialect>(
4222                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
4223                    encoder, offset + 8, _depth
4224                )
4225            }
4226            Value::Boolval(ref val) => {
4227                fidl::encoding::encode_in_envelope::<bool, fidl::encoding::DefaultFuchsiaResourceDialect>(
4228                    <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
4229                    encoder, offset + 8, _depth
4230                )
4231            }
4232            Value::Stringval(ref val) => {
4233                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<12000>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4234                    <fidl::encoding::BoundedString<12000> as fidl::encoding::ValueTypeMarker>::borrow(val),
4235                    encoder, offset + 8, _depth
4236                )
4237            }
4238            Value::Bytesval(ref mut val) => {
4239                fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
4240                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4241                    encoder, offset + 8, _depth
4242                )
4243            }
4244        }
4245        }
4246    }
4247
4248    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Value {
4249        #[inline(always)]
4250        fn new_empty() -> Self {
4251            Self::Intval(fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect))
4252        }
4253
4254        #[inline]
4255        unsafe fn decode(
4256            &mut self,
4257            decoder: &mut fidl::encoding::Decoder<
4258                '_,
4259                fidl::encoding::DefaultFuchsiaResourceDialect,
4260            >,
4261            offset: usize,
4262            mut depth: fidl::encoding::Depth,
4263        ) -> fidl::Result<()> {
4264            decoder.debug_check_bounds::<Self>(offset);
4265            #[allow(unused_variables)]
4266            let next_out_of_line = decoder.next_out_of_line();
4267            let handles_before = decoder.remaining_handles();
4268            let (ordinal, inlined, num_bytes, num_handles) =
4269                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4270
4271            let member_inline_size = match ordinal {
4272            1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4273            2 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4274            3 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4275            4 => <fidl::encoding::BoundedString<12000> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4276            5 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4277            _ => return Err(fidl::Error::UnknownUnionTag),
4278        };
4279
4280            if inlined != (member_inline_size <= 4) {
4281                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4282            }
4283            let _inner_offset;
4284            if inlined {
4285                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4286                _inner_offset = offset + 8;
4287            } else {
4288                depth.increment()?;
4289                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4290            }
4291            match ordinal {
4292                1 => {
4293                    #[allow(irrefutable_let_patterns)]
4294                    if let Value::Intval(_) = self {
4295                        // Do nothing, read the value into the object
4296                    } else {
4297                        // Initialize `self` to the right variant
4298                        *self = Value::Intval(fidl::new_empty!(
4299                            i64,
4300                            fidl::encoding::DefaultFuchsiaResourceDialect
4301                        ));
4302                    }
4303                    #[allow(irrefutable_let_patterns)]
4304                    if let Value::Intval(ref mut val) = self {
4305                        fidl::decode!(
4306                            i64,
4307                            fidl::encoding::DefaultFuchsiaResourceDialect,
4308                            val,
4309                            decoder,
4310                            _inner_offset,
4311                            depth
4312                        )?;
4313                    } else {
4314                        unreachable!()
4315                    }
4316                }
4317                2 => {
4318                    #[allow(irrefutable_let_patterns)]
4319                    if let Value::Floatval(_) = self {
4320                        // Do nothing, read the value into the object
4321                    } else {
4322                        // Initialize `self` to the right variant
4323                        *self = Value::Floatval(fidl::new_empty!(
4324                            f64,
4325                            fidl::encoding::DefaultFuchsiaResourceDialect
4326                        ));
4327                    }
4328                    #[allow(irrefutable_let_patterns)]
4329                    if let Value::Floatval(ref mut val) = self {
4330                        fidl::decode!(
4331                            f64,
4332                            fidl::encoding::DefaultFuchsiaResourceDialect,
4333                            val,
4334                            decoder,
4335                            _inner_offset,
4336                            depth
4337                        )?;
4338                    } else {
4339                        unreachable!()
4340                    }
4341                }
4342                3 => {
4343                    #[allow(irrefutable_let_patterns)]
4344                    if let Value::Boolval(_) = self {
4345                        // Do nothing, read the value into the object
4346                    } else {
4347                        // Initialize `self` to the right variant
4348                        *self = Value::Boolval(fidl::new_empty!(
4349                            bool,
4350                            fidl::encoding::DefaultFuchsiaResourceDialect
4351                        ));
4352                    }
4353                    #[allow(irrefutable_let_patterns)]
4354                    if let Value::Boolval(ref mut val) = self {
4355                        fidl::decode!(
4356                            bool,
4357                            fidl::encoding::DefaultFuchsiaResourceDialect,
4358                            val,
4359                            decoder,
4360                            _inner_offset,
4361                            depth
4362                        )?;
4363                    } else {
4364                        unreachable!()
4365                    }
4366                }
4367                4 => {
4368                    #[allow(irrefutable_let_patterns)]
4369                    if let Value::Stringval(_) = self {
4370                        // Do nothing, read the value into the object
4371                    } else {
4372                        // Initialize `self` to the right variant
4373                        *self = Value::Stringval(fidl::new_empty!(
4374                            fidl::encoding::BoundedString<12000>,
4375                            fidl::encoding::DefaultFuchsiaResourceDialect
4376                        ));
4377                    }
4378                    #[allow(irrefutable_let_patterns)]
4379                    if let Value::Stringval(ref mut val) = self {
4380                        fidl::decode!(
4381                            fidl::encoding::BoundedString<12000>,
4382                            fidl::encoding::DefaultFuchsiaResourceDialect,
4383                            val,
4384                            decoder,
4385                            _inner_offset,
4386                            depth
4387                        )?;
4388                    } else {
4389                        unreachable!()
4390                    }
4391                }
4392                5 => {
4393                    #[allow(irrefutable_let_patterns)]
4394                    if let Value::Bytesval(_) = self {
4395                        // Do nothing, read the value into the object
4396                    } else {
4397                        // Initialize `self` to the right variant
4398                        *self = Value::Bytesval(fidl::new_empty!(
4399                            fidl_fuchsia_mem::Buffer,
4400                            fidl::encoding::DefaultFuchsiaResourceDialect
4401                        ));
4402                    }
4403                    #[allow(irrefutable_let_patterns)]
4404                    if let Value::Bytesval(ref mut val) = self {
4405                        fidl::decode!(
4406                            fidl_fuchsia_mem::Buffer,
4407                            fidl::encoding::DefaultFuchsiaResourceDialect,
4408                            val,
4409                            decoder,
4410                            _inner_offset,
4411                            depth
4412                        )?;
4413                    } else {
4414                        unreachable!()
4415                    }
4416                }
4417                ordinal => panic!("unexpected ordinal {:?}", ordinal),
4418            }
4419            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4420                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4421            }
4422            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4423                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4424            }
4425            Ok(())
4426        }
4427    }
4428}