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_sensors__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ManagerConfigureSensorRatesRequest {
16 pub id: i32,
17 pub sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ManagerConfigureSensorRatesRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct ManagerMarker;
27
28impl fidl::endpoints::ProtocolMarker for ManagerMarker {
29 type Proxy = ManagerProxy;
30 type RequestStream = ManagerRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = ManagerSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "fuchsia.sensors.Manager";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
37pub type ManagerConfigurePlaybackResult = Result<(), ConfigurePlaybackError>;
38pub type ManagerConfigureSensorRatesResult = Result<(), ConfigureSensorRateError>;
39pub type ManagerActivateResult = Result<(), ActivateSensorError>;
40pub type ManagerDeactivateResult = Result<(), DeactivateSensorError>;
41
42pub trait ManagerProxyInterface: Send + Sync {
43 type ConfigurePlaybackResponseFut: std::future::Future<Output = Result<ManagerConfigurePlaybackResult, fidl::Error>>
44 + Send;
45 fn r#configure_playback(
46 &self,
47 source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
48 ) -> Self::ConfigurePlaybackResponseFut;
49 type GetSensorsListResponseFut: std::future::Future<
50 Output = Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error>,
51 > + Send;
52 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut;
53 type ConfigureSensorRatesResponseFut: std::future::Future<Output = Result<ManagerConfigureSensorRatesResult, fidl::Error>>
54 + Send;
55 fn r#configure_sensor_rates(
56 &self,
57 id: i32,
58 sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
59 ) -> Self::ConfigureSensorRatesResponseFut;
60 type ActivateResponseFut: std::future::Future<Output = Result<ManagerActivateResult, fidl::Error>>
61 + Send;
62 fn r#activate(&self, id: i32) -> Self::ActivateResponseFut;
63 type DeactivateResponseFut: std::future::Future<Output = Result<ManagerDeactivateResult, fidl::Error>>
64 + Send;
65 fn r#deactivate(&self, id: i32) -> Self::DeactivateResponseFut;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct ManagerSynchronousProxy {
70 client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
75 type Proxy = ManagerProxy;
76 type Protocol = ManagerMarker;
77
78 fn from_channel(inner: fidl::Channel) -> Self {
79 Self::new(inner)
80 }
81
82 fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 fn as_channel(&self) -> &fidl::Channel {
87 self.client.as_channel()
88 }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl ManagerSynchronousProxy {
93 pub fn new(channel: fidl::Channel) -> Self {
94 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96 }
97
98 pub fn into_channel(self) -> fidl::Channel {
99 self.client.into_channel()
100 }
101
102 pub fn wait_for_event(
105 &self,
106 deadline: zx::MonotonicInstant,
107 ) -> Result<ManagerEvent, fidl::Error> {
108 ManagerEvent::decode(self.client.wait_for_event(deadline)?)
109 }
110
111 pub fn r#configure_playback(
115 &self,
116 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
117 ___deadline: zx::MonotonicInstant,
118 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
119 let _response =
120 self.client
121 .send_query::<ManagerConfigurePlaybackRequest, fidl::encoding::FlexibleResultType<
122 fidl::encoding::EmptyStruct,
123 ConfigurePlaybackError,
124 >>(
125 (source_config,),
126 0x2aec5d56edab43fa,
127 fidl::encoding::DynamicFlags::FLEXIBLE,
128 ___deadline,
129 )?
130 .into_result::<ManagerMarker>("configure_playback")?;
131 Ok(_response.map(|x| x))
132 }
133
134 pub fn r#get_sensors_list(
136 &self,
137 ___deadline: zx::MonotonicInstant,
138 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
139 let _response = self.client.send_query::<
140 fidl::encoding::EmptyPayload,
141 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
142 >(
143 (),
144 0x48cf103cfbec3a4a,
145 fidl::encoding::DynamicFlags::FLEXIBLE,
146 ___deadline,
147 )?
148 .into_result::<ManagerMarker>("get_sensors_list")?;
149 Ok(_response.sensors)
150 }
151
152 pub fn r#configure_sensor_rates(
154 &self,
155 mut id: i32,
156 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
157 ___deadline: zx::MonotonicInstant,
158 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
159 let _response = self
160 .client
161 .send_query::<ManagerConfigureSensorRatesRequest, fidl::encoding::FlexibleResultType<
162 fidl::encoding::EmptyStruct,
163 ConfigureSensorRateError,
164 >>(
165 (id, sensor_rate_config),
166 0x28046f7f3f340652,
167 fidl::encoding::DynamicFlags::FLEXIBLE,
168 ___deadline,
169 )?
170 .into_result::<ManagerMarker>("configure_sensor_rates")?;
171 Ok(_response.map(|x| x))
172 }
173
174 pub fn r#activate(
176 &self,
177 mut id: i32,
178 ___deadline: zx::MonotonicInstant,
179 ) -> Result<ManagerActivateResult, fidl::Error> {
180 let _response =
181 self.client
182 .send_query::<ManagerActivateRequest, fidl::encoding::FlexibleResultType<
183 fidl::encoding::EmptyStruct,
184 ActivateSensorError,
185 >>(
186 (id,), 0x5678f117cae5ba42, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
187 )?
188 .into_result::<ManagerMarker>("activate")?;
189 Ok(_response.map(|x| x))
190 }
191
192 pub fn r#deactivate(
194 &self,
195 mut id: i32,
196 ___deadline: zx::MonotonicInstant,
197 ) -> Result<ManagerDeactivateResult, fidl::Error> {
198 let _response =
199 self.client
200 .send_query::<ManagerDeactivateRequest, fidl::encoding::FlexibleResultType<
201 fidl::encoding::EmptyStruct,
202 DeactivateSensorError,
203 >>(
204 (id,), 0x7fafbca62982c87, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
205 )?
206 .into_result::<ManagerMarker>("deactivate")?;
207 Ok(_response.map(|x| x))
208 }
209}
210
211#[cfg(target_os = "fuchsia")]
212impl From<ManagerSynchronousProxy> for zx::Handle {
213 fn from(value: ManagerSynchronousProxy) -> Self {
214 value.into_channel().into()
215 }
216}
217
218#[cfg(target_os = "fuchsia")]
219impl From<fidl::Channel> for ManagerSynchronousProxy {
220 fn from(value: fidl::Channel) -> Self {
221 Self::new(value)
222 }
223}
224
225#[cfg(target_os = "fuchsia")]
226impl fidl::endpoints::FromClient for ManagerSynchronousProxy {
227 type Protocol = ManagerMarker;
228
229 fn from_client(value: fidl::endpoints::ClientEnd<ManagerMarker>) -> Self {
230 Self::new(value.into_channel())
231 }
232}
233
234#[derive(Debug, Clone)]
235pub struct ManagerProxy {
236 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
237}
238
239impl fidl::endpoints::Proxy for ManagerProxy {
240 type Protocol = ManagerMarker;
241
242 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
243 Self::new(inner)
244 }
245
246 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
247 self.client.into_channel().map_err(|client| Self { client })
248 }
249
250 fn as_channel(&self) -> &::fidl::AsyncChannel {
251 self.client.as_channel()
252 }
253}
254
255impl ManagerProxy {
256 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
258 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
259 Self { client: fidl::client::Client::new(channel, protocol_name) }
260 }
261
262 pub fn take_event_stream(&self) -> ManagerEventStream {
268 ManagerEventStream { event_receiver: self.client.take_event_receiver() }
269 }
270
271 pub fn r#configure_playback(
275 &self,
276 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
277 ) -> fidl::client::QueryResponseFut<
278 ManagerConfigurePlaybackResult,
279 fidl::encoding::DefaultFuchsiaResourceDialect,
280 > {
281 ManagerProxyInterface::r#configure_playback(self, source_config)
282 }
283
284 pub fn r#get_sensors_list(
286 &self,
287 ) -> fidl::client::QueryResponseFut<
288 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
289 fidl::encoding::DefaultFuchsiaResourceDialect,
290 > {
291 ManagerProxyInterface::r#get_sensors_list(self)
292 }
293
294 pub fn r#configure_sensor_rates(
296 &self,
297 mut id: i32,
298 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
299 ) -> fidl::client::QueryResponseFut<
300 ManagerConfigureSensorRatesResult,
301 fidl::encoding::DefaultFuchsiaResourceDialect,
302 > {
303 ManagerProxyInterface::r#configure_sensor_rates(self, id, sensor_rate_config)
304 }
305
306 pub fn r#activate(
308 &self,
309 mut id: i32,
310 ) -> fidl::client::QueryResponseFut<
311 ManagerActivateResult,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 > {
314 ManagerProxyInterface::r#activate(self, id)
315 }
316
317 pub fn r#deactivate(
319 &self,
320 mut id: i32,
321 ) -> fidl::client::QueryResponseFut<
322 ManagerDeactivateResult,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 > {
325 ManagerProxyInterface::r#deactivate(self, id)
326 }
327}
328
329impl ManagerProxyInterface for ManagerProxy {
330 type ConfigurePlaybackResponseFut = fidl::client::QueryResponseFut<
331 ManagerConfigurePlaybackResult,
332 fidl::encoding::DefaultFuchsiaResourceDialect,
333 >;
334 fn r#configure_playback(
335 &self,
336 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
337 ) -> Self::ConfigurePlaybackResponseFut {
338 fn _decode(
339 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
340 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
341 let _response = fidl::client::decode_transaction_body::<
342 fidl::encoding::FlexibleResultType<
343 fidl::encoding::EmptyStruct,
344 ConfigurePlaybackError,
345 >,
346 fidl::encoding::DefaultFuchsiaResourceDialect,
347 0x2aec5d56edab43fa,
348 >(_buf?)?
349 .into_result::<ManagerMarker>("configure_playback")?;
350 Ok(_response.map(|x| x))
351 }
352 self.client.send_query_and_decode::<
353 ManagerConfigurePlaybackRequest,
354 ManagerConfigurePlaybackResult,
355 >(
356 (source_config,),
357 0x2aec5d56edab43fa,
358 fidl::encoding::DynamicFlags::FLEXIBLE,
359 _decode,
360 )
361 }
362
363 type GetSensorsListResponseFut = fidl::client::QueryResponseFut<
364 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
365 fidl::encoding::DefaultFuchsiaResourceDialect,
366 >;
367 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut {
368 fn _decode(
369 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
370 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
371 let _response = fidl::client::decode_transaction_body::<
372 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
373 fidl::encoding::DefaultFuchsiaResourceDialect,
374 0x48cf103cfbec3a4a,
375 >(_buf?)?
376 .into_result::<ManagerMarker>("get_sensors_list")?;
377 Ok(_response.sensors)
378 }
379 self.client.send_query_and_decode::<
380 fidl::encoding::EmptyPayload,
381 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
382 >(
383 (),
384 0x48cf103cfbec3a4a,
385 fidl::encoding::DynamicFlags::FLEXIBLE,
386 _decode,
387 )
388 }
389
390 type ConfigureSensorRatesResponseFut = fidl::client::QueryResponseFut<
391 ManagerConfigureSensorRatesResult,
392 fidl::encoding::DefaultFuchsiaResourceDialect,
393 >;
394 fn r#configure_sensor_rates(
395 &self,
396 mut id: i32,
397 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
398 ) -> Self::ConfigureSensorRatesResponseFut {
399 fn _decode(
400 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
401 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
402 let _response = fidl::client::decode_transaction_body::<
403 fidl::encoding::FlexibleResultType<
404 fidl::encoding::EmptyStruct,
405 ConfigureSensorRateError,
406 >,
407 fidl::encoding::DefaultFuchsiaResourceDialect,
408 0x28046f7f3f340652,
409 >(_buf?)?
410 .into_result::<ManagerMarker>("configure_sensor_rates")?;
411 Ok(_response.map(|x| x))
412 }
413 self.client.send_query_and_decode::<
414 ManagerConfigureSensorRatesRequest,
415 ManagerConfigureSensorRatesResult,
416 >(
417 (id, sensor_rate_config,),
418 0x28046f7f3f340652,
419 fidl::encoding::DynamicFlags::FLEXIBLE,
420 _decode,
421 )
422 }
423
424 type ActivateResponseFut = fidl::client::QueryResponseFut<
425 ManagerActivateResult,
426 fidl::encoding::DefaultFuchsiaResourceDialect,
427 >;
428 fn r#activate(&self, mut id: i32) -> Self::ActivateResponseFut {
429 fn _decode(
430 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
431 ) -> Result<ManagerActivateResult, fidl::Error> {
432 let _response = fidl::client::decode_transaction_body::<
433 fidl::encoding::FlexibleResultType<
434 fidl::encoding::EmptyStruct,
435 ActivateSensorError,
436 >,
437 fidl::encoding::DefaultFuchsiaResourceDialect,
438 0x5678f117cae5ba42,
439 >(_buf?)?
440 .into_result::<ManagerMarker>("activate")?;
441 Ok(_response.map(|x| x))
442 }
443 self.client.send_query_and_decode::<ManagerActivateRequest, ManagerActivateResult>(
444 (id,),
445 0x5678f117cae5ba42,
446 fidl::encoding::DynamicFlags::FLEXIBLE,
447 _decode,
448 )
449 }
450
451 type DeactivateResponseFut = fidl::client::QueryResponseFut<
452 ManagerDeactivateResult,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 >;
455 fn r#deactivate(&self, mut id: i32) -> Self::DeactivateResponseFut {
456 fn _decode(
457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
458 ) -> Result<ManagerDeactivateResult, fidl::Error> {
459 let _response = fidl::client::decode_transaction_body::<
460 fidl::encoding::FlexibleResultType<
461 fidl::encoding::EmptyStruct,
462 DeactivateSensorError,
463 >,
464 fidl::encoding::DefaultFuchsiaResourceDialect,
465 0x7fafbca62982c87,
466 >(_buf?)?
467 .into_result::<ManagerMarker>("deactivate")?;
468 Ok(_response.map(|x| x))
469 }
470 self.client.send_query_and_decode::<ManagerDeactivateRequest, ManagerDeactivateResult>(
471 (id,),
472 0x7fafbca62982c87,
473 fidl::encoding::DynamicFlags::FLEXIBLE,
474 _decode,
475 )
476 }
477}
478
479pub struct ManagerEventStream {
480 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
481}
482
483impl std::marker::Unpin for ManagerEventStream {}
484
485impl futures::stream::FusedStream for ManagerEventStream {
486 fn is_terminated(&self) -> bool {
487 self.event_receiver.is_terminated()
488 }
489}
490
491impl futures::Stream for ManagerEventStream {
492 type Item = Result<ManagerEvent, fidl::Error>;
493
494 fn poll_next(
495 mut self: std::pin::Pin<&mut Self>,
496 cx: &mut std::task::Context<'_>,
497 ) -> std::task::Poll<Option<Self::Item>> {
498 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
499 &mut self.event_receiver,
500 cx
501 )?) {
502 Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
503 None => std::task::Poll::Ready(None),
504 }
505 }
506}
507
508#[derive(Debug)]
509pub enum ManagerEvent {
510 OnSensorEvent {
511 event: fidl_fuchsia_sensors_types::SensorEvent,
512 },
513 #[non_exhaustive]
514 _UnknownEvent {
515 ordinal: u64,
517 },
518}
519
520impl ManagerEvent {
521 #[allow(irrefutable_let_patterns)]
522 pub fn into_on_sensor_event(self) -> Option<fidl_fuchsia_sensors_types::SensorEvent> {
523 if let ManagerEvent::OnSensorEvent { event } = self {
524 Some((event))
525 } else {
526 None
527 }
528 }
529
530 fn decode(
532 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
533 ) -> Result<ManagerEvent, fidl::Error> {
534 let (bytes, _handles) = buf.split_mut();
535 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
536 debug_assert_eq!(tx_header.tx_id, 0);
537 match tx_header.ordinal {
538 0x6ceb07e11d43e9b => {
539 let mut out = fidl::new_empty!(
540 ManagerOnSensorEventRequest,
541 fidl::encoding::DefaultFuchsiaResourceDialect
542 );
543 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerOnSensorEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
544 Ok((ManagerEvent::OnSensorEvent { event: out.event }))
545 }
546 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
547 Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
548 }
549 _ => Err(fidl::Error::UnknownOrdinal {
550 ordinal: tx_header.ordinal,
551 protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
552 }),
553 }
554 }
555}
556
557pub struct ManagerRequestStream {
559 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
560 is_terminated: bool,
561}
562
563impl std::marker::Unpin for ManagerRequestStream {}
564
565impl futures::stream::FusedStream for ManagerRequestStream {
566 fn is_terminated(&self) -> bool {
567 self.is_terminated
568 }
569}
570
571impl fidl::endpoints::RequestStream for ManagerRequestStream {
572 type Protocol = ManagerMarker;
573 type ControlHandle = ManagerControlHandle;
574
575 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
576 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
577 }
578
579 fn control_handle(&self) -> Self::ControlHandle {
580 ManagerControlHandle { inner: self.inner.clone() }
581 }
582
583 fn into_inner(
584 self,
585 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
586 {
587 (self.inner, self.is_terminated)
588 }
589
590 fn from_inner(
591 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592 is_terminated: bool,
593 ) -> Self {
594 Self { inner, is_terminated }
595 }
596}
597
598impl futures::Stream for ManagerRequestStream {
599 type Item = Result<ManagerRequest, fidl::Error>;
600
601 fn poll_next(
602 mut self: std::pin::Pin<&mut Self>,
603 cx: &mut std::task::Context<'_>,
604 ) -> std::task::Poll<Option<Self::Item>> {
605 let this = &mut *self;
606 if this.inner.check_shutdown(cx) {
607 this.is_terminated = true;
608 return std::task::Poll::Ready(None);
609 }
610 if this.is_terminated {
611 panic!("polled ManagerRequestStream after completion");
612 }
613 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
614 |bytes, handles| {
615 match this.inner.channel().read_etc(cx, bytes, handles) {
616 std::task::Poll::Ready(Ok(())) => {}
617 std::task::Poll::Pending => return std::task::Poll::Pending,
618 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
619 this.is_terminated = true;
620 return std::task::Poll::Ready(None);
621 }
622 std::task::Poll::Ready(Err(e)) => {
623 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
624 e.into(),
625 ))))
626 }
627 }
628
629 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
631
632 std::task::Poll::Ready(Some(match header.ordinal {
633 0x2aec5d56edab43fa => {
634 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
635 let mut req = fidl::new_empty!(
636 ManagerConfigurePlaybackRequest,
637 fidl::encoding::DefaultFuchsiaResourceDialect
638 );
639 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigurePlaybackRequest>(&header, _body_bytes, handles, &mut req)?;
640 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
641 Ok(ManagerRequest::ConfigurePlayback {
642 source_config: req.source_config,
643
644 responder: ManagerConfigurePlaybackResponder {
645 control_handle: std::mem::ManuallyDrop::new(control_handle),
646 tx_id: header.tx_id,
647 },
648 })
649 }
650 0x48cf103cfbec3a4a => {
651 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
652 let mut req = fidl::new_empty!(
653 fidl::encoding::EmptyPayload,
654 fidl::encoding::DefaultFuchsiaResourceDialect
655 );
656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
657 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
658 Ok(ManagerRequest::GetSensorsList {
659 responder: ManagerGetSensorsListResponder {
660 control_handle: std::mem::ManuallyDrop::new(control_handle),
661 tx_id: header.tx_id,
662 },
663 })
664 }
665 0x28046f7f3f340652 => {
666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
667 let mut req = fidl::new_empty!(
668 ManagerConfigureSensorRatesRequest,
669 fidl::encoding::DefaultFuchsiaResourceDialect
670 );
671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigureSensorRatesRequest>(&header, _body_bytes, handles, &mut req)?;
672 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
673 Ok(ManagerRequest::ConfigureSensorRates {
674 id: req.id,
675 sensor_rate_config: req.sensor_rate_config,
676
677 responder: ManagerConfigureSensorRatesResponder {
678 control_handle: std::mem::ManuallyDrop::new(control_handle),
679 tx_id: header.tx_id,
680 },
681 })
682 }
683 0x5678f117cae5ba42 => {
684 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
685 let mut req = fidl::new_empty!(
686 ManagerActivateRequest,
687 fidl::encoding::DefaultFuchsiaResourceDialect
688 );
689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
690 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
691 Ok(ManagerRequest::Activate {
692 id: req.id,
693
694 responder: ManagerActivateResponder {
695 control_handle: std::mem::ManuallyDrop::new(control_handle),
696 tx_id: header.tx_id,
697 },
698 })
699 }
700 0x7fafbca62982c87 => {
701 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
702 let mut req = fidl::new_empty!(
703 ManagerDeactivateRequest,
704 fidl::encoding::DefaultFuchsiaResourceDialect
705 );
706 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerDeactivateRequest>(&header, _body_bytes, handles, &mut req)?;
707 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
708 Ok(ManagerRequest::Deactivate {
709 id: req.id,
710
711 responder: ManagerDeactivateResponder {
712 control_handle: std::mem::ManuallyDrop::new(control_handle),
713 tx_id: header.tx_id,
714 },
715 })
716 }
717 _ if header.tx_id == 0
718 && header
719 .dynamic_flags()
720 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
721 {
722 Ok(ManagerRequest::_UnknownMethod {
723 ordinal: header.ordinal,
724 control_handle: ManagerControlHandle { inner: this.inner.clone() },
725 method_type: fidl::MethodType::OneWay,
726 })
727 }
728 _ if header
729 .dynamic_flags()
730 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
731 {
732 this.inner.send_framework_err(
733 fidl::encoding::FrameworkErr::UnknownMethod,
734 header.tx_id,
735 header.ordinal,
736 header.dynamic_flags(),
737 (bytes, handles),
738 )?;
739 Ok(ManagerRequest::_UnknownMethod {
740 ordinal: header.ordinal,
741 control_handle: ManagerControlHandle { inner: this.inner.clone() },
742 method_type: fidl::MethodType::TwoWay,
743 })
744 }
745 _ => Err(fidl::Error::UnknownOrdinal {
746 ordinal: header.ordinal,
747 protocol_name:
748 <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
749 }),
750 }))
751 },
752 )
753 }
754}
755
756#[derive(Debug)]
757pub enum ManagerRequest {
758 ConfigurePlayback {
762 source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
763 responder: ManagerConfigurePlaybackResponder,
764 },
765 GetSensorsList { responder: ManagerGetSensorsListResponder },
767 ConfigureSensorRates {
769 id: i32,
770 sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
771 responder: ManagerConfigureSensorRatesResponder,
772 },
773 Activate { id: i32, responder: ManagerActivateResponder },
775 Deactivate { id: i32, responder: ManagerDeactivateResponder },
777 #[non_exhaustive]
779 _UnknownMethod {
780 ordinal: u64,
782 control_handle: ManagerControlHandle,
783 method_type: fidl::MethodType,
784 },
785}
786
787impl ManagerRequest {
788 #[allow(irrefutable_let_patterns)]
789 pub fn into_configure_playback(
790 self,
791 ) -> Option<(
792 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
793 ManagerConfigurePlaybackResponder,
794 )> {
795 if let ManagerRequest::ConfigurePlayback { source_config, responder } = self {
796 Some((source_config, responder))
797 } else {
798 None
799 }
800 }
801
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_get_sensors_list(self) -> Option<(ManagerGetSensorsListResponder)> {
804 if let ManagerRequest::GetSensorsList { responder } = self {
805 Some((responder))
806 } else {
807 None
808 }
809 }
810
811 #[allow(irrefutable_let_patterns)]
812 pub fn into_configure_sensor_rates(
813 self,
814 ) -> Option<(
815 i32,
816 fidl_fuchsia_sensors_types::SensorRateConfig,
817 ManagerConfigureSensorRatesResponder,
818 )> {
819 if let ManagerRequest::ConfigureSensorRates { id, sensor_rate_config, responder } = self {
820 Some((id, sensor_rate_config, responder))
821 } else {
822 None
823 }
824 }
825
826 #[allow(irrefutable_let_patterns)]
827 pub fn into_activate(self) -> Option<(i32, ManagerActivateResponder)> {
828 if let ManagerRequest::Activate { id, responder } = self {
829 Some((id, responder))
830 } else {
831 None
832 }
833 }
834
835 #[allow(irrefutable_let_patterns)]
836 pub fn into_deactivate(self) -> Option<(i32, ManagerDeactivateResponder)> {
837 if let ManagerRequest::Deactivate { id, responder } = self {
838 Some((id, responder))
839 } else {
840 None
841 }
842 }
843
844 pub fn method_name(&self) -> &'static str {
846 match *self {
847 ManagerRequest::ConfigurePlayback { .. } => "configure_playback",
848 ManagerRequest::GetSensorsList { .. } => "get_sensors_list",
849 ManagerRequest::ConfigureSensorRates { .. } => "configure_sensor_rates",
850 ManagerRequest::Activate { .. } => "activate",
851 ManagerRequest::Deactivate { .. } => "deactivate",
852 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
853 "unknown one-way method"
854 }
855 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
856 "unknown two-way method"
857 }
858 }
859 }
860}
861
862#[derive(Debug, Clone)]
863pub struct ManagerControlHandle {
864 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
865}
866
867impl fidl::endpoints::ControlHandle for ManagerControlHandle {
868 fn shutdown(&self) {
869 self.inner.shutdown()
870 }
871 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
872 self.inner.shutdown_with_epitaph(status)
873 }
874
875 fn is_closed(&self) -> bool {
876 self.inner.channel().is_closed()
877 }
878 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
879 self.inner.channel().on_closed()
880 }
881
882 #[cfg(target_os = "fuchsia")]
883 fn signal_peer(
884 &self,
885 clear_mask: zx::Signals,
886 set_mask: zx::Signals,
887 ) -> Result<(), zx_status::Status> {
888 use fidl::Peered;
889 self.inner.channel().signal_peer(clear_mask, set_mask)
890 }
891}
892
893impl ManagerControlHandle {
894 pub fn send_on_sensor_event(
895 &self,
896 mut event: &fidl_fuchsia_sensors_types::SensorEvent,
897 ) -> Result<(), fidl::Error> {
898 self.inner.send::<ManagerOnSensorEventRequest>(
899 (event,),
900 0,
901 0x6ceb07e11d43e9b,
902 fidl::encoding::DynamicFlags::FLEXIBLE,
903 )
904 }
905}
906
907#[must_use = "FIDL methods require a response to be sent"]
908#[derive(Debug)]
909pub struct ManagerConfigurePlaybackResponder {
910 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
911 tx_id: u32,
912}
913
914impl std::ops::Drop for ManagerConfigurePlaybackResponder {
918 fn drop(&mut self) {
919 self.control_handle.shutdown();
920 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
922 }
923}
924
925impl fidl::endpoints::Responder for ManagerConfigurePlaybackResponder {
926 type ControlHandle = ManagerControlHandle;
927
928 fn control_handle(&self) -> &ManagerControlHandle {
929 &self.control_handle
930 }
931
932 fn drop_without_shutdown(mut self) {
933 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
935 std::mem::forget(self);
937 }
938}
939
940impl ManagerConfigurePlaybackResponder {
941 pub fn send(self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
945 let _result = self.send_raw(result);
946 if _result.is_err() {
947 self.control_handle.shutdown();
948 }
949 self.drop_without_shutdown();
950 _result
951 }
952
953 pub fn send_no_shutdown_on_err(
955 self,
956 mut result: Result<(), ConfigurePlaybackError>,
957 ) -> Result<(), fidl::Error> {
958 let _result = self.send_raw(result);
959 self.drop_without_shutdown();
960 _result
961 }
962
963 fn send_raw(&self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
964 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
965 fidl::encoding::EmptyStruct,
966 ConfigurePlaybackError,
967 >>(
968 fidl::encoding::FlexibleResult::new(result),
969 self.tx_id,
970 0x2aec5d56edab43fa,
971 fidl::encoding::DynamicFlags::FLEXIBLE,
972 )
973 }
974}
975
976#[must_use = "FIDL methods require a response to be sent"]
977#[derive(Debug)]
978pub struct ManagerGetSensorsListResponder {
979 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
980 tx_id: u32,
981}
982
983impl std::ops::Drop for ManagerGetSensorsListResponder {
987 fn drop(&mut self) {
988 self.control_handle.shutdown();
989 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
991 }
992}
993
994impl fidl::endpoints::Responder for ManagerGetSensorsListResponder {
995 type ControlHandle = ManagerControlHandle;
996
997 fn control_handle(&self) -> &ManagerControlHandle {
998 &self.control_handle
999 }
1000
1001 fn drop_without_shutdown(mut self) {
1002 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1004 std::mem::forget(self);
1006 }
1007}
1008
1009impl ManagerGetSensorsListResponder {
1010 pub fn send(
1014 self,
1015 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1016 ) -> Result<(), fidl::Error> {
1017 let _result = self.send_raw(sensors);
1018 if _result.is_err() {
1019 self.control_handle.shutdown();
1020 }
1021 self.drop_without_shutdown();
1022 _result
1023 }
1024
1025 pub fn send_no_shutdown_on_err(
1027 self,
1028 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1029 ) -> Result<(), fidl::Error> {
1030 let _result = self.send_raw(sensors);
1031 self.drop_without_shutdown();
1032 _result
1033 }
1034
1035 fn send_raw(
1036 &self,
1037 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1038 ) -> Result<(), fidl::Error> {
1039 self.control_handle
1040 .inner
1041 .send::<fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>>(
1042 fidl::encoding::Flexible::new((sensors,)),
1043 self.tx_id,
1044 0x48cf103cfbec3a4a,
1045 fidl::encoding::DynamicFlags::FLEXIBLE,
1046 )
1047 }
1048}
1049
1050#[must_use = "FIDL methods require a response to be sent"]
1051#[derive(Debug)]
1052pub struct ManagerConfigureSensorRatesResponder {
1053 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1054 tx_id: u32,
1055}
1056
1057impl std::ops::Drop for ManagerConfigureSensorRatesResponder {
1061 fn drop(&mut self) {
1062 self.control_handle.shutdown();
1063 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1065 }
1066}
1067
1068impl fidl::endpoints::Responder for ManagerConfigureSensorRatesResponder {
1069 type ControlHandle = ManagerControlHandle;
1070
1071 fn control_handle(&self) -> &ManagerControlHandle {
1072 &self.control_handle
1073 }
1074
1075 fn drop_without_shutdown(mut self) {
1076 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1078 std::mem::forget(self);
1080 }
1081}
1082
1083impl ManagerConfigureSensorRatesResponder {
1084 pub fn send(self, mut result: Result<(), ConfigureSensorRateError>) -> Result<(), fidl::Error> {
1088 let _result = self.send_raw(result);
1089 if _result.is_err() {
1090 self.control_handle.shutdown();
1091 }
1092 self.drop_without_shutdown();
1093 _result
1094 }
1095
1096 pub fn send_no_shutdown_on_err(
1098 self,
1099 mut result: Result<(), ConfigureSensorRateError>,
1100 ) -> Result<(), fidl::Error> {
1101 let _result = self.send_raw(result);
1102 self.drop_without_shutdown();
1103 _result
1104 }
1105
1106 fn send_raw(
1107 &self,
1108 mut result: Result<(), ConfigureSensorRateError>,
1109 ) -> Result<(), fidl::Error> {
1110 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1111 fidl::encoding::EmptyStruct,
1112 ConfigureSensorRateError,
1113 >>(
1114 fidl::encoding::FlexibleResult::new(result),
1115 self.tx_id,
1116 0x28046f7f3f340652,
1117 fidl::encoding::DynamicFlags::FLEXIBLE,
1118 )
1119 }
1120}
1121
1122#[must_use = "FIDL methods require a response to be sent"]
1123#[derive(Debug)]
1124pub struct ManagerActivateResponder {
1125 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1126 tx_id: u32,
1127}
1128
1129impl std::ops::Drop for ManagerActivateResponder {
1133 fn drop(&mut self) {
1134 self.control_handle.shutdown();
1135 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1137 }
1138}
1139
1140impl fidl::endpoints::Responder for ManagerActivateResponder {
1141 type ControlHandle = ManagerControlHandle;
1142
1143 fn control_handle(&self) -> &ManagerControlHandle {
1144 &self.control_handle
1145 }
1146
1147 fn drop_without_shutdown(mut self) {
1148 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1150 std::mem::forget(self);
1152 }
1153}
1154
1155impl ManagerActivateResponder {
1156 pub fn send(self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1160 let _result = self.send_raw(result);
1161 if _result.is_err() {
1162 self.control_handle.shutdown();
1163 }
1164 self.drop_without_shutdown();
1165 _result
1166 }
1167
1168 pub fn send_no_shutdown_on_err(
1170 self,
1171 mut result: Result<(), ActivateSensorError>,
1172 ) -> Result<(), fidl::Error> {
1173 let _result = self.send_raw(result);
1174 self.drop_without_shutdown();
1175 _result
1176 }
1177
1178 fn send_raw(&self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1179 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1180 fidl::encoding::EmptyStruct,
1181 ActivateSensorError,
1182 >>(
1183 fidl::encoding::FlexibleResult::new(result),
1184 self.tx_id,
1185 0x5678f117cae5ba42,
1186 fidl::encoding::DynamicFlags::FLEXIBLE,
1187 )
1188 }
1189}
1190
1191#[must_use = "FIDL methods require a response to be sent"]
1192#[derive(Debug)]
1193pub struct ManagerDeactivateResponder {
1194 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1195 tx_id: u32,
1196}
1197
1198impl std::ops::Drop for ManagerDeactivateResponder {
1202 fn drop(&mut self) {
1203 self.control_handle.shutdown();
1204 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1206 }
1207}
1208
1209impl fidl::endpoints::Responder for ManagerDeactivateResponder {
1210 type ControlHandle = ManagerControlHandle;
1211
1212 fn control_handle(&self) -> &ManagerControlHandle {
1213 &self.control_handle
1214 }
1215
1216 fn drop_without_shutdown(mut self) {
1217 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1219 std::mem::forget(self);
1221 }
1222}
1223
1224impl ManagerDeactivateResponder {
1225 pub fn send(self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1229 let _result = self.send_raw(result);
1230 if _result.is_err() {
1231 self.control_handle.shutdown();
1232 }
1233 self.drop_without_shutdown();
1234 _result
1235 }
1236
1237 pub fn send_no_shutdown_on_err(
1239 self,
1240 mut result: Result<(), DeactivateSensorError>,
1241 ) -> Result<(), fidl::Error> {
1242 let _result = self.send_raw(result);
1243 self.drop_without_shutdown();
1244 _result
1245 }
1246
1247 fn send_raw(&self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1248 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1249 fidl::encoding::EmptyStruct,
1250 DeactivateSensorError,
1251 >>(
1252 fidl::encoding::FlexibleResult::new(result),
1253 self.tx_id,
1254 0x7fafbca62982c87,
1255 fidl::encoding::DynamicFlags::FLEXIBLE,
1256 )
1257 }
1258}
1259
1260mod internal {
1261 use super::*;
1262
1263 impl fidl::encoding::ResourceTypeMarker for ManagerConfigureSensorRatesRequest {
1264 type Borrowed<'a> = &'a mut Self;
1265 fn take_or_borrow<'a>(
1266 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1267 ) -> Self::Borrowed<'a> {
1268 value
1269 }
1270 }
1271
1272 unsafe impl fidl::encoding::TypeMarker for ManagerConfigureSensorRatesRequest {
1273 type Owned = Self;
1274
1275 #[inline(always)]
1276 fn inline_align(_context: fidl::encoding::Context) -> usize {
1277 8
1278 }
1279
1280 #[inline(always)]
1281 fn inline_size(_context: fidl::encoding::Context) -> usize {
1282 24
1283 }
1284 }
1285
1286 unsafe impl
1287 fidl::encoding::Encode<
1288 ManagerConfigureSensorRatesRequest,
1289 fidl::encoding::DefaultFuchsiaResourceDialect,
1290 > for &mut ManagerConfigureSensorRatesRequest
1291 {
1292 #[inline]
1293 unsafe fn encode(
1294 self,
1295 encoder: &mut fidl::encoding::Encoder<
1296 '_,
1297 fidl::encoding::DefaultFuchsiaResourceDialect,
1298 >,
1299 offset: usize,
1300 _depth: fidl::encoding::Depth,
1301 ) -> fidl::Result<()> {
1302 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1303 fidl::encoding::Encode::<ManagerConfigureSensorRatesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1305 (
1306 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1307 <fidl_fuchsia_sensors_types::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
1308 ),
1309 encoder, offset, _depth
1310 )
1311 }
1312 }
1313 unsafe impl<
1314 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1315 T1: fidl::encoding::Encode<
1316 fidl_fuchsia_sensors_types::SensorRateConfig,
1317 fidl::encoding::DefaultFuchsiaResourceDialect,
1318 >,
1319 >
1320 fidl::encoding::Encode<
1321 ManagerConfigureSensorRatesRequest,
1322 fidl::encoding::DefaultFuchsiaResourceDialect,
1323 > for (T0, T1)
1324 {
1325 #[inline]
1326 unsafe fn encode(
1327 self,
1328 encoder: &mut fidl::encoding::Encoder<
1329 '_,
1330 fidl::encoding::DefaultFuchsiaResourceDialect,
1331 >,
1332 offset: usize,
1333 depth: fidl::encoding::Depth,
1334 ) -> fidl::Result<()> {
1335 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1336 unsafe {
1339 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1340 (ptr as *mut u64).write_unaligned(0);
1341 }
1342 self.0.encode(encoder, offset + 0, depth)?;
1344 self.1.encode(encoder, offset + 8, depth)?;
1345 Ok(())
1346 }
1347 }
1348
1349 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1350 for ManagerConfigureSensorRatesRequest
1351 {
1352 #[inline(always)]
1353 fn new_empty() -> Self {
1354 Self {
1355 id: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1356 sensor_rate_config: fidl::new_empty!(
1357 fidl_fuchsia_sensors_types::SensorRateConfig,
1358 fidl::encoding::DefaultFuchsiaResourceDialect
1359 ),
1360 }
1361 }
1362
1363 #[inline]
1364 unsafe fn decode(
1365 &mut self,
1366 decoder: &mut fidl::encoding::Decoder<
1367 '_,
1368 fidl::encoding::DefaultFuchsiaResourceDialect,
1369 >,
1370 offset: usize,
1371 _depth: fidl::encoding::Depth,
1372 ) -> fidl::Result<()> {
1373 decoder.debug_check_bounds::<Self>(offset);
1374 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1376 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1377 let mask = 0xffffffff00000000u64;
1378 let maskedval = padval & mask;
1379 if maskedval != 0 {
1380 return Err(fidl::Error::NonZeroPadding {
1381 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1382 });
1383 }
1384 fidl::decode!(
1385 i32,
1386 fidl::encoding::DefaultFuchsiaResourceDialect,
1387 &mut self.id,
1388 decoder,
1389 offset + 0,
1390 _depth
1391 )?;
1392 fidl::decode!(
1393 fidl_fuchsia_sensors_types::SensorRateConfig,
1394 fidl::encoding::DefaultFuchsiaResourceDialect,
1395 &mut self.sensor_rate_config,
1396 decoder,
1397 offset + 8,
1398 _depth
1399 )?;
1400 Ok(())
1401 }
1402 }
1403}