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 _};
10pub use fidl_fuchsia_examples_services_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ReadOnlyAccountMarker;
16
17impl fidl::endpoints::ProtocolMarker for ReadOnlyAccountMarker {
18 type Proxy = ReadOnlyAccountProxy;
19 type RequestStream = ReadOnlyAccountRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = ReadOnlyAccountSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) ReadOnlyAccount";
24}
25
26pub trait ReadOnlyAccountProxyInterface: Send + Sync {
27 type GetOwnerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
28 fn r#get_owner(&self) -> Self::GetOwnerResponseFut;
29 type GetBalanceResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
30 fn r#get_balance(&self) -> Self::GetBalanceResponseFut;
31}
32#[derive(Debug)]
33#[cfg(target_os = "fuchsia")]
34pub struct ReadOnlyAccountSynchronousProxy {
35 client: fidl::client::sync::Client,
36}
37
38#[cfg(target_os = "fuchsia")]
39impl fidl::endpoints::SynchronousProxy for ReadOnlyAccountSynchronousProxy {
40 type Proxy = ReadOnlyAccountProxy;
41 type Protocol = ReadOnlyAccountMarker;
42
43 fn from_channel(inner: fidl::Channel) -> Self {
44 Self::new(inner)
45 }
46
47 fn into_channel(self) -> fidl::Channel {
48 self.client.into_channel()
49 }
50
51 fn as_channel(&self) -> &fidl::Channel {
52 self.client.as_channel()
53 }
54}
55
56#[cfg(target_os = "fuchsia")]
57impl ReadOnlyAccountSynchronousProxy {
58 pub fn new(channel: fidl::Channel) -> Self {
59 let protocol_name = <ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
60 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
61 }
62
63 pub fn into_channel(self) -> fidl::Channel {
64 self.client.into_channel()
65 }
66
67 pub fn wait_for_event(
70 &self,
71 deadline: zx::MonotonicInstant,
72 ) -> Result<ReadOnlyAccountEvent, fidl::Error> {
73 ReadOnlyAccountEvent::decode(self.client.wait_for_event(deadline)?)
74 }
75
76 pub fn r#get_owner(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
78 let _response = self
79 .client
80 .send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetOwnerResponse>(
81 (),
82 0x553f661d27b2273a,
83 fidl::encoding::DynamicFlags::empty(),
84 ___deadline,
85 )?;
86 Ok(_response.owner)
87 }
88
89 pub fn r#get_balance(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
91 let _response = self
92 .client
93 .send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetBalanceResponse>(
94 (),
95 0x35ffed4715b1b3ac,
96 fidl::encoding::DynamicFlags::empty(),
97 ___deadline,
98 )?;
99 Ok(_response.balance)
100 }
101}
102
103#[derive(Debug, Clone)]
104pub struct ReadOnlyAccountProxy {
105 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
106}
107
108impl fidl::endpoints::Proxy for ReadOnlyAccountProxy {
109 type Protocol = ReadOnlyAccountMarker;
110
111 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
112 Self::new(inner)
113 }
114
115 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
116 self.client.into_channel().map_err(|client| Self { client })
117 }
118
119 fn as_channel(&self) -> &::fidl::AsyncChannel {
120 self.client.as_channel()
121 }
122}
123
124impl ReadOnlyAccountProxy {
125 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
127 let protocol_name = <ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
128 Self { client: fidl::client::Client::new(channel, protocol_name) }
129 }
130
131 pub fn take_event_stream(&self) -> ReadOnlyAccountEventStream {
137 ReadOnlyAccountEventStream { event_receiver: self.client.take_event_receiver() }
138 }
139
140 pub fn r#get_owner(
142 &self,
143 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
144 ReadOnlyAccountProxyInterface::r#get_owner(self)
145 }
146
147 pub fn r#get_balance(
149 &self,
150 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
151 ReadOnlyAccountProxyInterface::r#get_balance(self)
152 }
153}
154
155impl ReadOnlyAccountProxyInterface for ReadOnlyAccountProxy {
156 type GetOwnerResponseFut =
157 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
158 fn r#get_owner(&self) -> Self::GetOwnerResponseFut {
159 fn _decode(
160 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
161 ) -> Result<String, fidl::Error> {
162 let _response = fidl::client::decode_transaction_body::<
163 ReadOnlyAccountGetOwnerResponse,
164 fidl::encoding::DefaultFuchsiaResourceDialect,
165 0x553f661d27b2273a,
166 >(_buf?)?;
167 Ok(_response.owner)
168 }
169 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
170 (),
171 0x553f661d27b2273a,
172 fidl::encoding::DynamicFlags::empty(),
173 _decode,
174 )
175 }
176
177 type GetBalanceResponseFut =
178 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
179 fn r#get_balance(&self) -> Self::GetBalanceResponseFut {
180 fn _decode(
181 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
182 ) -> Result<i64, fidl::Error> {
183 let _response = fidl::client::decode_transaction_body::<
184 ReadOnlyAccountGetBalanceResponse,
185 fidl::encoding::DefaultFuchsiaResourceDialect,
186 0x35ffed4715b1b3ac,
187 >(_buf?)?;
188 Ok(_response.balance)
189 }
190 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
191 (),
192 0x35ffed4715b1b3ac,
193 fidl::encoding::DynamicFlags::empty(),
194 _decode,
195 )
196 }
197}
198
199pub struct ReadOnlyAccountEventStream {
200 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
201}
202
203impl std::marker::Unpin for ReadOnlyAccountEventStream {}
204
205impl futures::stream::FusedStream for ReadOnlyAccountEventStream {
206 fn is_terminated(&self) -> bool {
207 self.event_receiver.is_terminated()
208 }
209}
210
211impl futures::Stream for ReadOnlyAccountEventStream {
212 type Item = Result<ReadOnlyAccountEvent, fidl::Error>;
213
214 fn poll_next(
215 mut self: std::pin::Pin<&mut Self>,
216 cx: &mut std::task::Context<'_>,
217 ) -> std::task::Poll<Option<Self::Item>> {
218 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
219 &mut self.event_receiver,
220 cx
221 )?) {
222 Some(buf) => std::task::Poll::Ready(Some(ReadOnlyAccountEvent::decode(buf))),
223 None => std::task::Poll::Ready(None),
224 }
225 }
226}
227
228#[derive(Debug)]
229pub enum ReadOnlyAccountEvent {}
230
231impl ReadOnlyAccountEvent {
232 fn decode(
234 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
235 ) -> Result<ReadOnlyAccountEvent, fidl::Error> {
236 let (bytes, _handles) = buf.split_mut();
237 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
238 debug_assert_eq!(tx_header.tx_id, 0);
239 match tx_header.ordinal {
240 _ => Err(fidl::Error::UnknownOrdinal {
241 ordinal: tx_header.ordinal,
242 protocol_name:
243 <ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
244 }),
245 }
246 }
247}
248
249pub struct ReadOnlyAccountRequestStream {
251 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
252 is_terminated: bool,
253}
254
255impl std::marker::Unpin for ReadOnlyAccountRequestStream {}
256
257impl futures::stream::FusedStream for ReadOnlyAccountRequestStream {
258 fn is_terminated(&self) -> bool {
259 self.is_terminated
260 }
261}
262
263impl fidl::endpoints::RequestStream for ReadOnlyAccountRequestStream {
264 type Protocol = ReadOnlyAccountMarker;
265 type ControlHandle = ReadOnlyAccountControlHandle;
266
267 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
268 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
269 }
270
271 fn control_handle(&self) -> Self::ControlHandle {
272 ReadOnlyAccountControlHandle { inner: self.inner.clone() }
273 }
274
275 fn into_inner(
276 self,
277 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
278 {
279 (self.inner, self.is_terminated)
280 }
281
282 fn from_inner(
283 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
284 is_terminated: bool,
285 ) -> Self {
286 Self { inner, is_terminated }
287 }
288}
289
290impl futures::Stream for ReadOnlyAccountRequestStream {
291 type Item = Result<ReadOnlyAccountRequest, fidl::Error>;
292
293 fn poll_next(
294 mut self: std::pin::Pin<&mut Self>,
295 cx: &mut std::task::Context<'_>,
296 ) -> std::task::Poll<Option<Self::Item>> {
297 let this = &mut *self;
298 if this.inner.check_shutdown(cx) {
299 this.is_terminated = true;
300 return std::task::Poll::Ready(None);
301 }
302 if this.is_terminated {
303 panic!("polled ReadOnlyAccountRequestStream after completion");
304 }
305 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
306 |bytes, handles| {
307 match this.inner.channel().read_etc(cx, bytes, handles) {
308 std::task::Poll::Ready(Ok(())) => {}
309 std::task::Poll::Pending => return std::task::Poll::Pending,
310 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
311 this.is_terminated = true;
312 return std::task::Poll::Ready(None);
313 }
314 std::task::Poll::Ready(Err(e)) => {
315 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
316 e.into(),
317 ))))
318 }
319 }
320
321 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
323
324 std::task::Poll::Ready(Some(match header.ordinal {
325 0x553f661d27b2273a => {
326 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
327 let mut req = fidl::new_empty!(
328 fidl::encoding::EmptyPayload,
329 fidl::encoding::DefaultFuchsiaResourceDialect
330 );
331 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
332 let control_handle =
333 ReadOnlyAccountControlHandle { inner: this.inner.clone() };
334 Ok(ReadOnlyAccountRequest::GetOwner {
335 responder: ReadOnlyAccountGetOwnerResponder {
336 control_handle: std::mem::ManuallyDrop::new(control_handle),
337 tx_id: header.tx_id,
338 },
339 })
340 }
341 0x35ffed4715b1b3ac => {
342 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
343 let mut req = fidl::new_empty!(
344 fidl::encoding::EmptyPayload,
345 fidl::encoding::DefaultFuchsiaResourceDialect
346 );
347 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
348 let control_handle =
349 ReadOnlyAccountControlHandle { inner: this.inner.clone() };
350 Ok(ReadOnlyAccountRequest::GetBalance {
351 responder: ReadOnlyAccountGetBalanceResponder {
352 control_handle: std::mem::ManuallyDrop::new(control_handle),
353 tx_id: header.tx_id,
354 },
355 })
356 }
357 _ => Err(fidl::Error::UnknownOrdinal {
358 ordinal: header.ordinal,
359 protocol_name:
360 <ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
361 }),
362 }))
363 },
364 )
365 }
366}
367
368#[derive(Debug)]
370pub enum ReadOnlyAccountRequest {
371 GetOwner { responder: ReadOnlyAccountGetOwnerResponder },
373 GetBalance { responder: ReadOnlyAccountGetBalanceResponder },
375}
376
377impl ReadOnlyAccountRequest {
378 #[allow(irrefutable_let_patterns)]
379 pub fn into_get_owner(self) -> Option<(ReadOnlyAccountGetOwnerResponder)> {
380 if let ReadOnlyAccountRequest::GetOwner { responder } = self {
381 Some((responder))
382 } else {
383 None
384 }
385 }
386
387 #[allow(irrefutable_let_patterns)]
388 pub fn into_get_balance(self) -> Option<(ReadOnlyAccountGetBalanceResponder)> {
389 if let ReadOnlyAccountRequest::GetBalance { responder } = self {
390 Some((responder))
391 } else {
392 None
393 }
394 }
395
396 pub fn method_name(&self) -> &'static str {
398 match *self {
399 ReadOnlyAccountRequest::GetOwner { .. } => "get_owner",
400 ReadOnlyAccountRequest::GetBalance { .. } => "get_balance",
401 }
402 }
403}
404
405#[derive(Debug, Clone)]
406pub struct ReadOnlyAccountControlHandle {
407 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
408}
409
410impl fidl::endpoints::ControlHandle for ReadOnlyAccountControlHandle {
411 fn shutdown(&self) {
412 self.inner.shutdown()
413 }
414 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
415 self.inner.shutdown_with_epitaph(status)
416 }
417
418 fn is_closed(&self) -> bool {
419 self.inner.channel().is_closed()
420 }
421 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
422 self.inner.channel().on_closed()
423 }
424
425 #[cfg(target_os = "fuchsia")]
426 fn signal_peer(
427 &self,
428 clear_mask: zx::Signals,
429 set_mask: zx::Signals,
430 ) -> Result<(), zx_status::Status> {
431 use fidl::Peered;
432 self.inner.channel().signal_peer(clear_mask, set_mask)
433 }
434}
435
436impl ReadOnlyAccountControlHandle {}
437
438#[must_use = "FIDL methods require a response to be sent"]
439#[derive(Debug)]
440pub struct ReadOnlyAccountGetOwnerResponder {
441 control_handle: std::mem::ManuallyDrop<ReadOnlyAccountControlHandle>,
442 tx_id: u32,
443}
444
445impl std::ops::Drop for ReadOnlyAccountGetOwnerResponder {
449 fn drop(&mut self) {
450 self.control_handle.shutdown();
451 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
453 }
454}
455
456impl fidl::endpoints::Responder for ReadOnlyAccountGetOwnerResponder {
457 type ControlHandle = ReadOnlyAccountControlHandle;
458
459 fn control_handle(&self) -> &ReadOnlyAccountControlHandle {
460 &self.control_handle
461 }
462
463 fn drop_without_shutdown(mut self) {
464 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
466 std::mem::forget(self);
468 }
469}
470
471impl ReadOnlyAccountGetOwnerResponder {
472 pub fn send(self, mut owner: &str) -> Result<(), fidl::Error> {
476 let _result = self.send_raw(owner);
477 if _result.is_err() {
478 self.control_handle.shutdown();
479 }
480 self.drop_without_shutdown();
481 _result
482 }
483
484 pub fn send_no_shutdown_on_err(self, mut owner: &str) -> Result<(), fidl::Error> {
486 let _result = self.send_raw(owner);
487 self.drop_without_shutdown();
488 _result
489 }
490
491 fn send_raw(&self, mut owner: &str) -> Result<(), fidl::Error> {
492 self.control_handle.inner.send::<ReadOnlyAccountGetOwnerResponse>(
493 (owner,),
494 self.tx_id,
495 0x553f661d27b2273a,
496 fidl::encoding::DynamicFlags::empty(),
497 )
498 }
499}
500
501#[must_use = "FIDL methods require a response to be sent"]
502#[derive(Debug)]
503pub struct ReadOnlyAccountGetBalanceResponder {
504 control_handle: std::mem::ManuallyDrop<ReadOnlyAccountControlHandle>,
505 tx_id: u32,
506}
507
508impl std::ops::Drop for ReadOnlyAccountGetBalanceResponder {
512 fn drop(&mut self) {
513 self.control_handle.shutdown();
514 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
516 }
517}
518
519impl fidl::endpoints::Responder for ReadOnlyAccountGetBalanceResponder {
520 type ControlHandle = ReadOnlyAccountControlHandle;
521
522 fn control_handle(&self) -> &ReadOnlyAccountControlHandle {
523 &self.control_handle
524 }
525
526 fn drop_without_shutdown(mut self) {
527 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
529 std::mem::forget(self);
531 }
532}
533
534impl ReadOnlyAccountGetBalanceResponder {
535 pub fn send(self, mut balance: i64) -> Result<(), fidl::Error> {
539 let _result = self.send_raw(balance);
540 if _result.is_err() {
541 self.control_handle.shutdown();
542 }
543 self.drop_without_shutdown();
544 _result
545 }
546
547 pub fn send_no_shutdown_on_err(self, mut balance: i64) -> Result<(), fidl::Error> {
549 let _result = self.send_raw(balance);
550 self.drop_without_shutdown();
551 _result
552 }
553
554 fn send_raw(&self, mut balance: i64) -> Result<(), fidl::Error> {
555 self.control_handle.inner.send::<ReadOnlyAccountGetBalanceResponse>(
556 (balance,),
557 self.tx_id,
558 0x35ffed4715b1b3ac,
559 fidl::encoding::DynamicFlags::empty(),
560 )
561 }
562}
563
564#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
565pub struct ReadWriteAccountMarker;
566
567impl fidl::endpoints::ProtocolMarker for ReadWriteAccountMarker {
568 type Proxy = ReadWriteAccountProxy;
569 type RequestStream = ReadWriteAccountRequestStream;
570 #[cfg(target_os = "fuchsia")]
571 type SynchronousProxy = ReadWriteAccountSynchronousProxy;
572
573 const DEBUG_NAME: &'static str = "(anonymous) ReadWriteAccount";
574}
575
576pub trait ReadWriteAccountProxyInterface: Send + Sync {
577 type GetOwnerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
578 fn r#get_owner(&self) -> Self::GetOwnerResponseFut;
579 type GetBalanceResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
580 fn r#get_balance(&self) -> Self::GetBalanceResponseFut;
581 type DebitResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
582 fn r#debit(&self, amount: i64) -> Self::DebitResponseFut;
583 type CreditResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
584 fn r#credit(&self, amount: i64) -> Self::CreditResponseFut;
585}
586#[derive(Debug)]
587#[cfg(target_os = "fuchsia")]
588pub struct ReadWriteAccountSynchronousProxy {
589 client: fidl::client::sync::Client,
590}
591
592#[cfg(target_os = "fuchsia")]
593impl fidl::endpoints::SynchronousProxy for ReadWriteAccountSynchronousProxy {
594 type Proxy = ReadWriteAccountProxy;
595 type Protocol = ReadWriteAccountMarker;
596
597 fn from_channel(inner: fidl::Channel) -> Self {
598 Self::new(inner)
599 }
600
601 fn into_channel(self) -> fidl::Channel {
602 self.client.into_channel()
603 }
604
605 fn as_channel(&self) -> &fidl::Channel {
606 self.client.as_channel()
607 }
608}
609
610#[cfg(target_os = "fuchsia")]
611impl ReadWriteAccountSynchronousProxy {
612 pub fn new(channel: fidl::Channel) -> Self {
613 let protocol_name = <ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
614 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
615 }
616
617 pub fn into_channel(self) -> fidl::Channel {
618 self.client.into_channel()
619 }
620
621 pub fn wait_for_event(
624 &self,
625 deadline: zx::MonotonicInstant,
626 ) -> Result<ReadWriteAccountEvent, fidl::Error> {
627 ReadWriteAccountEvent::decode(self.client.wait_for_event(deadline)?)
628 }
629
630 pub fn r#get_owner(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
632 let _response = self
633 .client
634 .send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetOwnerResponse>(
635 (),
636 0x553f661d27b2273a,
637 fidl::encoding::DynamicFlags::empty(),
638 ___deadline,
639 )?;
640 Ok(_response.owner)
641 }
642
643 pub fn r#get_balance(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
645 let _response = self
646 .client
647 .send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetBalanceResponse>(
648 (),
649 0x35ffed4715b1b3ac,
650 fidl::encoding::DynamicFlags::empty(),
651 ___deadline,
652 )?;
653 Ok(_response.balance)
654 }
655
656 pub fn r#debit(
659 &self,
660 mut amount: i64,
661 ___deadline: zx::MonotonicInstant,
662 ) -> Result<bool, fidl::Error> {
663 let _response =
664 self.client.send_query::<ReadWriteAccountDebitRequest, ReadWriteAccountDebitResponse>(
665 (amount,),
666 0x2fa6ce7839974858,
667 fidl::encoding::DynamicFlags::empty(),
668 ___deadline,
669 )?;
670 Ok(_response.succeeded)
671 }
672
673 pub fn r#credit(
675 &self,
676 mut amount: i64,
677 ___deadline: zx::MonotonicInstant,
678 ) -> Result<(), fidl::Error> {
679 let _response =
680 self.client.send_query::<ReadWriteAccountCreditRequest, fidl::encoding::EmptyPayload>(
681 (amount,),
682 0x37c216ac70d94bd5,
683 fidl::encoding::DynamicFlags::empty(),
684 ___deadline,
685 )?;
686 Ok(_response)
687 }
688}
689
690#[derive(Debug, Clone)]
691pub struct ReadWriteAccountProxy {
692 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
693}
694
695impl fidl::endpoints::Proxy for ReadWriteAccountProxy {
696 type Protocol = ReadWriteAccountMarker;
697
698 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
699 Self::new(inner)
700 }
701
702 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
703 self.client.into_channel().map_err(|client| Self { client })
704 }
705
706 fn as_channel(&self) -> &::fidl::AsyncChannel {
707 self.client.as_channel()
708 }
709}
710
711impl ReadWriteAccountProxy {
712 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
714 let protocol_name = <ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
715 Self { client: fidl::client::Client::new(channel, protocol_name) }
716 }
717
718 pub fn take_event_stream(&self) -> ReadWriteAccountEventStream {
724 ReadWriteAccountEventStream { event_receiver: self.client.take_event_receiver() }
725 }
726
727 pub fn r#get_owner(
729 &self,
730 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
731 ReadWriteAccountProxyInterface::r#get_owner(self)
732 }
733
734 pub fn r#get_balance(
736 &self,
737 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
738 ReadWriteAccountProxyInterface::r#get_balance(self)
739 }
740
741 pub fn r#debit(
744 &self,
745 mut amount: i64,
746 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
747 ReadWriteAccountProxyInterface::r#debit(self, amount)
748 }
749
750 pub fn r#credit(
752 &self,
753 mut amount: i64,
754 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
755 ReadWriteAccountProxyInterface::r#credit(self, amount)
756 }
757}
758
759impl ReadWriteAccountProxyInterface for ReadWriteAccountProxy {
760 type GetOwnerResponseFut =
761 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
762 fn r#get_owner(&self) -> Self::GetOwnerResponseFut {
763 fn _decode(
764 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
765 ) -> Result<String, fidl::Error> {
766 let _response = fidl::client::decode_transaction_body::<
767 ReadOnlyAccountGetOwnerResponse,
768 fidl::encoding::DefaultFuchsiaResourceDialect,
769 0x553f661d27b2273a,
770 >(_buf?)?;
771 Ok(_response.owner)
772 }
773 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
774 (),
775 0x553f661d27b2273a,
776 fidl::encoding::DynamicFlags::empty(),
777 _decode,
778 )
779 }
780
781 type GetBalanceResponseFut =
782 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
783 fn r#get_balance(&self) -> Self::GetBalanceResponseFut {
784 fn _decode(
785 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
786 ) -> Result<i64, fidl::Error> {
787 let _response = fidl::client::decode_transaction_body::<
788 ReadOnlyAccountGetBalanceResponse,
789 fidl::encoding::DefaultFuchsiaResourceDialect,
790 0x35ffed4715b1b3ac,
791 >(_buf?)?;
792 Ok(_response.balance)
793 }
794 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
795 (),
796 0x35ffed4715b1b3ac,
797 fidl::encoding::DynamicFlags::empty(),
798 _decode,
799 )
800 }
801
802 type DebitResponseFut =
803 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
804 fn r#debit(&self, mut amount: i64) -> Self::DebitResponseFut {
805 fn _decode(
806 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
807 ) -> Result<bool, fidl::Error> {
808 let _response = fidl::client::decode_transaction_body::<
809 ReadWriteAccountDebitResponse,
810 fidl::encoding::DefaultFuchsiaResourceDialect,
811 0x2fa6ce7839974858,
812 >(_buf?)?;
813 Ok(_response.succeeded)
814 }
815 self.client.send_query_and_decode::<ReadWriteAccountDebitRequest, bool>(
816 (amount,),
817 0x2fa6ce7839974858,
818 fidl::encoding::DynamicFlags::empty(),
819 _decode,
820 )
821 }
822
823 type CreditResponseFut =
824 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
825 fn r#credit(&self, mut amount: i64) -> Self::CreditResponseFut {
826 fn _decode(
827 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
828 ) -> Result<(), fidl::Error> {
829 let _response = fidl::client::decode_transaction_body::<
830 fidl::encoding::EmptyPayload,
831 fidl::encoding::DefaultFuchsiaResourceDialect,
832 0x37c216ac70d94bd5,
833 >(_buf?)?;
834 Ok(_response)
835 }
836 self.client.send_query_and_decode::<ReadWriteAccountCreditRequest, ()>(
837 (amount,),
838 0x37c216ac70d94bd5,
839 fidl::encoding::DynamicFlags::empty(),
840 _decode,
841 )
842 }
843}
844
845pub struct ReadWriteAccountEventStream {
846 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
847}
848
849impl std::marker::Unpin for ReadWriteAccountEventStream {}
850
851impl futures::stream::FusedStream for ReadWriteAccountEventStream {
852 fn is_terminated(&self) -> bool {
853 self.event_receiver.is_terminated()
854 }
855}
856
857impl futures::Stream for ReadWriteAccountEventStream {
858 type Item = Result<ReadWriteAccountEvent, fidl::Error>;
859
860 fn poll_next(
861 mut self: std::pin::Pin<&mut Self>,
862 cx: &mut std::task::Context<'_>,
863 ) -> std::task::Poll<Option<Self::Item>> {
864 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
865 &mut self.event_receiver,
866 cx
867 )?) {
868 Some(buf) => std::task::Poll::Ready(Some(ReadWriteAccountEvent::decode(buf))),
869 None => std::task::Poll::Ready(None),
870 }
871 }
872}
873
874#[derive(Debug)]
875pub enum ReadWriteAccountEvent {}
876
877impl ReadWriteAccountEvent {
878 fn decode(
880 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
881 ) -> Result<ReadWriteAccountEvent, fidl::Error> {
882 let (bytes, _handles) = buf.split_mut();
883 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
884 debug_assert_eq!(tx_header.tx_id, 0);
885 match tx_header.ordinal {
886 _ => Err(fidl::Error::UnknownOrdinal {
887 ordinal: tx_header.ordinal,
888 protocol_name:
889 <ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
890 }),
891 }
892 }
893}
894
895pub struct ReadWriteAccountRequestStream {
897 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
898 is_terminated: bool,
899}
900
901impl std::marker::Unpin for ReadWriteAccountRequestStream {}
902
903impl futures::stream::FusedStream for ReadWriteAccountRequestStream {
904 fn is_terminated(&self) -> bool {
905 self.is_terminated
906 }
907}
908
909impl fidl::endpoints::RequestStream for ReadWriteAccountRequestStream {
910 type Protocol = ReadWriteAccountMarker;
911 type ControlHandle = ReadWriteAccountControlHandle;
912
913 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
914 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
915 }
916
917 fn control_handle(&self) -> Self::ControlHandle {
918 ReadWriteAccountControlHandle { inner: self.inner.clone() }
919 }
920
921 fn into_inner(
922 self,
923 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
924 {
925 (self.inner, self.is_terminated)
926 }
927
928 fn from_inner(
929 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
930 is_terminated: bool,
931 ) -> Self {
932 Self { inner, is_terminated }
933 }
934}
935
936impl futures::Stream for ReadWriteAccountRequestStream {
937 type Item = Result<ReadWriteAccountRequest, fidl::Error>;
938
939 fn poll_next(
940 mut self: std::pin::Pin<&mut Self>,
941 cx: &mut std::task::Context<'_>,
942 ) -> std::task::Poll<Option<Self::Item>> {
943 let this = &mut *self;
944 if this.inner.check_shutdown(cx) {
945 this.is_terminated = true;
946 return std::task::Poll::Ready(None);
947 }
948 if this.is_terminated {
949 panic!("polled ReadWriteAccountRequestStream after completion");
950 }
951 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
952 |bytes, handles| {
953 match this.inner.channel().read_etc(cx, bytes, handles) {
954 std::task::Poll::Ready(Ok(())) => {}
955 std::task::Poll::Pending => return std::task::Poll::Pending,
956 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
957 this.is_terminated = true;
958 return std::task::Poll::Ready(None);
959 }
960 std::task::Poll::Ready(Err(e)) => {
961 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
962 e.into(),
963 ))))
964 }
965 }
966
967 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
969
970 std::task::Poll::Ready(Some(match header.ordinal {
971 0x553f661d27b2273a => {
972 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
973 let mut req = fidl::new_empty!(
974 fidl::encoding::EmptyPayload,
975 fidl::encoding::DefaultFuchsiaResourceDialect
976 );
977 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
978 let control_handle =
979 ReadWriteAccountControlHandle { inner: this.inner.clone() };
980 Ok(ReadWriteAccountRequest::GetOwner {
981 responder: ReadWriteAccountGetOwnerResponder {
982 control_handle: std::mem::ManuallyDrop::new(control_handle),
983 tx_id: header.tx_id,
984 },
985 })
986 }
987 0x35ffed4715b1b3ac => {
988 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
989 let mut req = fidl::new_empty!(
990 fidl::encoding::EmptyPayload,
991 fidl::encoding::DefaultFuchsiaResourceDialect
992 );
993 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
994 let control_handle =
995 ReadWriteAccountControlHandle { inner: this.inner.clone() };
996 Ok(ReadWriteAccountRequest::GetBalance {
997 responder: ReadWriteAccountGetBalanceResponder {
998 control_handle: std::mem::ManuallyDrop::new(control_handle),
999 tx_id: header.tx_id,
1000 },
1001 })
1002 }
1003 0x2fa6ce7839974858 => {
1004 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1005 let mut req = fidl::new_empty!(
1006 ReadWriteAccountDebitRequest,
1007 fidl::encoding::DefaultFuchsiaResourceDialect
1008 );
1009 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReadWriteAccountDebitRequest>(&header, _body_bytes, handles, &mut req)?;
1010 let control_handle =
1011 ReadWriteAccountControlHandle { inner: this.inner.clone() };
1012 Ok(ReadWriteAccountRequest::Debit {
1013 amount: req.amount,
1014
1015 responder: ReadWriteAccountDebitResponder {
1016 control_handle: std::mem::ManuallyDrop::new(control_handle),
1017 tx_id: header.tx_id,
1018 },
1019 })
1020 }
1021 0x37c216ac70d94bd5 => {
1022 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023 let mut req = fidl::new_empty!(
1024 ReadWriteAccountCreditRequest,
1025 fidl::encoding::DefaultFuchsiaResourceDialect
1026 );
1027 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReadWriteAccountCreditRequest>(&header, _body_bytes, handles, &mut req)?;
1028 let control_handle =
1029 ReadWriteAccountControlHandle { inner: this.inner.clone() };
1030 Ok(ReadWriteAccountRequest::Credit {
1031 amount: req.amount,
1032
1033 responder: ReadWriteAccountCreditResponder {
1034 control_handle: std::mem::ManuallyDrop::new(control_handle),
1035 tx_id: header.tx_id,
1036 },
1037 })
1038 }
1039 _ => Err(fidl::Error::UnknownOrdinal {
1040 ordinal: header.ordinal,
1041 protocol_name:
1042 <ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1043 }),
1044 }))
1045 },
1046 )
1047 }
1048}
1049
1050#[derive(Debug)]
1052pub enum ReadWriteAccountRequest {
1053 GetOwner { responder: ReadWriteAccountGetOwnerResponder },
1055 GetBalance { responder: ReadWriteAccountGetBalanceResponder },
1057 Debit { amount: i64, responder: ReadWriteAccountDebitResponder },
1060 Credit { amount: i64, responder: ReadWriteAccountCreditResponder },
1062}
1063
1064impl ReadWriteAccountRequest {
1065 #[allow(irrefutable_let_patterns)]
1066 pub fn into_get_owner(self) -> Option<(ReadWriteAccountGetOwnerResponder)> {
1067 if let ReadWriteAccountRequest::GetOwner { responder } = self {
1068 Some((responder))
1069 } else {
1070 None
1071 }
1072 }
1073
1074 #[allow(irrefutable_let_patterns)]
1075 pub fn into_get_balance(self) -> Option<(ReadWriteAccountGetBalanceResponder)> {
1076 if let ReadWriteAccountRequest::GetBalance { responder } = self {
1077 Some((responder))
1078 } else {
1079 None
1080 }
1081 }
1082
1083 #[allow(irrefutable_let_patterns)]
1084 pub fn into_debit(self) -> Option<(i64, ReadWriteAccountDebitResponder)> {
1085 if let ReadWriteAccountRequest::Debit { amount, responder } = self {
1086 Some((amount, responder))
1087 } else {
1088 None
1089 }
1090 }
1091
1092 #[allow(irrefutable_let_patterns)]
1093 pub fn into_credit(self) -> Option<(i64, ReadWriteAccountCreditResponder)> {
1094 if let ReadWriteAccountRequest::Credit { amount, responder } = self {
1095 Some((amount, responder))
1096 } else {
1097 None
1098 }
1099 }
1100
1101 pub fn method_name(&self) -> &'static str {
1103 match *self {
1104 ReadWriteAccountRequest::GetOwner { .. } => "get_owner",
1105 ReadWriteAccountRequest::GetBalance { .. } => "get_balance",
1106 ReadWriteAccountRequest::Debit { .. } => "debit",
1107 ReadWriteAccountRequest::Credit { .. } => "credit",
1108 }
1109 }
1110}
1111
1112#[derive(Debug, Clone)]
1113pub struct ReadWriteAccountControlHandle {
1114 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1115}
1116
1117impl fidl::endpoints::ControlHandle for ReadWriteAccountControlHandle {
1118 fn shutdown(&self) {
1119 self.inner.shutdown()
1120 }
1121 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1122 self.inner.shutdown_with_epitaph(status)
1123 }
1124
1125 fn is_closed(&self) -> bool {
1126 self.inner.channel().is_closed()
1127 }
1128 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1129 self.inner.channel().on_closed()
1130 }
1131
1132 #[cfg(target_os = "fuchsia")]
1133 fn signal_peer(
1134 &self,
1135 clear_mask: zx::Signals,
1136 set_mask: zx::Signals,
1137 ) -> Result<(), zx_status::Status> {
1138 use fidl::Peered;
1139 self.inner.channel().signal_peer(clear_mask, set_mask)
1140 }
1141}
1142
1143impl ReadWriteAccountControlHandle {}
1144
1145#[must_use = "FIDL methods require a response to be sent"]
1146#[derive(Debug)]
1147pub struct ReadWriteAccountGetOwnerResponder {
1148 control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
1149 tx_id: u32,
1150}
1151
1152impl std::ops::Drop for ReadWriteAccountGetOwnerResponder {
1156 fn drop(&mut self) {
1157 self.control_handle.shutdown();
1158 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1160 }
1161}
1162
1163impl fidl::endpoints::Responder for ReadWriteAccountGetOwnerResponder {
1164 type ControlHandle = ReadWriteAccountControlHandle;
1165
1166 fn control_handle(&self) -> &ReadWriteAccountControlHandle {
1167 &self.control_handle
1168 }
1169
1170 fn drop_without_shutdown(mut self) {
1171 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1173 std::mem::forget(self);
1175 }
1176}
1177
1178impl ReadWriteAccountGetOwnerResponder {
1179 pub fn send(self, mut owner: &str) -> Result<(), fidl::Error> {
1183 let _result = self.send_raw(owner);
1184 if _result.is_err() {
1185 self.control_handle.shutdown();
1186 }
1187 self.drop_without_shutdown();
1188 _result
1189 }
1190
1191 pub fn send_no_shutdown_on_err(self, mut owner: &str) -> Result<(), fidl::Error> {
1193 let _result = self.send_raw(owner);
1194 self.drop_without_shutdown();
1195 _result
1196 }
1197
1198 fn send_raw(&self, mut owner: &str) -> Result<(), fidl::Error> {
1199 self.control_handle.inner.send::<ReadOnlyAccountGetOwnerResponse>(
1200 (owner,),
1201 self.tx_id,
1202 0x553f661d27b2273a,
1203 fidl::encoding::DynamicFlags::empty(),
1204 )
1205 }
1206}
1207
1208#[must_use = "FIDL methods require a response to be sent"]
1209#[derive(Debug)]
1210pub struct ReadWriteAccountGetBalanceResponder {
1211 control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
1212 tx_id: u32,
1213}
1214
1215impl std::ops::Drop for ReadWriteAccountGetBalanceResponder {
1219 fn drop(&mut self) {
1220 self.control_handle.shutdown();
1221 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1223 }
1224}
1225
1226impl fidl::endpoints::Responder for ReadWriteAccountGetBalanceResponder {
1227 type ControlHandle = ReadWriteAccountControlHandle;
1228
1229 fn control_handle(&self) -> &ReadWriteAccountControlHandle {
1230 &self.control_handle
1231 }
1232
1233 fn drop_without_shutdown(mut self) {
1234 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1236 std::mem::forget(self);
1238 }
1239}
1240
1241impl ReadWriteAccountGetBalanceResponder {
1242 pub fn send(self, mut balance: i64) -> Result<(), fidl::Error> {
1246 let _result = self.send_raw(balance);
1247 if _result.is_err() {
1248 self.control_handle.shutdown();
1249 }
1250 self.drop_without_shutdown();
1251 _result
1252 }
1253
1254 pub fn send_no_shutdown_on_err(self, mut balance: i64) -> Result<(), fidl::Error> {
1256 let _result = self.send_raw(balance);
1257 self.drop_without_shutdown();
1258 _result
1259 }
1260
1261 fn send_raw(&self, mut balance: i64) -> Result<(), fidl::Error> {
1262 self.control_handle.inner.send::<ReadOnlyAccountGetBalanceResponse>(
1263 (balance,),
1264 self.tx_id,
1265 0x35ffed4715b1b3ac,
1266 fidl::encoding::DynamicFlags::empty(),
1267 )
1268 }
1269}
1270
1271#[must_use = "FIDL methods require a response to be sent"]
1272#[derive(Debug)]
1273pub struct ReadWriteAccountDebitResponder {
1274 control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
1275 tx_id: u32,
1276}
1277
1278impl std::ops::Drop for ReadWriteAccountDebitResponder {
1282 fn drop(&mut self) {
1283 self.control_handle.shutdown();
1284 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1286 }
1287}
1288
1289impl fidl::endpoints::Responder for ReadWriteAccountDebitResponder {
1290 type ControlHandle = ReadWriteAccountControlHandle;
1291
1292 fn control_handle(&self) -> &ReadWriteAccountControlHandle {
1293 &self.control_handle
1294 }
1295
1296 fn drop_without_shutdown(mut self) {
1297 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1299 std::mem::forget(self);
1301 }
1302}
1303
1304impl ReadWriteAccountDebitResponder {
1305 pub fn send(self, mut succeeded: bool) -> Result<(), fidl::Error> {
1309 let _result = self.send_raw(succeeded);
1310 if _result.is_err() {
1311 self.control_handle.shutdown();
1312 }
1313 self.drop_without_shutdown();
1314 _result
1315 }
1316
1317 pub fn send_no_shutdown_on_err(self, mut succeeded: bool) -> Result<(), fidl::Error> {
1319 let _result = self.send_raw(succeeded);
1320 self.drop_without_shutdown();
1321 _result
1322 }
1323
1324 fn send_raw(&self, mut succeeded: bool) -> Result<(), fidl::Error> {
1325 self.control_handle.inner.send::<ReadWriteAccountDebitResponse>(
1326 (succeeded,),
1327 self.tx_id,
1328 0x2fa6ce7839974858,
1329 fidl::encoding::DynamicFlags::empty(),
1330 )
1331 }
1332}
1333
1334#[must_use = "FIDL methods require a response to be sent"]
1335#[derive(Debug)]
1336pub struct ReadWriteAccountCreditResponder {
1337 control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
1338 tx_id: u32,
1339}
1340
1341impl std::ops::Drop for ReadWriteAccountCreditResponder {
1345 fn drop(&mut self) {
1346 self.control_handle.shutdown();
1347 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1349 }
1350}
1351
1352impl fidl::endpoints::Responder for ReadWriteAccountCreditResponder {
1353 type ControlHandle = ReadWriteAccountControlHandle;
1354
1355 fn control_handle(&self) -> &ReadWriteAccountControlHandle {
1356 &self.control_handle
1357 }
1358
1359 fn drop_without_shutdown(mut self) {
1360 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1362 std::mem::forget(self);
1364 }
1365}
1366
1367impl ReadWriteAccountCreditResponder {
1368 pub fn send(self) -> Result<(), fidl::Error> {
1372 let _result = self.send_raw();
1373 if _result.is_err() {
1374 self.control_handle.shutdown();
1375 }
1376 self.drop_without_shutdown();
1377 _result
1378 }
1379
1380 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1382 let _result = self.send_raw();
1383 self.drop_without_shutdown();
1384 _result
1385 }
1386
1387 fn send_raw(&self) -> Result<(), fidl::Error> {
1388 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1389 (),
1390 self.tx_id,
1391 0x37c216ac70d94bd5,
1392 fidl::encoding::DynamicFlags::empty(),
1393 )
1394 }
1395}
1396
1397#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1398pub struct BankAccountMarker;
1399
1400#[cfg(target_os = "fuchsia")]
1401impl fidl::endpoints::ServiceMarker for BankAccountMarker {
1402 type Proxy = BankAccountProxy;
1403 type Request = BankAccountRequest;
1404 const SERVICE_NAME: &'static str = "fuchsia.examples.services.BankAccount";
1405}
1406
1407#[cfg(target_os = "fuchsia")]
1411pub enum BankAccountRequest {
1412 ReadOnly(ReadOnlyAccountRequestStream),
1413 ReadWrite(ReadWriteAccountRequestStream),
1414}
1415
1416#[cfg(target_os = "fuchsia")]
1417impl fidl::endpoints::ServiceRequest for BankAccountRequest {
1418 type Service = BankAccountMarker;
1419
1420 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1421 match name {
1422 "read_only" => Self::ReadOnly(
1423 <ReadOnlyAccountRequestStream as fidl::endpoints::RequestStream>::from_channel(
1424 _channel,
1425 ),
1426 ),
1427 "read_write" => Self::ReadWrite(
1428 <ReadWriteAccountRequestStream as fidl::endpoints::RequestStream>::from_channel(
1429 _channel,
1430 ),
1431 ),
1432 _ => panic!("no such member protocol name for service BankAccount"),
1433 }
1434 }
1435
1436 fn member_names() -> &'static [&'static str] {
1437 &["read_only", "read_write"]
1438 }
1439}
1440#[cfg(target_os = "fuchsia")]
1442pub struct BankAccountProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1443
1444#[cfg(target_os = "fuchsia")]
1445impl fidl::endpoints::ServiceProxy for BankAccountProxy {
1446 type Service = BankAccountMarker;
1447
1448 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1449 Self(opener)
1450 }
1451}
1452
1453#[cfg(target_os = "fuchsia")]
1454impl BankAccountProxy {
1455 pub fn connect_to_read_only(&self) -> Result<ReadOnlyAccountProxy, fidl::Error> {
1456 let (proxy, server_end) = fidl::endpoints::create_proxy::<ReadOnlyAccountMarker>();
1457 self.connect_channel_to_read_only(server_end)?;
1458 Ok(proxy)
1459 }
1460
1461 pub fn connect_to_read_only_sync(
1464 &self,
1465 ) -> Result<ReadOnlyAccountSynchronousProxy, fidl::Error> {
1466 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ReadOnlyAccountMarker>();
1467 self.connect_channel_to_read_only(server_end)?;
1468 Ok(proxy)
1469 }
1470
1471 pub fn connect_channel_to_read_only(
1474 &self,
1475 server_end: fidl::endpoints::ServerEnd<ReadOnlyAccountMarker>,
1476 ) -> Result<(), fidl::Error> {
1477 self.0.open_member("read_only", server_end.into_channel())
1478 }
1479 pub fn connect_to_read_write(&self) -> Result<ReadWriteAccountProxy, fidl::Error> {
1480 let (proxy, server_end) = fidl::endpoints::create_proxy::<ReadWriteAccountMarker>();
1481 self.connect_channel_to_read_write(server_end)?;
1482 Ok(proxy)
1483 }
1484
1485 pub fn connect_to_read_write_sync(
1488 &self,
1489 ) -> Result<ReadWriteAccountSynchronousProxy, fidl::Error> {
1490 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ReadWriteAccountMarker>();
1491 self.connect_channel_to_read_write(server_end)?;
1492 Ok(proxy)
1493 }
1494
1495 pub fn connect_channel_to_read_write(
1498 &self,
1499 server_end: fidl::endpoints::ServerEnd<ReadWriteAccountMarker>,
1500 ) -> Result<(), fidl::Error> {
1501 self.0.open_member("read_write", server_end.into_channel())
1502 }
1503
1504 pub fn instance_name(&self) -> &str {
1505 self.0.instance_name()
1506 }
1507}
1508
1509mod internal {
1510 use super::*;
1511}