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_intl_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct PropertyProviderMarker;
16
17impl fidl::endpoints::ProtocolMarker for PropertyProviderMarker {
18 type Proxy = PropertyProviderProxy;
19 type RequestStream = PropertyProviderRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = PropertyProviderSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.intl.PropertyProvider";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for PropertyProviderMarker {}
26
27pub trait PropertyProviderProxyInterface: Send + Sync {
28 type GetProfileResponseFut: std::future::Future<Output = Result<Profile, fidl::Error>> + Send;
29 fn r#get_profile(&self) -> Self::GetProfileResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct PropertyProviderSynchronousProxy {
34 client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for PropertyProviderSynchronousProxy {
39 type Proxy = PropertyProviderProxy;
40 type Protocol = PropertyProviderMarker;
41
42 fn from_channel(inner: fidl::Channel) -> Self {
43 Self::new(inner)
44 }
45
46 fn into_channel(self) -> fidl::Channel {
47 self.client.into_channel()
48 }
49
50 fn as_channel(&self) -> &fidl::Channel {
51 self.client.as_channel()
52 }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl PropertyProviderSynchronousProxy {
57 pub fn new(channel: fidl::Channel) -> Self {
58 let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60 }
61
62 pub fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 pub fn wait_for_event(
69 &self,
70 deadline: zx::MonotonicInstant,
71 ) -> Result<PropertyProviderEvent, fidl::Error> {
72 PropertyProviderEvent::decode(self.client.wait_for_event(deadline)?)
73 }
74
75 pub fn r#get_profile(&self, ___deadline: zx::MonotonicInstant) -> Result<Profile, fidl::Error> {
77 let _response = self
78 .client
79 .send_query::<fidl::encoding::EmptyPayload, PropertyProviderGetProfileResponse>(
80 (),
81 0x10bf06e68d36d3eb,
82 fidl::encoding::DynamicFlags::empty(),
83 ___deadline,
84 )?;
85 Ok(_response.profile)
86 }
87}
88
89#[derive(Debug, Clone)]
90pub struct PropertyProviderProxy {
91 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
92}
93
94impl fidl::endpoints::Proxy for PropertyProviderProxy {
95 type Protocol = PropertyProviderMarker;
96
97 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
98 Self::new(inner)
99 }
100
101 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
102 self.client.into_channel().map_err(|client| Self { client })
103 }
104
105 fn as_channel(&self) -> &::fidl::AsyncChannel {
106 self.client.as_channel()
107 }
108}
109
110impl PropertyProviderProxy {
111 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
113 let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114 Self { client: fidl::client::Client::new(channel, protocol_name) }
115 }
116
117 pub fn take_event_stream(&self) -> PropertyProviderEventStream {
123 PropertyProviderEventStream { event_receiver: self.client.take_event_receiver() }
124 }
125
126 pub fn r#get_profile(
128 &self,
129 ) -> fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>
130 {
131 PropertyProviderProxyInterface::r#get_profile(self)
132 }
133}
134
135impl PropertyProviderProxyInterface for PropertyProviderProxy {
136 type GetProfileResponseFut =
137 fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>;
138 fn r#get_profile(&self) -> Self::GetProfileResponseFut {
139 fn _decode(
140 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
141 ) -> Result<Profile, fidl::Error> {
142 let _response = fidl::client::decode_transaction_body::<
143 PropertyProviderGetProfileResponse,
144 fidl::encoding::DefaultFuchsiaResourceDialect,
145 0x10bf06e68d36d3eb,
146 >(_buf?)?;
147 Ok(_response.profile)
148 }
149 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Profile>(
150 (),
151 0x10bf06e68d36d3eb,
152 fidl::encoding::DynamicFlags::empty(),
153 _decode,
154 )
155 }
156}
157
158pub struct PropertyProviderEventStream {
159 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl std::marker::Unpin for PropertyProviderEventStream {}
163
164impl futures::stream::FusedStream for PropertyProviderEventStream {
165 fn is_terminated(&self) -> bool {
166 self.event_receiver.is_terminated()
167 }
168}
169
170impl futures::Stream for PropertyProviderEventStream {
171 type Item = Result<PropertyProviderEvent, fidl::Error>;
172
173 fn poll_next(
174 mut self: std::pin::Pin<&mut Self>,
175 cx: &mut std::task::Context<'_>,
176 ) -> std::task::Poll<Option<Self::Item>> {
177 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
178 &mut self.event_receiver,
179 cx
180 )?) {
181 Some(buf) => std::task::Poll::Ready(Some(PropertyProviderEvent::decode(buf))),
182 None => std::task::Poll::Ready(None),
183 }
184 }
185}
186
187#[derive(Debug)]
188pub enum PropertyProviderEvent {
189 OnChange {},
190}
191
192impl PropertyProviderEvent {
193 #[allow(irrefutable_let_patterns)]
194 pub fn into_on_change(self) -> Option<()> {
195 if let PropertyProviderEvent::OnChange {} = self {
196 Some(())
197 } else {
198 None
199 }
200 }
201
202 fn decode(
204 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
205 ) -> Result<PropertyProviderEvent, fidl::Error> {
206 let (bytes, _handles) = buf.split_mut();
207 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
208 debug_assert_eq!(tx_header.tx_id, 0);
209 match tx_header.ordinal {
210 0x26b9ed6e23c46991 => {
211 let mut out = fidl::new_empty!(
212 fidl::encoding::EmptyPayload,
213 fidl::encoding::DefaultFuchsiaResourceDialect
214 );
215 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
216 Ok((PropertyProviderEvent::OnChange {}))
217 }
218 _ => Err(fidl::Error::UnknownOrdinal {
219 ordinal: tx_header.ordinal,
220 protocol_name:
221 <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
222 }),
223 }
224 }
225}
226
227pub struct PropertyProviderRequestStream {
229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
230 is_terminated: bool,
231}
232
233impl std::marker::Unpin for PropertyProviderRequestStream {}
234
235impl futures::stream::FusedStream for PropertyProviderRequestStream {
236 fn is_terminated(&self) -> bool {
237 self.is_terminated
238 }
239}
240
241impl fidl::endpoints::RequestStream for PropertyProviderRequestStream {
242 type Protocol = PropertyProviderMarker;
243 type ControlHandle = PropertyProviderControlHandle;
244
245 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
246 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
247 }
248
249 fn control_handle(&self) -> Self::ControlHandle {
250 PropertyProviderControlHandle { inner: self.inner.clone() }
251 }
252
253 fn into_inner(
254 self,
255 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
256 {
257 (self.inner, self.is_terminated)
258 }
259
260 fn from_inner(
261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
262 is_terminated: bool,
263 ) -> Self {
264 Self { inner, is_terminated }
265 }
266}
267
268impl futures::Stream for PropertyProviderRequestStream {
269 type Item = Result<PropertyProviderRequest, fidl::Error>;
270
271 fn poll_next(
272 mut self: std::pin::Pin<&mut Self>,
273 cx: &mut std::task::Context<'_>,
274 ) -> std::task::Poll<Option<Self::Item>> {
275 let this = &mut *self;
276 if this.inner.check_shutdown(cx) {
277 this.is_terminated = true;
278 return std::task::Poll::Ready(None);
279 }
280 if this.is_terminated {
281 panic!("polled PropertyProviderRequestStream after completion");
282 }
283 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
284 |bytes, handles| {
285 match this.inner.channel().read_etc(cx, bytes, handles) {
286 std::task::Poll::Ready(Ok(())) => {}
287 std::task::Poll::Pending => return std::task::Poll::Pending,
288 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
289 this.is_terminated = true;
290 return std::task::Poll::Ready(None);
291 }
292 std::task::Poll::Ready(Err(e)) => {
293 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
294 e.into(),
295 ))))
296 }
297 }
298
299 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
301
302 std::task::Poll::Ready(Some(match header.ordinal {
303 0x10bf06e68d36d3eb => {
304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
305 let mut req = fidl::new_empty!(
306 fidl::encoding::EmptyPayload,
307 fidl::encoding::DefaultFuchsiaResourceDialect
308 );
309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
310 let control_handle =
311 PropertyProviderControlHandle { inner: this.inner.clone() };
312 Ok(PropertyProviderRequest::GetProfile {
313 responder: PropertyProviderGetProfileResponder {
314 control_handle: std::mem::ManuallyDrop::new(control_handle),
315 tx_id: header.tx_id,
316 },
317 })
318 }
319 _ => Err(fidl::Error::UnknownOrdinal {
320 ordinal: header.ordinal,
321 protocol_name:
322 <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
323 }),
324 }))
325 },
326 )
327 }
328}
329
330#[derive(Debug)]
339pub enum PropertyProviderRequest {
340 GetProfile { responder: PropertyProviderGetProfileResponder },
342}
343
344impl PropertyProviderRequest {
345 #[allow(irrefutable_let_patterns)]
346 pub fn into_get_profile(self) -> Option<(PropertyProviderGetProfileResponder)> {
347 if let PropertyProviderRequest::GetProfile { responder } = self {
348 Some((responder))
349 } else {
350 None
351 }
352 }
353
354 pub fn method_name(&self) -> &'static str {
356 match *self {
357 PropertyProviderRequest::GetProfile { .. } => "get_profile",
358 }
359 }
360}
361
362#[derive(Debug, Clone)]
363pub struct PropertyProviderControlHandle {
364 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
365}
366
367impl fidl::endpoints::ControlHandle for PropertyProviderControlHandle {
368 fn shutdown(&self) {
369 self.inner.shutdown()
370 }
371 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
372 self.inner.shutdown_with_epitaph(status)
373 }
374
375 fn is_closed(&self) -> bool {
376 self.inner.channel().is_closed()
377 }
378 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
379 self.inner.channel().on_closed()
380 }
381
382 #[cfg(target_os = "fuchsia")]
383 fn signal_peer(
384 &self,
385 clear_mask: zx::Signals,
386 set_mask: zx::Signals,
387 ) -> Result<(), zx_status::Status> {
388 use fidl::Peered;
389 self.inner.channel().signal_peer(clear_mask, set_mask)
390 }
391}
392
393impl PropertyProviderControlHandle {
394 pub fn send_on_change(&self) -> Result<(), fidl::Error> {
395 self.inner.send::<fidl::encoding::EmptyPayload>(
396 (),
397 0,
398 0x26b9ed6e23c46991,
399 fidl::encoding::DynamicFlags::empty(),
400 )
401 }
402}
403
404#[must_use = "FIDL methods require a response to be sent"]
405#[derive(Debug)]
406pub struct PropertyProviderGetProfileResponder {
407 control_handle: std::mem::ManuallyDrop<PropertyProviderControlHandle>,
408 tx_id: u32,
409}
410
411impl std::ops::Drop for PropertyProviderGetProfileResponder {
415 fn drop(&mut self) {
416 self.control_handle.shutdown();
417 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
419 }
420}
421
422impl fidl::endpoints::Responder for PropertyProviderGetProfileResponder {
423 type ControlHandle = PropertyProviderControlHandle;
424
425 fn control_handle(&self) -> &PropertyProviderControlHandle {
426 &self.control_handle
427 }
428
429 fn drop_without_shutdown(mut self) {
430 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
432 std::mem::forget(self);
434 }
435}
436
437impl PropertyProviderGetProfileResponder {
438 pub fn send(self, mut profile: &Profile) -> Result<(), fidl::Error> {
442 let _result = self.send_raw(profile);
443 if _result.is_err() {
444 self.control_handle.shutdown();
445 }
446 self.drop_without_shutdown();
447 _result
448 }
449
450 pub fn send_no_shutdown_on_err(self, mut profile: &Profile) -> Result<(), fidl::Error> {
452 let _result = self.send_raw(profile);
453 self.drop_without_shutdown();
454 _result
455 }
456
457 fn send_raw(&self, mut profile: &Profile) -> Result<(), fidl::Error> {
458 self.control_handle.inner.send::<PropertyProviderGetProfileResponse>(
459 (profile,),
460 self.tx_id,
461 0x10bf06e68d36d3eb,
462 fidl::encoding::DynamicFlags::empty(),
463 )
464 }
465}
466
467#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
468pub struct TimeZonesMarker;
469
470impl fidl::endpoints::ProtocolMarker for TimeZonesMarker {
471 type Proxy = TimeZonesProxy;
472 type RequestStream = TimeZonesRequestStream;
473 #[cfg(target_os = "fuchsia")]
474 type SynchronousProxy = TimeZonesSynchronousProxy;
475
476 const DEBUG_NAME: &'static str = "fuchsia.intl.TimeZones";
477}
478impl fidl::endpoints::DiscoverableProtocolMarker for TimeZonesMarker {}
479pub type TimeZonesAbsoluteToCivilTimeResult = Result<CivilTime, TimeZonesError>;
480pub type TimeZonesCivilToAbsoluteTimeResult = Result<i64, TimeZonesError>;
481pub type TimeZonesGetTimeZoneInfoResult = Result<TimeZoneInfo, TimeZonesError>;
482
483pub trait TimeZonesProxyInterface: Send + Sync {
484 type AbsoluteToCivilTimeResponseFut: std::future::Future<Output = Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error>>
485 + Send;
486 fn r#absolute_to_civil_time(
487 &self,
488 time_zone_id: &TimeZoneId,
489 absolute_time: i64,
490 ) -> Self::AbsoluteToCivilTimeResponseFut;
491 type CivilToAbsoluteTimeResponseFut: std::future::Future<Output = Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error>>
492 + Send;
493 fn r#civil_to_absolute_time(
494 &self,
495 civil_time: &CivilTime,
496 options: &CivilToAbsoluteTimeOptions,
497 ) -> Self::CivilToAbsoluteTimeResponseFut;
498 type GetTimeZoneInfoResponseFut: std::future::Future<Output = Result<TimeZonesGetTimeZoneInfoResult, fidl::Error>>
499 + Send;
500 fn r#get_time_zone_info(
501 &self,
502 time_zone_id: &TimeZoneId,
503 at_time: i64,
504 ) -> Self::GetTimeZoneInfoResponseFut;
505}
506#[derive(Debug)]
507#[cfg(target_os = "fuchsia")]
508pub struct TimeZonesSynchronousProxy {
509 client: fidl::client::sync::Client,
510}
511
512#[cfg(target_os = "fuchsia")]
513impl fidl::endpoints::SynchronousProxy for TimeZonesSynchronousProxy {
514 type Proxy = TimeZonesProxy;
515 type Protocol = TimeZonesMarker;
516
517 fn from_channel(inner: fidl::Channel) -> Self {
518 Self::new(inner)
519 }
520
521 fn into_channel(self) -> fidl::Channel {
522 self.client.into_channel()
523 }
524
525 fn as_channel(&self) -> &fidl::Channel {
526 self.client.as_channel()
527 }
528}
529
530#[cfg(target_os = "fuchsia")]
531impl TimeZonesSynchronousProxy {
532 pub fn new(channel: fidl::Channel) -> Self {
533 let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
534 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
535 }
536
537 pub fn into_channel(self) -> fidl::Channel {
538 self.client.into_channel()
539 }
540
541 pub fn wait_for_event(
544 &self,
545 deadline: zx::MonotonicInstant,
546 ) -> Result<TimeZonesEvent, fidl::Error> {
547 TimeZonesEvent::decode(self.client.wait_for_event(deadline)?)
548 }
549
550 pub fn r#absolute_to_civil_time(
553 &self,
554 mut time_zone_id: &TimeZoneId,
555 mut absolute_time: i64,
556 ___deadline: zx::MonotonicInstant,
557 ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
558 let _response = self.client.send_query::<
559 TimeZonesAbsoluteToCivilTimeRequest,
560 fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
561 >(
562 (time_zone_id, absolute_time,),
563 0x25377a4d9196e205,
564 fidl::encoding::DynamicFlags::empty(),
565 ___deadline,
566 )?;
567 Ok(_response.map(|x| x.civil_time))
568 }
569
570 pub fn r#civil_to_absolute_time(
573 &self,
574 mut civil_time: &CivilTime,
575 mut options: &CivilToAbsoluteTimeOptions,
576 ___deadline: zx::MonotonicInstant,
577 ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
578 let _response = self.client.send_query::<
579 TimeZonesCivilToAbsoluteTimeRequest,
580 fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
581 >(
582 (civil_time, options,),
583 0xc1277c7a1413aa6,
584 fidl::encoding::DynamicFlags::empty(),
585 ___deadline,
586 )?;
587 Ok(_response.map(|x| x.absolute_time))
588 }
589
590 pub fn r#get_time_zone_info(
592 &self,
593 mut time_zone_id: &TimeZoneId,
594 mut at_time: i64,
595 ___deadline: zx::MonotonicInstant,
596 ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
597 let _response =
598 self.client.send_query::<TimeZonesGetTimeZoneInfoRequest, fidl::encoding::ResultType<
599 TimeZonesGetTimeZoneInfoResponse,
600 TimeZonesError,
601 >>(
602 (time_zone_id, at_time),
603 0x2144cbac1d76fe65,
604 fidl::encoding::DynamicFlags::empty(),
605 ___deadline,
606 )?;
607 Ok(_response.map(|x| x.time_zone_info))
608 }
609}
610
611#[derive(Debug, Clone)]
612pub struct TimeZonesProxy {
613 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
614}
615
616impl fidl::endpoints::Proxy for TimeZonesProxy {
617 type Protocol = TimeZonesMarker;
618
619 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
620 Self::new(inner)
621 }
622
623 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
624 self.client.into_channel().map_err(|client| Self { client })
625 }
626
627 fn as_channel(&self) -> &::fidl::AsyncChannel {
628 self.client.as_channel()
629 }
630}
631
632impl TimeZonesProxy {
633 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
635 let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
636 Self { client: fidl::client::Client::new(channel, protocol_name) }
637 }
638
639 pub fn take_event_stream(&self) -> TimeZonesEventStream {
645 TimeZonesEventStream { event_receiver: self.client.take_event_receiver() }
646 }
647
648 pub fn r#absolute_to_civil_time(
651 &self,
652 mut time_zone_id: &TimeZoneId,
653 mut absolute_time: i64,
654 ) -> fidl::client::QueryResponseFut<
655 TimeZonesAbsoluteToCivilTimeResult,
656 fidl::encoding::DefaultFuchsiaResourceDialect,
657 > {
658 TimeZonesProxyInterface::r#absolute_to_civil_time(self, time_zone_id, absolute_time)
659 }
660
661 pub fn r#civil_to_absolute_time(
664 &self,
665 mut civil_time: &CivilTime,
666 mut options: &CivilToAbsoluteTimeOptions,
667 ) -> fidl::client::QueryResponseFut<
668 TimeZonesCivilToAbsoluteTimeResult,
669 fidl::encoding::DefaultFuchsiaResourceDialect,
670 > {
671 TimeZonesProxyInterface::r#civil_to_absolute_time(self, civil_time, options)
672 }
673
674 pub fn r#get_time_zone_info(
676 &self,
677 mut time_zone_id: &TimeZoneId,
678 mut at_time: i64,
679 ) -> fidl::client::QueryResponseFut<
680 TimeZonesGetTimeZoneInfoResult,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 > {
683 TimeZonesProxyInterface::r#get_time_zone_info(self, time_zone_id, at_time)
684 }
685}
686
687impl TimeZonesProxyInterface for TimeZonesProxy {
688 type AbsoluteToCivilTimeResponseFut = fidl::client::QueryResponseFut<
689 TimeZonesAbsoluteToCivilTimeResult,
690 fidl::encoding::DefaultFuchsiaResourceDialect,
691 >;
692 fn r#absolute_to_civil_time(
693 &self,
694 mut time_zone_id: &TimeZoneId,
695 mut absolute_time: i64,
696 ) -> Self::AbsoluteToCivilTimeResponseFut {
697 fn _decode(
698 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
699 ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
700 let _response = fidl::client::decode_transaction_body::<
701 fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
702 fidl::encoding::DefaultFuchsiaResourceDialect,
703 0x25377a4d9196e205,
704 >(_buf?)?;
705 Ok(_response.map(|x| x.civil_time))
706 }
707 self.client.send_query_and_decode::<
708 TimeZonesAbsoluteToCivilTimeRequest,
709 TimeZonesAbsoluteToCivilTimeResult,
710 >(
711 (time_zone_id, absolute_time,),
712 0x25377a4d9196e205,
713 fidl::encoding::DynamicFlags::empty(),
714 _decode,
715 )
716 }
717
718 type CivilToAbsoluteTimeResponseFut = fidl::client::QueryResponseFut<
719 TimeZonesCivilToAbsoluteTimeResult,
720 fidl::encoding::DefaultFuchsiaResourceDialect,
721 >;
722 fn r#civil_to_absolute_time(
723 &self,
724 mut civil_time: &CivilTime,
725 mut options: &CivilToAbsoluteTimeOptions,
726 ) -> Self::CivilToAbsoluteTimeResponseFut {
727 fn _decode(
728 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
729 ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
730 let _response = fidl::client::decode_transaction_body::<
731 fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
732 fidl::encoding::DefaultFuchsiaResourceDialect,
733 0xc1277c7a1413aa6,
734 >(_buf?)?;
735 Ok(_response.map(|x| x.absolute_time))
736 }
737 self.client.send_query_and_decode::<
738 TimeZonesCivilToAbsoluteTimeRequest,
739 TimeZonesCivilToAbsoluteTimeResult,
740 >(
741 (civil_time, options,),
742 0xc1277c7a1413aa6,
743 fidl::encoding::DynamicFlags::empty(),
744 _decode,
745 )
746 }
747
748 type GetTimeZoneInfoResponseFut = fidl::client::QueryResponseFut<
749 TimeZonesGetTimeZoneInfoResult,
750 fidl::encoding::DefaultFuchsiaResourceDialect,
751 >;
752 fn r#get_time_zone_info(
753 &self,
754 mut time_zone_id: &TimeZoneId,
755 mut at_time: i64,
756 ) -> Self::GetTimeZoneInfoResponseFut {
757 fn _decode(
758 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
759 ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
760 let _response = fidl::client::decode_transaction_body::<
761 fidl::encoding::ResultType<TimeZonesGetTimeZoneInfoResponse, TimeZonesError>,
762 fidl::encoding::DefaultFuchsiaResourceDialect,
763 0x2144cbac1d76fe65,
764 >(_buf?)?;
765 Ok(_response.map(|x| x.time_zone_info))
766 }
767 self.client.send_query_and_decode::<
768 TimeZonesGetTimeZoneInfoRequest,
769 TimeZonesGetTimeZoneInfoResult,
770 >(
771 (time_zone_id, at_time,),
772 0x2144cbac1d76fe65,
773 fidl::encoding::DynamicFlags::empty(),
774 _decode,
775 )
776 }
777}
778
779pub struct TimeZonesEventStream {
780 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
781}
782
783impl std::marker::Unpin for TimeZonesEventStream {}
784
785impl futures::stream::FusedStream for TimeZonesEventStream {
786 fn is_terminated(&self) -> bool {
787 self.event_receiver.is_terminated()
788 }
789}
790
791impl futures::Stream for TimeZonesEventStream {
792 type Item = Result<TimeZonesEvent, fidl::Error>;
793
794 fn poll_next(
795 mut self: std::pin::Pin<&mut Self>,
796 cx: &mut std::task::Context<'_>,
797 ) -> std::task::Poll<Option<Self::Item>> {
798 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
799 &mut self.event_receiver,
800 cx
801 )?) {
802 Some(buf) => std::task::Poll::Ready(Some(TimeZonesEvent::decode(buf))),
803 None => std::task::Poll::Ready(None),
804 }
805 }
806}
807
808#[derive(Debug)]
809pub enum TimeZonesEvent {}
810
811impl TimeZonesEvent {
812 fn decode(
814 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
815 ) -> Result<TimeZonesEvent, fidl::Error> {
816 let (bytes, _handles) = buf.split_mut();
817 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
818 debug_assert_eq!(tx_header.tx_id, 0);
819 match tx_header.ordinal {
820 _ => Err(fidl::Error::UnknownOrdinal {
821 ordinal: tx_header.ordinal,
822 protocol_name: <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823 }),
824 }
825 }
826}
827
828pub struct TimeZonesRequestStream {
830 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
831 is_terminated: bool,
832}
833
834impl std::marker::Unpin for TimeZonesRequestStream {}
835
836impl futures::stream::FusedStream for TimeZonesRequestStream {
837 fn is_terminated(&self) -> bool {
838 self.is_terminated
839 }
840}
841
842impl fidl::endpoints::RequestStream for TimeZonesRequestStream {
843 type Protocol = TimeZonesMarker;
844 type ControlHandle = TimeZonesControlHandle;
845
846 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
847 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
848 }
849
850 fn control_handle(&self) -> Self::ControlHandle {
851 TimeZonesControlHandle { inner: self.inner.clone() }
852 }
853
854 fn into_inner(
855 self,
856 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
857 {
858 (self.inner, self.is_terminated)
859 }
860
861 fn from_inner(
862 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
863 is_terminated: bool,
864 ) -> Self {
865 Self { inner, is_terminated }
866 }
867}
868
869impl futures::Stream for TimeZonesRequestStream {
870 type Item = Result<TimeZonesRequest, fidl::Error>;
871
872 fn poll_next(
873 mut self: std::pin::Pin<&mut Self>,
874 cx: &mut std::task::Context<'_>,
875 ) -> std::task::Poll<Option<Self::Item>> {
876 let this = &mut *self;
877 if this.inner.check_shutdown(cx) {
878 this.is_terminated = true;
879 return std::task::Poll::Ready(None);
880 }
881 if this.is_terminated {
882 panic!("polled TimeZonesRequestStream after completion");
883 }
884 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
885 |bytes, handles| {
886 match this.inner.channel().read_etc(cx, bytes, handles) {
887 std::task::Poll::Ready(Ok(())) => {}
888 std::task::Poll::Pending => return std::task::Poll::Pending,
889 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
890 this.is_terminated = true;
891 return std::task::Poll::Ready(None);
892 }
893 std::task::Poll::Ready(Err(e)) => {
894 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
895 e.into(),
896 ))))
897 }
898 }
899
900 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
902
903 std::task::Poll::Ready(Some(match header.ordinal {
904 0x25377a4d9196e205 => {
905 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
906 let mut req = fidl::new_empty!(
907 TimeZonesAbsoluteToCivilTimeRequest,
908 fidl::encoding::DefaultFuchsiaResourceDialect
909 );
910 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesAbsoluteToCivilTimeRequest>(&header, _body_bytes, handles, &mut req)?;
911 let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
912 Ok(TimeZonesRequest::AbsoluteToCivilTime {
913 time_zone_id: req.time_zone_id,
914 absolute_time: req.absolute_time,
915
916 responder: TimeZonesAbsoluteToCivilTimeResponder {
917 control_handle: std::mem::ManuallyDrop::new(control_handle),
918 tx_id: header.tx_id,
919 },
920 })
921 }
922 0xc1277c7a1413aa6 => {
923 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
924 let mut req = fidl::new_empty!(
925 TimeZonesCivilToAbsoluteTimeRequest,
926 fidl::encoding::DefaultFuchsiaResourceDialect
927 );
928 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesCivilToAbsoluteTimeRequest>(&header, _body_bytes, handles, &mut req)?;
929 let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
930 Ok(TimeZonesRequest::CivilToAbsoluteTime {
931 civil_time: req.civil_time,
932 options: req.options,
933
934 responder: TimeZonesCivilToAbsoluteTimeResponder {
935 control_handle: std::mem::ManuallyDrop::new(control_handle),
936 tx_id: header.tx_id,
937 },
938 })
939 }
940 0x2144cbac1d76fe65 => {
941 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
942 let mut req = fidl::new_empty!(
943 TimeZonesGetTimeZoneInfoRequest,
944 fidl::encoding::DefaultFuchsiaResourceDialect
945 );
946 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesGetTimeZoneInfoRequest>(&header, _body_bytes, handles, &mut req)?;
947 let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
948 Ok(TimeZonesRequest::GetTimeZoneInfo {
949 time_zone_id: req.time_zone_id,
950 at_time: req.at_time,
951
952 responder: TimeZonesGetTimeZoneInfoResponder {
953 control_handle: std::mem::ManuallyDrop::new(control_handle),
954 tx_id: header.tx_id,
955 },
956 })
957 }
958 _ => Err(fidl::Error::UnknownOrdinal {
959 ordinal: header.ordinal,
960 protocol_name:
961 <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
962 }),
963 }))
964 },
965 )
966 }
967}
968
969#[derive(Debug)]
973pub enum TimeZonesRequest {
974 AbsoluteToCivilTime {
977 time_zone_id: TimeZoneId,
978 absolute_time: i64,
979 responder: TimeZonesAbsoluteToCivilTimeResponder,
980 },
981 CivilToAbsoluteTime {
984 civil_time: CivilTime,
985 options: CivilToAbsoluteTimeOptions,
986 responder: TimeZonesCivilToAbsoluteTimeResponder,
987 },
988 GetTimeZoneInfo {
990 time_zone_id: TimeZoneId,
991 at_time: i64,
992 responder: TimeZonesGetTimeZoneInfoResponder,
993 },
994}
995
996impl TimeZonesRequest {
997 #[allow(irrefutable_let_patterns)]
998 pub fn into_absolute_to_civil_time(
999 self,
1000 ) -> Option<(TimeZoneId, i64, TimeZonesAbsoluteToCivilTimeResponder)> {
1001 if let TimeZonesRequest::AbsoluteToCivilTime { time_zone_id, absolute_time, responder } =
1002 self
1003 {
1004 Some((time_zone_id, absolute_time, responder))
1005 } else {
1006 None
1007 }
1008 }
1009
1010 #[allow(irrefutable_let_patterns)]
1011 pub fn into_civil_to_absolute_time(
1012 self,
1013 ) -> Option<(CivilTime, CivilToAbsoluteTimeOptions, TimeZonesCivilToAbsoluteTimeResponder)>
1014 {
1015 if let TimeZonesRequest::CivilToAbsoluteTime { civil_time, options, responder } = self {
1016 Some((civil_time, options, responder))
1017 } else {
1018 None
1019 }
1020 }
1021
1022 #[allow(irrefutable_let_patterns)]
1023 pub fn into_get_time_zone_info(
1024 self,
1025 ) -> Option<(TimeZoneId, i64, TimeZonesGetTimeZoneInfoResponder)> {
1026 if let TimeZonesRequest::GetTimeZoneInfo { time_zone_id, at_time, responder } = self {
1027 Some((time_zone_id, at_time, responder))
1028 } else {
1029 None
1030 }
1031 }
1032
1033 pub fn method_name(&self) -> &'static str {
1035 match *self {
1036 TimeZonesRequest::AbsoluteToCivilTime { .. } => "absolute_to_civil_time",
1037 TimeZonesRequest::CivilToAbsoluteTime { .. } => "civil_to_absolute_time",
1038 TimeZonesRequest::GetTimeZoneInfo { .. } => "get_time_zone_info",
1039 }
1040 }
1041}
1042
1043#[derive(Debug, Clone)]
1044pub struct TimeZonesControlHandle {
1045 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1046}
1047
1048impl fidl::endpoints::ControlHandle for TimeZonesControlHandle {
1049 fn shutdown(&self) {
1050 self.inner.shutdown()
1051 }
1052 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1053 self.inner.shutdown_with_epitaph(status)
1054 }
1055
1056 fn is_closed(&self) -> bool {
1057 self.inner.channel().is_closed()
1058 }
1059 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1060 self.inner.channel().on_closed()
1061 }
1062
1063 #[cfg(target_os = "fuchsia")]
1064 fn signal_peer(
1065 &self,
1066 clear_mask: zx::Signals,
1067 set_mask: zx::Signals,
1068 ) -> Result<(), zx_status::Status> {
1069 use fidl::Peered;
1070 self.inner.channel().signal_peer(clear_mask, set_mask)
1071 }
1072}
1073
1074impl TimeZonesControlHandle {}
1075
1076#[must_use = "FIDL methods require a response to be sent"]
1077#[derive(Debug)]
1078pub struct TimeZonesAbsoluteToCivilTimeResponder {
1079 control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1080 tx_id: u32,
1081}
1082
1083impl std::ops::Drop for TimeZonesAbsoluteToCivilTimeResponder {
1087 fn drop(&mut self) {
1088 self.control_handle.shutdown();
1089 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1091 }
1092}
1093
1094impl fidl::endpoints::Responder for TimeZonesAbsoluteToCivilTimeResponder {
1095 type ControlHandle = TimeZonesControlHandle;
1096
1097 fn control_handle(&self) -> &TimeZonesControlHandle {
1098 &self.control_handle
1099 }
1100
1101 fn drop_without_shutdown(mut self) {
1102 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1104 std::mem::forget(self);
1106 }
1107}
1108
1109impl TimeZonesAbsoluteToCivilTimeResponder {
1110 pub fn send(self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1114 let _result = self.send_raw(result);
1115 if _result.is_err() {
1116 self.control_handle.shutdown();
1117 }
1118 self.drop_without_shutdown();
1119 _result
1120 }
1121
1122 pub fn send_no_shutdown_on_err(
1124 self,
1125 mut result: Result<&CivilTime, TimeZonesError>,
1126 ) -> Result<(), fidl::Error> {
1127 let _result = self.send_raw(result);
1128 self.drop_without_shutdown();
1129 _result
1130 }
1131
1132 fn send_raw(&self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1133 self.control_handle.inner.send::<fidl::encoding::ResultType<
1134 TimeZonesAbsoluteToCivilTimeResponse,
1135 TimeZonesError,
1136 >>(
1137 result.map(|civil_time| (civil_time,)),
1138 self.tx_id,
1139 0x25377a4d9196e205,
1140 fidl::encoding::DynamicFlags::empty(),
1141 )
1142 }
1143}
1144
1145#[must_use = "FIDL methods require a response to be sent"]
1146#[derive(Debug)]
1147pub struct TimeZonesCivilToAbsoluteTimeResponder {
1148 control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1149 tx_id: u32,
1150}
1151
1152impl std::ops::Drop for TimeZonesCivilToAbsoluteTimeResponder {
1156 fn drop(&mut self) {
1157 self.control_handle.shutdown();
1158 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1160 }
1161}
1162
1163impl fidl::endpoints::Responder for TimeZonesCivilToAbsoluteTimeResponder {
1164 type ControlHandle = TimeZonesControlHandle;
1165
1166 fn control_handle(&self) -> &TimeZonesControlHandle {
1167 &self.control_handle
1168 }
1169
1170 fn drop_without_shutdown(mut self) {
1171 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1173 std::mem::forget(self);
1175 }
1176}
1177
1178impl TimeZonesCivilToAbsoluteTimeResponder {
1179 pub fn send(self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1183 let _result = self.send_raw(result);
1184 if _result.is_err() {
1185 self.control_handle.shutdown();
1186 }
1187 self.drop_without_shutdown();
1188 _result
1189 }
1190
1191 pub fn send_no_shutdown_on_err(
1193 self,
1194 mut result: Result<i64, TimeZonesError>,
1195 ) -> Result<(), fidl::Error> {
1196 let _result = self.send_raw(result);
1197 self.drop_without_shutdown();
1198 _result
1199 }
1200
1201 fn send_raw(&self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1202 self.control_handle.inner.send::<fidl::encoding::ResultType<
1203 TimeZonesCivilToAbsoluteTimeResponse,
1204 TimeZonesError,
1205 >>(
1206 result.map(|absolute_time| (absolute_time,)),
1207 self.tx_id,
1208 0xc1277c7a1413aa6,
1209 fidl::encoding::DynamicFlags::empty(),
1210 )
1211 }
1212}
1213
1214#[must_use = "FIDL methods require a response to be sent"]
1215#[derive(Debug)]
1216pub struct TimeZonesGetTimeZoneInfoResponder {
1217 control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1218 tx_id: u32,
1219}
1220
1221impl std::ops::Drop for TimeZonesGetTimeZoneInfoResponder {
1225 fn drop(&mut self) {
1226 self.control_handle.shutdown();
1227 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1229 }
1230}
1231
1232impl fidl::endpoints::Responder for TimeZonesGetTimeZoneInfoResponder {
1233 type ControlHandle = TimeZonesControlHandle;
1234
1235 fn control_handle(&self) -> &TimeZonesControlHandle {
1236 &self.control_handle
1237 }
1238
1239 fn drop_without_shutdown(mut self) {
1240 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1242 std::mem::forget(self);
1244 }
1245}
1246
1247impl TimeZonesGetTimeZoneInfoResponder {
1248 pub fn send(
1252 self,
1253 mut result: Result<&TimeZoneInfo, TimeZonesError>,
1254 ) -> Result<(), fidl::Error> {
1255 let _result = self.send_raw(result);
1256 if _result.is_err() {
1257 self.control_handle.shutdown();
1258 }
1259 self.drop_without_shutdown();
1260 _result
1261 }
1262
1263 pub fn send_no_shutdown_on_err(
1265 self,
1266 mut result: Result<&TimeZoneInfo, TimeZonesError>,
1267 ) -> Result<(), fidl::Error> {
1268 let _result = self.send_raw(result);
1269 self.drop_without_shutdown();
1270 _result
1271 }
1272
1273 fn send_raw(
1274 &self,
1275 mut result: Result<&TimeZoneInfo, TimeZonesError>,
1276 ) -> Result<(), fidl::Error> {
1277 self.control_handle.inner.send::<fidl::encoding::ResultType<
1278 TimeZonesGetTimeZoneInfoResponse,
1279 TimeZonesError,
1280 >>(
1281 result.map(|time_zone_info| (time_zone_info,)),
1282 self.tx_id,
1283 0x2144cbac1d76fe65,
1284 fidl::encoding::DynamicFlags::empty(),
1285 )
1286 }
1287}
1288
1289mod internal {
1290 use super::*;
1291}