fidl_fuchsia_stash/
fidl_fuchsia_stash.rs

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