Skip to main content

fidl_fuchsia_stash/
fidl_fuchsia_stash.rs

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