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