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