fidl_fuchsia_stash/
fidl_fuchsia_stash.rs

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