1#![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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum IterateConnectionError {
16 UnknownStartAt,
18 #[doc(hidden)]
19 __SourceBreaking { unknown_ordinal: u32 },
20}
21
22#[macro_export]
24macro_rules! IterateConnectionErrorUnknown {
25 () => {
26 _
27 };
28}
29
30impl IterateConnectionError {
31 #[inline]
32 pub fn from_primitive(prim: u32) -> Option<Self> {
33 match prim {
34 1 => Some(Self::UnknownStartAt),
35 _ => None,
36 }
37 }
38
39 #[inline]
40 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
41 match prim {
42 1 => Self::UnknownStartAt,
43 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
44 }
45 }
46
47 #[inline]
48 pub fn unknown() -> Self {
49 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
50 }
51
52 #[inline]
53 pub const fn into_primitive(self) -> u32 {
54 match self {
55 Self::UnknownStartAt => 1,
56 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
57 }
58 }
59
60 #[inline]
61 pub fn is_unknown(&self) -> bool {
62 match self {
63 Self::__SourceBreaking { unknown_ordinal: _ } => true,
64 _ => false,
65 }
66 }
67}
68
69#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
71pub enum WriteError {
72 Unknown,
73 InvalidKey,
74 InvalidValue,
75 AlreadyExists,
76 #[doc(hidden)]
77 __SourceBreaking {
78 unknown_ordinal: u32,
79 },
80}
81
82#[macro_export]
84macro_rules! WriteErrorUnknown {
85 () => {
86 _
87 };
88}
89
90impl WriteError {
91 #[inline]
92 pub fn from_primitive(prim: u32) -> Option<Self> {
93 match prim {
94 0 => Some(Self::Unknown),
95 1 => Some(Self::InvalidKey),
96 2 => Some(Self::InvalidValue),
97 3 => Some(Self::AlreadyExists),
98 _ => None,
99 }
100 }
101
102 #[inline]
103 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
104 match prim {
105 0 => Self::Unknown,
106 1 => Self::InvalidKey,
107 2 => Self::InvalidValue,
108 3 => Self::AlreadyExists,
109 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
110 }
111 }
112
113 #[inline]
114 pub fn unknown() -> Self {
115 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
116 }
117
118 #[inline]
119 pub const fn into_primitive(self) -> u32 {
120 match self {
121 Self::Unknown => 0,
122 Self::InvalidKey => 1,
123 Self::InvalidValue => 2,
124 Self::AlreadyExists => 3,
125 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
126 }
127 }
128
129 #[inline]
130 pub fn is_unknown(&self) -> bool {
131 match self {
132 Self::__SourceBreaking { unknown_ordinal: _ } => true,
133 _ => false,
134 }
135 }
136}
137
138#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
142pub struct Item {
143 pub key: String,
144 pub value: Vec<u8>,
145}
146
147impl fidl::Persistable for Item {}
148
149#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
150pub struct IteratorGetResponse {
151 pub entries: Vec<String>,
154}
155
156impl fidl::Persistable for IteratorGetResponse {}
157
158#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
159pub struct StoreIterateRequest {
160 pub starting_at: Option<String>,
162 pub iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
166}
167
168impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StoreIterateRequest {}
169
170#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
171pub struct StoreWriteItemRequest {
172 pub attempt: Item,
173}
174
175impl fidl::Persistable for StoreWriteItemRequest {}
176
177#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
178pub struct IteratorMarker;
179
180impl fidl::endpoints::ProtocolMarker for IteratorMarker {
181 type Proxy = IteratorProxy;
182 type RequestStream = IteratorRequestStream;
183 #[cfg(target_os = "fuchsia")]
184 type SynchronousProxy = IteratorSynchronousProxy;
185
186 const DEBUG_NAME: &'static str = "(anonymous) Iterator";
187}
188
189pub trait IteratorProxyInterface: Send + Sync {
190 type GetResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
191 fn r#get(&self) -> Self::GetResponseFut;
192}
193#[derive(Debug)]
194#[cfg(target_os = "fuchsia")]
195pub struct IteratorSynchronousProxy {
196 client: fidl::client::sync::Client,
197}
198
199#[cfg(target_os = "fuchsia")]
200impl fidl::endpoints::SynchronousProxy for IteratorSynchronousProxy {
201 type Proxy = IteratorProxy;
202 type Protocol = IteratorMarker;
203
204 fn from_channel(inner: fidl::Channel) -> Self {
205 Self::new(inner)
206 }
207
208 fn into_channel(self) -> fidl::Channel {
209 self.client.into_channel()
210 }
211
212 fn as_channel(&self) -> &fidl::Channel {
213 self.client.as_channel()
214 }
215}
216
217#[cfg(target_os = "fuchsia")]
218impl IteratorSynchronousProxy {
219 pub fn new(channel: fidl::Channel) -> Self {
220 let protocol_name = <IteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
221 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
222 }
223
224 pub fn into_channel(self) -> fidl::Channel {
225 self.client.into_channel()
226 }
227
228 pub fn wait_for_event(
231 &self,
232 deadline: zx::MonotonicInstant,
233 ) -> Result<IteratorEvent, fidl::Error> {
234 IteratorEvent::decode(self.client.wait_for_event(deadline)?)
235 }
236
237 pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
245 let _response =
246 self.client.send_query::<fidl::encoding::EmptyPayload, IteratorGetResponse>(
247 (),
248 0x6a62554b7d535882,
249 fidl::encoding::DynamicFlags::empty(),
250 ___deadline,
251 )?;
252 Ok(_response.entries)
253 }
254}
255
256#[derive(Debug, Clone)]
257pub struct IteratorProxy {
258 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
259}
260
261impl fidl::endpoints::Proxy for IteratorProxy {
262 type Protocol = IteratorMarker;
263
264 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
265 Self::new(inner)
266 }
267
268 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
269 self.client.into_channel().map_err(|client| Self { client })
270 }
271
272 fn as_channel(&self) -> &::fidl::AsyncChannel {
273 self.client.as_channel()
274 }
275}
276
277impl IteratorProxy {
278 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
280 let protocol_name = <IteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
281 Self { client: fidl::client::Client::new(channel, protocol_name) }
282 }
283
284 pub fn take_event_stream(&self) -> IteratorEventStream {
290 IteratorEventStream { event_receiver: self.client.take_event_receiver() }
291 }
292
293 pub fn r#get(
301 &self,
302 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
303 {
304 IteratorProxyInterface::r#get(self)
305 }
306}
307
308impl IteratorProxyInterface for IteratorProxy {
309 type GetResponseFut =
310 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
311 fn r#get(&self) -> Self::GetResponseFut {
312 fn _decode(
313 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
314 ) -> Result<Vec<String>, fidl::Error> {
315 let _response = fidl::client::decode_transaction_body::<
316 IteratorGetResponse,
317 fidl::encoding::DefaultFuchsiaResourceDialect,
318 0x6a62554b7d535882,
319 >(_buf?)?;
320 Ok(_response.entries)
321 }
322 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
323 (),
324 0x6a62554b7d535882,
325 fidl::encoding::DynamicFlags::empty(),
326 _decode,
327 )
328 }
329}
330
331pub struct IteratorEventStream {
332 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
333}
334
335impl std::marker::Unpin for IteratorEventStream {}
336
337impl futures::stream::FusedStream for IteratorEventStream {
338 fn is_terminated(&self) -> bool {
339 self.event_receiver.is_terminated()
340 }
341}
342
343impl futures::Stream for IteratorEventStream {
344 type Item = Result<IteratorEvent, fidl::Error>;
345
346 fn poll_next(
347 mut self: std::pin::Pin<&mut Self>,
348 cx: &mut std::task::Context<'_>,
349 ) -> std::task::Poll<Option<Self::Item>> {
350 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
351 &mut self.event_receiver,
352 cx
353 )?) {
354 Some(buf) => std::task::Poll::Ready(Some(IteratorEvent::decode(buf))),
355 None => std::task::Poll::Ready(None),
356 }
357 }
358}
359
360#[derive(Debug)]
361pub enum IteratorEvent {}
362
363impl IteratorEvent {
364 fn decode(
366 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
367 ) -> Result<IteratorEvent, fidl::Error> {
368 let (bytes, _handles) = buf.split_mut();
369 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
370 debug_assert_eq!(tx_header.tx_id, 0);
371 match tx_header.ordinal {
372 _ => Err(fidl::Error::UnknownOrdinal {
373 ordinal: tx_header.ordinal,
374 protocol_name: <IteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
375 }),
376 }
377 }
378}
379
380pub struct IteratorRequestStream {
382 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
383 is_terminated: bool,
384}
385
386impl std::marker::Unpin for IteratorRequestStream {}
387
388impl futures::stream::FusedStream for IteratorRequestStream {
389 fn is_terminated(&self) -> bool {
390 self.is_terminated
391 }
392}
393
394impl fidl::endpoints::RequestStream for IteratorRequestStream {
395 type Protocol = IteratorMarker;
396 type ControlHandle = IteratorControlHandle;
397
398 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
399 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
400 }
401
402 fn control_handle(&self) -> Self::ControlHandle {
403 IteratorControlHandle { inner: self.inner.clone() }
404 }
405
406 fn into_inner(
407 self,
408 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
409 {
410 (self.inner, self.is_terminated)
411 }
412
413 fn from_inner(
414 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
415 is_terminated: bool,
416 ) -> Self {
417 Self { inner, is_terminated }
418 }
419}
420
421impl futures::Stream for IteratorRequestStream {
422 type Item = Result<IteratorRequest, fidl::Error>;
423
424 fn poll_next(
425 mut self: std::pin::Pin<&mut Self>,
426 cx: &mut std::task::Context<'_>,
427 ) -> std::task::Poll<Option<Self::Item>> {
428 let this = &mut *self;
429 if this.inner.check_shutdown(cx) {
430 this.is_terminated = true;
431 return std::task::Poll::Ready(None);
432 }
433 if this.is_terminated {
434 panic!("polled IteratorRequestStream after completion");
435 }
436 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
437 |bytes, handles| {
438 match this.inner.channel().read_etc(cx, bytes, handles) {
439 std::task::Poll::Ready(Ok(())) => {}
440 std::task::Poll::Pending => return std::task::Poll::Pending,
441 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
442 this.is_terminated = true;
443 return std::task::Poll::Ready(None);
444 }
445 std::task::Poll::Ready(Err(e)) => {
446 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
447 e.into(),
448 ))))
449 }
450 }
451
452 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
454
455 std::task::Poll::Ready(Some(match header.ordinal {
456 0x6a62554b7d535882 => {
457 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
458 let mut req = fidl::new_empty!(
459 fidl::encoding::EmptyPayload,
460 fidl::encoding::DefaultFuchsiaResourceDialect
461 );
462 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
463 let control_handle = IteratorControlHandle { inner: this.inner.clone() };
464 Ok(IteratorRequest::Get {
465 responder: IteratorGetResponder {
466 control_handle: std::mem::ManuallyDrop::new(control_handle),
467 tx_id: header.tx_id,
468 },
469 })
470 }
471 _ => Err(fidl::Error::UnknownOrdinal {
472 ordinal: header.ordinal,
473 protocol_name:
474 <IteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
475 }),
476 }))
477 },
478 )
479 }
480}
481
482#[derive(Debug)]
496pub enum IteratorRequest {
497 Get { responder: IteratorGetResponder },
505}
506
507impl IteratorRequest {
508 #[allow(irrefutable_let_patterns)]
509 pub fn into_get(self) -> Option<(IteratorGetResponder)> {
510 if let IteratorRequest::Get { responder } = self {
511 Some((responder))
512 } else {
513 None
514 }
515 }
516
517 pub fn method_name(&self) -> &'static str {
519 match *self {
520 IteratorRequest::Get { .. } => "get",
521 }
522 }
523}
524
525#[derive(Debug, Clone)]
526pub struct IteratorControlHandle {
527 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
528}
529
530impl fidl::endpoints::ControlHandle for IteratorControlHandle {
531 fn shutdown(&self) {
532 self.inner.shutdown()
533 }
534 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
535 self.inner.shutdown_with_epitaph(status)
536 }
537
538 fn is_closed(&self) -> bool {
539 self.inner.channel().is_closed()
540 }
541 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
542 self.inner.channel().on_closed()
543 }
544
545 #[cfg(target_os = "fuchsia")]
546 fn signal_peer(
547 &self,
548 clear_mask: zx::Signals,
549 set_mask: zx::Signals,
550 ) -> Result<(), zx_status::Status> {
551 use fidl::Peered;
552 self.inner.channel().signal_peer(clear_mask, set_mask)
553 }
554}
555
556impl IteratorControlHandle {}
557
558#[must_use = "FIDL methods require a response to be sent"]
559#[derive(Debug)]
560pub struct IteratorGetResponder {
561 control_handle: std::mem::ManuallyDrop<IteratorControlHandle>,
562 tx_id: u32,
563}
564
565impl std::ops::Drop for IteratorGetResponder {
569 fn drop(&mut self) {
570 self.control_handle.shutdown();
571 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
573 }
574}
575
576impl fidl::endpoints::Responder for IteratorGetResponder {
577 type ControlHandle = IteratorControlHandle;
578
579 fn control_handle(&self) -> &IteratorControlHandle {
580 &self.control_handle
581 }
582
583 fn drop_without_shutdown(mut self) {
584 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
586 std::mem::forget(self);
588 }
589}
590
591impl IteratorGetResponder {
592 pub fn send(self, mut entries: &[String]) -> Result<(), fidl::Error> {
596 let _result = self.send_raw(entries);
597 if _result.is_err() {
598 self.control_handle.shutdown();
599 }
600 self.drop_without_shutdown();
601 _result
602 }
603
604 pub fn send_no_shutdown_on_err(self, mut entries: &[String]) -> Result<(), fidl::Error> {
606 let _result = self.send_raw(entries);
607 self.drop_without_shutdown();
608 _result
609 }
610
611 fn send_raw(&self, mut entries: &[String]) -> Result<(), fidl::Error> {
612 self.control_handle.inner.send::<IteratorGetResponse>(
613 (entries,),
614 self.tx_id,
615 0x6a62554b7d535882,
616 fidl::encoding::DynamicFlags::empty(),
617 )
618 }
619}
620
621#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
622pub struct StoreMarker;
623
624impl fidl::endpoints::ProtocolMarker for StoreMarker {
625 type Proxy = StoreProxy;
626 type RequestStream = StoreRequestStream;
627 #[cfg(target_os = "fuchsia")]
628 type SynchronousProxy = StoreSynchronousProxy;
629
630 const DEBUG_NAME: &'static str = "examples.keyvaluestore.additerator.Store";
631}
632impl fidl::endpoints::DiscoverableProtocolMarker for StoreMarker {}
633pub type StoreWriteItemResult = Result<(), WriteError>;
634pub type StoreIterateResult = Result<(), IterateConnectionError>;
635
636pub trait StoreProxyInterface: Send + Sync {
637 type WriteItemResponseFut: std::future::Future<Output = Result<StoreWriteItemResult, fidl::Error>>
638 + Send;
639 fn r#write_item(&self, attempt: &Item) -> Self::WriteItemResponseFut;
640 type IterateResponseFut: std::future::Future<Output = Result<StoreIterateResult, fidl::Error>>
641 + Send;
642 fn r#iterate(
643 &self,
644 starting_at: Option<&str>,
645 iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
646 ) -> Self::IterateResponseFut;
647}
648#[derive(Debug)]
649#[cfg(target_os = "fuchsia")]
650pub struct StoreSynchronousProxy {
651 client: fidl::client::sync::Client,
652}
653
654#[cfg(target_os = "fuchsia")]
655impl fidl::endpoints::SynchronousProxy for StoreSynchronousProxy {
656 type Proxy = StoreProxy;
657 type Protocol = StoreMarker;
658
659 fn from_channel(inner: fidl::Channel) -> Self {
660 Self::new(inner)
661 }
662
663 fn into_channel(self) -> fidl::Channel {
664 self.client.into_channel()
665 }
666
667 fn as_channel(&self) -> &fidl::Channel {
668 self.client.as_channel()
669 }
670}
671
672#[cfg(target_os = "fuchsia")]
673impl StoreSynchronousProxy {
674 pub fn new(channel: fidl::Channel) -> Self {
675 let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
676 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
677 }
678
679 pub fn into_channel(self) -> fidl::Channel {
680 self.client.into_channel()
681 }
682
683 pub fn wait_for_event(
686 &self,
687 deadline: zx::MonotonicInstant,
688 ) -> Result<StoreEvent, fidl::Error> {
689 StoreEvent::decode(self.client.wait_for_event(deadline)?)
690 }
691
692 pub fn r#write_item(
694 &self,
695 mut attempt: &Item,
696 ___deadline: zx::MonotonicInstant,
697 ) -> Result<StoreWriteItemResult, fidl::Error> {
698 let _response = self.client.send_query::<
699 StoreWriteItemRequest,
700 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteError>,
701 >(
702 (attempt,),
703 0x3a714dd8953e97b2,
704 fidl::encoding::DynamicFlags::FLEXIBLE,
705 ___deadline,
706 )?
707 .into_result::<StoreMarker>("write_item")?;
708 Ok(_response.map(|x| x))
709 }
710
711 pub fn r#iterate(
718 &self,
719 mut starting_at: Option<&str>,
720 mut iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
721 ___deadline: zx::MonotonicInstant,
722 ) -> Result<StoreIterateResult, fidl::Error> {
723 let _response =
724 self.client
725 .send_query::<StoreIterateRequest, fidl::encoding::FlexibleResultType<
726 fidl::encoding::EmptyStruct,
727 IterateConnectionError,
728 >>(
729 (starting_at, iterator),
730 0x48ee436cb85c3f27,
731 fidl::encoding::DynamicFlags::FLEXIBLE,
732 ___deadline,
733 )?
734 .into_result::<StoreMarker>("iterate")?;
735 Ok(_response.map(|x| x))
736 }
737}
738
739#[derive(Debug, Clone)]
740pub struct StoreProxy {
741 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
742}
743
744impl fidl::endpoints::Proxy for StoreProxy {
745 type Protocol = StoreMarker;
746
747 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
748 Self::new(inner)
749 }
750
751 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
752 self.client.into_channel().map_err(|client| Self { client })
753 }
754
755 fn as_channel(&self) -> &::fidl::AsyncChannel {
756 self.client.as_channel()
757 }
758}
759
760impl StoreProxy {
761 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
763 let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
764 Self { client: fidl::client::Client::new(channel, protocol_name) }
765 }
766
767 pub fn take_event_stream(&self) -> StoreEventStream {
773 StoreEventStream { event_receiver: self.client.take_event_receiver() }
774 }
775
776 pub fn r#write_item(
778 &self,
779 mut attempt: &Item,
780 ) -> fidl::client::QueryResponseFut<
781 StoreWriteItemResult,
782 fidl::encoding::DefaultFuchsiaResourceDialect,
783 > {
784 StoreProxyInterface::r#write_item(self, attempt)
785 }
786
787 pub fn r#iterate(
794 &self,
795 mut starting_at: Option<&str>,
796 mut iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
797 ) -> fidl::client::QueryResponseFut<
798 StoreIterateResult,
799 fidl::encoding::DefaultFuchsiaResourceDialect,
800 > {
801 StoreProxyInterface::r#iterate(self, starting_at, iterator)
802 }
803}
804
805impl StoreProxyInterface for StoreProxy {
806 type WriteItemResponseFut = fidl::client::QueryResponseFut<
807 StoreWriteItemResult,
808 fidl::encoding::DefaultFuchsiaResourceDialect,
809 >;
810 fn r#write_item(&self, mut attempt: &Item) -> Self::WriteItemResponseFut {
811 fn _decode(
812 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
813 ) -> Result<StoreWriteItemResult, fidl::Error> {
814 let _response = fidl::client::decode_transaction_body::<
815 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteError>,
816 fidl::encoding::DefaultFuchsiaResourceDialect,
817 0x3a714dd8953e97b2,
818 >(_buf?)?
819 .into_result::<StoreMarker>("write_item")?;
820 Ok(_response.map(|x| x))
821 }
822 self.client.send_query_and_decode::<StoreWriteItemRequest, StoreWriteItemResult>(
823 (attempt,),
824 0x3a714dd8953e97b2,
825 fidl::encoding::DynamicFlags::FLEXIBLE,
826 _decode,
827 )
828 }
829
830 type IterateResponseFut = fidl::client::QueryResponseFut<
831 StoreIterateResult,
832 fidl::encoding::DefaultFuchsiaResourceDialect,
833 >;
834 fn r#iterate(
835 &self,
836 mut starting_at: Option<&str>,
837 mut iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
838 ) -> Self::IterateResponseFut {
839 fn _decode(
840 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
841 ) -> Result<StoreIterateResult, fidl::Error> {
842 let _response = fidl::client::decode_transaction_body::<
843 fidl::encoding::FlexibleResultType<
844 fidl::encoding::EmptyStruct,
845 IterateConnectionError,
846 >,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 0x48ee436cb85c3f27,
849 >(_buf?)?
850 .into_result::<StoreMarker>("iterate")?;
851 Ok(_response.map(|x| x))
852 }
853 self.client.send_query_and_decode::<StoreIterateRequest, StoreIterateResult>(
854 (starting_at, iterator),
855 0x48ee436cb85c3f27,
856 fidl::encoding::DynamicFlags::FLEXIBLE,
857 _decode,
858 )
859 }
860}
861
862pub struct StoreEventStream {
863 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
864}
865
866impl std::marker::Unpin for StoreEventStream {}
867
868impl futures::stream::FusedStream for StoreEventStream {
869 fn is_terminated(&self) -> bool {
870 self.event_receiver.is_terminated()
871 }
872}
873
874impl futures::Stream for StoreEventStream {
875 type Item = Result<StoreEvent, fidl::Error>;
876
877 fn poll_next(
878 mut self: std::pin::Pin<&mut Self>,
879 cx: &mut std::task::Context<'_>,
880 ) -> std::task::Poll<Option<Self::Item>> {
881 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
882 &mut self.event_receiver,
883 cx
884 )?) {
885 Some(buf) => std::task::Poll::Ready(Some(StoreEvent::decode(buf))),
886 None => std::task::Poll::Ready(None),
887 }
888 }
889}
890
891#[derive(Debug)]
892pub enum StoreEvent {
893 #[non_exhaustive]
894 _UnknownEvent {
895 ordinal: u64,
897 },
898}
899
900impl StoreEvent {
901 fn decode(
903 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
904 ) -> Result<StoreEvent, fidl::Error> {
905 let (bytes, _handles) = buf.split_mut();
906 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
907 debug_assert_eq!(tx_header.tx_id, 0);
908 match tx_header.ordinal {
909 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
910 Ok(StoreEvent::_UnknownEvent { ordinal: tx_header.ordinal })
911 }
912 _ => Err(fidl::Error::UnknownOrdinal {
913 ordinal: tx_header.ordinal,
914 protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
915 }),
916 }
917 }
918}
919
920pub struct StoreRequestStream {
922 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
923 is_terminated: bool,
924}
925
926impl std::marker::Unpin for StoreRequestStream {}
927
928impl futures::stream::FusedStream for StoreRequestStream {
929 fn is_terminated(&self) -> bool {
930 self.is_terminated
931 }
932}
933
934impl fidl::endpoints::RequestStream for StoreRequestStream {
935 type Protocol = StoreMarker;
936 type ControlHandle = StoreControlHandle;
937
938 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
939 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
940 }
941
942 fn control_handle(&self) -> Self::ControlHandle {
943 StoreControlHandle { inner: self.inner.clone() }
944 }
945
946 fn into_inner(
947 self,
948 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
949 {
950 (self.inner, self.is_terminated)
951 }
952
953 fn from_inner(
954 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
955 is_terminated: bool,
956 ) -> Self {
957 Self { inner, is_terminated }
958 }
959}
960
961impl futures::Stream for StoreRequestStream {
962 type Item = Result<StoreRequest, fidl::Error>;
963
964 fn poll_next(
965 mut self: std::pin::Pin<&mut Self>,
966 cx: &mut std::task::Context<'_>,
967 ) -> std::task::Poll<Option<Self::Item>> {
968 let this = &mut *self;
969 if this.inner.check_shutdown(cx) {
970 this.is_terminated = true;
971 return std::task::Poll::Ready(None);
972 }
973 if this.is_terminated {
974 panic!("polled StoreRequestStream after completion");
975 }
976 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
977 |bytes, handles| {
978 match this.inner.channel().read_etc(cx, bytes, handles) {
979 std::task::Poll::Ready(Ok(())) => {}
980 std::task::Poll::Pending => return std::task::Poll::Pending,
981 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
982 this.is_terminated = true;
983 return std::task::Poll::Ready(None);
984 }
985 std::task::Poll::Ready(Err(e)) => {
986 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
987 e.into(),
988 ))))
989 }
990 }
991
992 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
994
995 std::task::Poll::Ready(Some(match header.ordinal {
996 0x3a714dd8953e97b2 => {
997 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
998 let mut req = fidl::new_empty!(
999 StoreWriteItemRequest,
1000 fidl::encoding::DefaultFuchsiaResourceDialect
1001 );
1002 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreWriteItemRequest>(&header, _body_bytes, handles, &mut req)?;
1003 let control_handle = StoreControlHandle { inner: this.inner.clone() };
1004 Ok(StoreRequest::WriteItem {
1005 attempt: req.attempt,
1006
1007 responder: StoreWriteItemResponder {
1008 control_handle: std::mem::ManuallyDrop::new(control_handle),
1009 tx_id: header.tx_id,
1010 },
1011 })
1012 }
1013 0x48ee436cb85c3f27 => {
1014 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1015 let mut req = fidl::new_empty!(
1016 StoreIterateRequest,
1017 fidl::encoding::DefaultFuchsiaResourceDialect
1018 );
1019 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StoreIterateRequest>(&header, _body_bytes, handles, &mut req)?;
1020 let control_handle = StoreControlHandle { inner: this.inner.clone() };
1021 Ok(StoreRequest::Iterate {
1022 starting_at: req.starting_at,
1023 iterator: req.iterator,
1024
1025 responder: StoreIterateResponder {
1026 control_handle: std::mem::ManuallyDrop::new(control_handle),
1027 tx_id: header.tx_id,
1028 },
1029 })
1030 }
1031 _ if header.tx_id == 0
1032 && header
1033 .dynamic_flags()
1034 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1035 {
1036 Ok(StoreRequest::_UnknownMethod {
1037 ordinal: header.ordinal,
1038 control_handle: StoreControlHandle { inner: this.inner.clone() },
1039 method_type: fidl::MethodType::OneWay,
1040 })
1041 }
1042 _ if header
1043 .dynamic_flags()
1044 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1045 {
1046 this.inner.send_framework_err(
1047 fidl::encoding::FrameworkErr::UnknownMethod,
1048 header.tx_id,
1049 header.ordinal,
1050 header.dynamic_flags(),
1051 (bytes, handles),
1052 )?;
1053 Ok(StoreRequest::_UnknownMethod {
1054 ordinal: header.ordinal,
1055 control_handle: StoreControlHandle { inner: this.inner.clone() },
1056 method_type: fidl::MethodType::TwoWay,
1057 })
1058 }
1059 _ => Err(fidl::Error::UnknownOrdinal {
1060 ordinal: header.ordinal,
1061 protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1062 }),
1063 }))
1064 },
1065 )
1066 }
1067}
1068
1069#[derive(Debug)]
1071pub enum StoreRequest {
1072 WriteItem { attempt: Item, responder: StoreWriteItemResponder },
1074 Iterate {
1081 starting_at: Option<String>,
1082 iterator: fidl::endpoints::ServerEnd<IteratorMarker>,
1083 responder: StoreIterateResponder,
1084 },
1085 #[non_exhaustive]
1087 _UnknownMethod {
1088 ordinal: u64,
1090 control_handle: StoreControlHandle,
1091 method_type: fidl::MethodType,
1092 },
1093}
1094
1095impl StoreRequest {
1096 #[allow(irrefutable_let_patterns)]
1097 pub fn into_write_item(self) -> Option<(Item, StoreWriteItemResponder)> {
1098 if let StoreRequest::WriteItem { attempt, responder } = self {
1099 Some((attempt, responder))
1100 } else {
1101 None
1102 }
1103 }
1104
1105 #[allow(irrefutable_let_patterns)]
1106 pub fn into_iterate(
1107 self,
1108 ) -> Option<(Option<String>, fidl::endpoints::ServerEnd<IteratorMarker>, StoreIterateResponder)>
1109 {
1110 if let StoreRequest::Iterate { starting_at, iterator, responder } = self {
1111 Some((starting_at, iterator, responder))
1112 } else {
1113 None
1114 }
1115 }
1116
1117 pub fn method_name(&self) -> &'static str {
1119 match *self {
1120 StoreRequest::WriteItem { .. } => "write_item",
1121 StoreRequest::Iterate { .. } => "iterate",
1122 StoreRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1123 "unknown one-way method"
1124 }
1125 StoreRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1126 "unknown two-way method"
1127 }
1128 }
1129 }
1130}
1131
1132#[derive(Debug, Clone)]
1133pub struct StoreControlHandle {
1134 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1135}
1136
1137impl fidl::endpoints::ControlHandle for StoreControlHandle {
1138 fn shutdown(&self) {
1139 self.inner.shutdown()
1140 }
1141 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1142 self.inner.shutdown_with_epitaph(status)
1143 }
1144
1145 fn is_closed(&self) -> bool {
1146 self.inner.channel().is_closed()
1147 }
1148 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1149 self.inner.channel().on_closed()
1150 }
1151
1152 #[cfg(target_os = "fuchsia")]
1153 fn signal_peer(
1154 &self,
1155 clear_mask: zx::Signals,
1156 set_mask: zx::Signals,
1157 ) -> Result<(), zx_status::Status> {
1158 use fidl::Peered;
1159 self.inner.channel().signal_peer(clear_mask, set_mask)
1160 }
1161}
1162
1163impl StoreControlHandle {}
1164
1165#[must_use = "FIDL methods require a response to be sent"]
1166#[derive(Debug)]
1167pub struct StoreWriteItemResponder {
1168 control_handle: std::mem::ManuallyDrop<StoreControlHandle>,
1169 tx_id: u32,
1170}
1171
1172impl std::ops::Drop for StoreWriteItemResponder {
1176 fn drop(&mut self) {
1177 self.control_handle.shutdown();
1178 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1180 }
1181}
1182
1183impl fidl::endpoints::Responder for StoreWriteItemResponder {
1184 type ControlHandle = StoreControlHandle;
1185
1186 fn control_handle(&self) -> &StoreControlHandle {
1187 &self.control_handle
1188 }
1189
1190 fn drop_without_shutdown(mut self) {
1191 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1193 std::mem::forget(self);
1195 }
1196}
1197
1198impl StoreWriteItemResponder {
1199 pub fn send(self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
1203 let _result = self.send_raw(result);
1204 if _result.is_err() {
1205 self.control_handle.shutdown();
1206 }
1207 self.drop_without_shutdown();
1208 _result
1209 }
1210
1211 pub fn send_no_shutdown_on_err(
1213 self,
1214 mut result: Result<(), WriteError>,
1215 ) -> Result<(), fidl::Error> {
1216 let _result = self.send_raw(result);
1217 self.drop_without_shutdown();
1218 _result
1219 }
1220
1221 fn send_raw(&self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
1222 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1223 fidl::encoding::EmptyStruct,
1224 WriteError,
1225 >>(
1226 fidl::encoding::FlexibleResult::new(result),
1227 self.tx_id,
1228 0x3a714dd8953e97b2,
1229 fidl::encoding::DynamicFlags::FLEXIBLE,
1230 )
1231 }
1232}
1233
1234#[must_use = "FIDL methods require a response to be sent"]
1235#[derive(Debug)]
1236pub struct StoreIterateResponder {
1237 control_handle: std::mem::ManuallyDrop<StoreControlHandle>,
1238 tx_id: u32,
1239}
1240
1241impl std::ops::Drop for StoreIterateResponder {
1245 fn drop(&mut self) {
1246 self.control_handle.shutdown();
1247 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1249 }
1250}
1251
1252impl fidl::endpoints::Responder for StoreIterateResponder {
1253 type ControlHandle = StoreControlHandle;
1254
1255 fn control_handle(&self) -> &StoreControlHandle {
1256 &self.control_handle
1257 }
1258
1259 fn drop_without_shutdown(mut self) {
1260 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1262 std::mem::forget(self);
1264 }
1265}
1266
1267impl StoreIterateResponder {
1268 pub fn send(self, mut result: Result<(), IterateConnectionError>) -> Result<(), fidl::Error> {
1272 let _result = self.send_raw(result);
1273 if _result.is_err() {
1274 self.control_handle.shutdown();
1275 }
1276 self.drop_without_shutdown();
1277 _result
1278 }
1279
1280 pub fn send_no_shutdown_on_err(
1282 self,
1283 mut result: Result<(), IterateConnectionError>,
1284 ) -> Result<(), fidl::Error> {
1285 let _result = self.send_raw(result);
1286 self.drop_without_shutdown();
1287 _result
1288 }
1289
1290 fn send_raw(&self, mut result: Result<(), IterateConnectionError>) -> Result<(), fidl::Error> {
1291 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1292 fidl::encoding::EmptyStruct,
1293 IterateConnectionError,
1294 >>(
1295 fidl::encoding::FlexibleResult::new(result),
1296 self.tx_id,
1297 0x48ee436cb85c3f27,
1298 fidl::encoding::DynamicFlags::FLEXIBLE,
1299 )
1300 }
1301}
1302
1303mod internal {
1304 use super::*;
1305 unsafe impl fidl::encoding::TypeMarker for IterateConnectionError {
1306 type Owned = Self;
1307
1308 #[inline(always)]
1309 fn inline_align(_context: fidl::encoding::Context) -> usize {
1310 std::mem::align_of::<u32>()
1311 }
1312
1313 #[inline(always)]
1314 fn inline_size(_context: fidl::encoding::Context) -> usize {
1315 std::mem::size_of::<u32>()
1316 }
1317
1318 #[inline(always)]
1319 fn encode_is_copy() -> bool {
1320 false
1321 }
1322
1323 #[inline(always)]
1324 fn decode_is_copy() -> bool {
1325 false
1326 }
1327 }
1328
1329 impl fidl::encoding::ValueTypeMarker for IterateConnectionError {
1330 type Borrowed<'a> = Self;
1331 #[inline(always)]
1332 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1333 *value
1334 }
1335 }
1336
1337 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1338 for IterateConnectionError
1339 {
1340 #[inline]
1341 unsafe fn encode(
1342 self,
1343 encoder: &mut fidl::encoding::Encoder<'_, D>,
1344 offset: usize,
1345 _depth: fidl::encoding::Depth,
1346 ) -> fidl::Result<()> {
1347 encoder.debug_check_bounds::<Self>(offset);
1348 encoder.write_num(self.into_primitive(), offset);
1349 Ok(())
1350 }
1351 }
1352
1353 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1354 for IterateConnectionError
1355 {
1356 #[inline(always)]
1357 fn new_empty() -> Self {
1358 Self::unknown()
1359 }
1360
1361 #[inline]
1362 unsafe fn decode(
1363 &mut self,
1364 decoder: &mut fidl::encoding::Decoder<'_, D>,
1365 offset: usize,
1366 _depth: fidl::encoding::Depth,
1367 ) -> fidl::Result<()> {
1368 decoder.debug_check_bounds::<Self>(offset);
1369 let prim = decoder.read_num::<u32>(offset);
1370
1371 *self = Self::from_primitive_allow_unknown(prim);
1372 Ok(())
1373 }
1374 }
1375 unsafe impl fidl::encoding::TypeMarker for WriteError {
1376 type Owned = Self;
1377
1378 #[inline(always)]
1379 fn inline_align(_context: fidl::encoding::Context) -> usize {
1380 std::mem::align_of::<u32>()
1381 }
1382
1383 #[inline(always)]
1384 fn inline_size(_context: fidl::encoding::Context) -> usize {
1385 std::mem::size_of::<u32>()
1386 }
1387
1388 #[inline(always)]
1389 fn encode_is_copy() -> bool {
1390 false
1391 }
1392
1393 #[inline(always)]
1394 fn decode_is_copy() -> bool {
1395 false
1396 }
1397 }
1398
1399 impl fidl::encoding::ValueTypeMarker for WriteError {
1400 type Borrowed<'a> = Self;
1401 #[inline(always)]
1402 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1403 *value
1404 }
1405 }
1406
1407 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WriteError {
1408 #[inline]
1409 unsafe fn encode(
1410 self,
1411 encoder: &mut fidl::encoding::Encoder<'_, D>,
1412 offset: usize,
1413 _depth: fidl::encoding::Depth,
1414 ) -> fidl::Result<()> {
1415 encoder.debug_check_bounds::<Self>(offset);
1416 encoder.write_num(self.into_primitive(), offset);
1417 Ok(())
1418 }
1419 }
1420
1421 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteError {
1422 #[inline(always)]
1423 fn new_empty() -> Self {
1424 Self::unknown()
1425 }
1426
1427 #[inline]
1428 unsafe fn decode(
1429 &mut self,
1430 decoder: &mut fidl::encoding::Decoder<'_, D>,
1431 offset: usize,
1432 _depth: fidl::encoding::Depth,
1433 ) -> fidl::Result<()> {
1434 decoder.debug_check_bounds::<Self>(offset);
1435 let prim = decoder.read_num::<u32>(offset);
1436
1437 *self = Self::from_primitive_allow_unknown(prim);
1438 Ok(())
1439 }
1440 }
1441
1442 impl fidl::encoding::ValueTypeMarker for Item {
1443 type Borrowed<'a> = &'a Self;
1444 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1445 value
1446 }
1447 }
1448
1449 unsafe impl fidl::encoding::TypeMarker for Item {
1450 type Owned = Self;
1451
1452 #[inline(always)]
1453 fn inline_align(_context: fidl::encoding::Context) -> usize {
1454 8
1455 }
1456
1457 #[inline(always)]
1458 fn inline_size(_context: fidl::encoding::Context) -> usize {
1459 32
1460 }
1461 }
1462
1463 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Item, D> for &Item {
1464 #[inline]
1465 unsafe fn encode(
1466 self,
1467 encoder: &mut fidl::encoding::Encoder<'_, D>,
1468 offset: usize,
1469 _depth: fidl::encoding::Depth,
1470 ) -> fidl::Result<()> {
1471 encoder.debug_check_bounds::<Item>(offset);
1472 fidl::encoding::Encode::<Item, D>::encode(
1474 (
1475 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
1476 &self.key,
1477 ),
1478 <fidl::encoding::Vector<u8, 64000> as fidl::encoding::ValueTypeMarker>::borrow(
1479 &self.value,
1480 ),
1481 ),
1482 encoder,
1483 offset,
1484 _depth,
1485 )
1486 }
1487 }
1488 unsafe impl<
1489 D: fidl::encoding::ResourceDialect,
1490 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1491 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 64000>, D>,
1492 > fidl::encoding::Encode<Item, D> for (T0, T1)
1493 {
1494 #[inline]
1495 unsafe fn encode(
1496 self,
1497 encoder: &mut fidl::encoding::Encoder<'_, D>,
1498 offset: usize,
1499 depth: fidl::encoding::Depth,
1500 ) -> fidl::Result<()> {
1501 encoder.debug_check_bounds::<Item>(offset);
1502 self.0.encode(encoder, offset + 0, depth)?;
1506 self.1.encode(encoder, offset + 16, depth)?;
1507 Ok(())
1508 }
1509 }
1510
1511 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Item {
1512 #[inline(always)]
1513 fn new_empty() -> Self {
1514 Self {
1515 key: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1516 value: fidl::new_empty!(fidl::encoding::Vector<u8, 64000>, D),
1517 }
1518 }
1519
1520 #[inline]
1521 unsafe fn decode(
1522 &mut self,
1523 decoder: &mut fidl::encoding::Decoder<'_, D>,
1524 offset: usize,
1525 _depth: fidl::encoding::Depth,
1526 ) -> fidl::Result<()> {
1527 decoder.debug_check_bounds::<Self>(offset);
1528 fidl::decode!(
1530 fidl::encoding::BoundedString<128>,
1531 D,
1532 &mut self.key,
1533 decoder,
1534 offset + 0,
1535 _depth
1536 )?;
1537 fidl::decode!(fidl::encoding::Vector<u8, 64000>, D, &mut self.value, decoder, offset + 16, _depth)?;
1538 Ok(())
1539 }
1540 }
1541
1542 impl fidl::encoding::ValueTypeMarker for IteratorGetResponse {
1543 type Borrowed<'a> = &'a Self;
1544 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1545 value
1546 }
1547 }
1548
1549 unsafe impl fidl::encoding::TypeMarker for IteratorGetResponse {
1550 type Owned = Self;
1551
1552 #[inline(always)]
1553 fn inline_align(_context: fidl::encoding::Context) -> usize {
1554 8
1555 }
1556
1557 #[inline(always)]
1558 fn inline_size(_context: fidl::encoding::Context) -> usize {
1559 16
1560 }
1561 }
1562
1563 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IteratorGetResponse, D>
1564 for &IteratorGetResponse
1565 {
1566 #[inline]
1567 unsafe fn encode(
1568 self,
1569 encoder: &mut fidl::encoding::Encoder<'_, D>,
1570 offset: usize,
1571 _depth: fidl::encoding::Depth,
1572 ) -> fidl::Result<()> {
1573 encoder.debug_check_bounds::<IteratorGetResponse>(offset);
1574 fidl::encoding::Encode::<IteratorGetResponse, D>::encode(
1576 (
1577 <fidl::encoding::Vector<fidl::encoding::BoundedString<128>, 10> as fidl::encoding::ValueTypeMarker>::borrow(&self.entries),
1578 ),
1579 encoder, offset, _depth
1580 )
1581 }
1582 }
1583 unsafe impl<
1584 D: fidl::encoding::ResourceDialect,
1585 T0: fidl::encoding::Encode<
1586 fidl::encoding::Vector<fidl::encoding::BoundedString<128>, 10>,
1587 D,
1588 >,
1589 > fidl::encoding::Encode<IteratorGetResponse, D> for (T0,)
1590 {
1591 #[inline]
1592 unsafe fn encode(
1593 self,
1594 encoder: &mut fidl::encoding::Encoder<'_, D>,
1595 offset: usize,
1596 depth: fidl::encoding::Depth,
1597 ) -> fidl::Result<()> {
1598 encoder.debug_check_bounds::<IteratorGetResponse>(offset);
1599 self.0.encode(encoder, offset + 0, depth)?;
1603 Ok(())
1604 }
1605 }
1606
1607 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IteratorGetResponse {
1608 #[inline(always)]
1609 fn new_empty() -> Self {
1610 Self {
1611 entries: fidl::new_empty!(
1612 fidl::encoding::Vector<fidl::encoding::BoundedString<128>, 10>,
1613 D
1614 ),
1615 }
1616 }
1617
1618 #[inline]
1619 unsafe fn decode(
1620 &mut self,
1621 decoder: &mut fidl::encoding::Decoder<'_, D>,
1622 offset: usize,
1623 _depth: fidl::encoding::Depth,
1624 ) -> fidl::Result<()> {
1625 decoder.debug_check_bounds::<Self>(offset);
1626 fidl::decode!(
1628 fidl::encoding::Vector<fidl::encoding::BoundedString<128>, 10>,
1629 D,
1630 &mut self.entries,
1631 decoder,
1632 offset + 0,
1633 _depth
1634 )?;
1635 Ok(())
1636 }
1637 }
1638
1639 impl fidl::encoding::ResourceTypeMarker for StoreIterateRequest {
1640 type Borrowed<'a> = &'a mut Self;
1641 fn take_or_borrow<'a>(
1642 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1643 ) -> Self::Borrowed<'a> {
1644 value
1645 }
1646 }
1647
1648 unsafe impl fidl::encoding::TypeMarker for StoreIterateRequest {
1649 type Owned = Self;
1650
1651 #[inline(always)]
1652 fn inline_align(_context: fidl::encoding::Context) -> usize {
1653 8
1654 }
1655
1656 #[inline(always)]
1657 fn inline_size(_context: fidl::encoding::Context) -> usize {
1658 24
1659 }
1660 }
1661
1662 unsafe impl
1663 fidl::encoding::Encode<StoreIterateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1664 for &mut StoreIterateRequest
1665 {
1666 #[inline]
1667 unsafe fn encode(
1668 self,
1669 encoder: &mut fidl::encoding::Encoder<
1670 '_,
1671 fidl::encoding::DefaultFuchsiaResourceDialect,
1672 >,
1673 offset: usize,
1674 _depth: fidl::encoding::Depth,
1675 ) -> fidl::Result<()> {
1676 encoder.debug_check_bounds::<StoreIterateRequest>(offset);
1677 fidl::encoding::Encode::<StoreIterateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1679 (
1680 <fidl::encoding::Optional<fidl::encoding::BoundedString<128>> as fidl::encoding::ValueTypeMarker>::borrow(&self.starting_at),
1681 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
1682 ),
1683 encoder, offset, _depth
1684 )
1685 }
1686 }
1687 unsafe impl<
1688 T0: fidl::encoding::Encode<
1689 fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
1690 fidl::encoding::DefaultFuchsiaResourceDialect,
1691 >,
1692 T1: fidl::encoding::Encode<
1693 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IteratorMarker>>,
1694 fidl::encoding::DefaultFuchsiaResourceDialect,
1695 >,
1696 >
1697 fidl::encoding::Encode<StoreIterateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1698 for (T0, T1)
1699 {
1700 #[inline]
1701 unsafe fn encode(
1702 self,
1703 encoder: &mut fidl::encoding::Encoder<
1704 '_,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 >,
1707 offset: usize,
1708 depth: fidl::encoding::Depth,
1709 ) -> fidl::Result<()> {
1710 encoder.debug_check_bounds::<StoreIterateRequest>(offset);
1711 unsafe {
1714 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1715 (ptr as *mut u64).write_unaligned(0);
1716 }
1717 self.0.encode(encoder, offset + 0, depth)?;
1719 self.1.encode(encoder, offset + 16, depth)?;
1720 Ok(())
1721 }
1722 }
1723
1724 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1725 for StoreIterateRequest
1726 {
1727 #[inline(always)]
1728 fn new_empty() -> Self {
1729 Self {
1730 starting_at: fidl::new_empty!(
1731 fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
1732 fidl::encoding::DefaultFuchsiaResourceDialect
1733 ),
1734 iterator: fidl::new_empty!(
1735 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IteratorMarker>>,
1736 fidl::encoding::DefaultFuchsiaResourceDialect
1737 ),
1738 }
1739 }
1740
1741 #[inline]
1742 unsafe fn decode(
1743 &mut self,
1744 decoder: &mut fidl::encoding::Decoder<
1745 '_,
1746 fidl::encoding::DefaultFuchsiaResourceDialect,
1747 >,
1748 offset: usize,
1749 _depth: fidl::encoding::Depth,
1750 ) -> fidl::Result<()> {
1751 decoder.debug_check_bounds::<Self>(offset);
1752 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1754 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1755 let mask = 0xffffffff00000000u64;
1756 let maskedval = padval & mask;
1757 if maskedval != 0 {
1758 return Err(fidl::Error::NonZeroPadding {
1759 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1760 });
1761 }
1762 fidl::decode!(
1763 fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
1764 fidl::encoding::DefaultFuchsiaResourceDialect,
1765 &mut self.starting_at,
1766 decoder,
1767 offset + 0,
1768 _depth
1769 )?;
1770 fidl::decode!(
1771 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IteratorMarker>>,
1772 fidl::encoding::DefaultFuchsiaResourceDialect,
1773 &mut self.iterator,
1774 decoder,
1775 offset + 16,
1776 _depth
1777 )?;
1778 Ok(())
1779 }
1780 }
1781
1782 impl fidl::encoding::ValueTypeMarker for StoreWriteItemRequest {
1783 type Borrowed<'a> = &'a Self;
1784 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1785 value
1786 }
1787 }
1788
1789 unsafe impl fidl::encoding::TypeMarker for StoreWriteItemRequest {
1790 type Owned = Self;
1791
1792 #[inline(always)]
1793 fn inline_align(_context: fidl::encoding::Context) -> usize {
1794 8
1795 }
1796
1797 #[inline(always)]
1798 fn inline_size(_context: fidl::encoding::Context) -> usize {
1799 32
1800 }
1801 }
1802
1803 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StoreWriteItemRequest, D>
1804 for &StoreWriteItemRequest
1805 {
1806 #[inline]
1807 unsafe fn encode(
1808 self,
1809 encoder: &mut fidl::encoding::Encoder<'_, D>,
1810 offset: usize,
1811 _depth: fidl::encoding::Depth,
1812 ) -> fidl::Result<()> {
1813 encoder.debug_check_bounds::<StoreWriteItemRequest>(offset);
1814 fidl::encoding::Encode::<StoreWriteItemRequest, D>::encode(
1816 (<Item as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt),),
1817 encoder,
1818 offset,
1819 _depth,
1820 )
1821 }
1822 }
1823 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Item, D>>
1824 fidl::encoding::Encode<StoreWriteItemRequest, D> for (T0,)
1825 {
1826 #[inline]
1827 unsafe fn encode(
1828 self,
1829 encoder: &mut fidl::encoding::Encoder<'_, D>,
1830 offset: usize,
1831 depth: fidl::encoding::Depth,
1832 ) -> fidl::Result<()> {
1833 encoder.debug_check_bounds::<StoreWriteItemRequest>(offset);
1834 self.0.encode(encoder, offset + 0, depth)?;
1838 Ok(())
1839 }
1840 }
1841
1842 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StoreWriteItemRequest {
1843 #[inline(always)]
1844 fn new_empty() -> Self {
1845 Self { attempt: fidl::new_empty!(Item, D) }
1846 }
1847
1848 #[inline]
1849 unsafe fn decode(
1850 &mut self,
1851 decoder: &mut fidl::encoding::Decoder<'_, D>,
1852 offset: usize,
1853 _depth: fidl::encoding::Depth,
1854 ) -> fidl::Result<()> {
1855 decoder.debug_check_bounds::<Self>(offset);
1856 fidl::decode!(Item, D, &mut self.attempt, decoder, offset + 0, _depth)?;
1858 Ok(())
1859 }
1860 }
1861}