Skip to main content

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