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