fidl_fuchsia_camera3/
fidl_fuchsia_camera3.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_camera3__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceConnectToStreamRequest {
16    pub index: u32,
17    pub request: fidl::endpoints::ServerEnd<Stream_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for DeviceConnectToStreamRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DeviceRebindRequest {
27    pub request: fidl::endpoints::ServerEnd<DeviceMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceRebindRequest {}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct DeviceWatcherConnectToDeviceRequest {
34    pub id: u64,
35    pub request: fidl::endpoints::ServerEnd<DeviceMarker>,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
39    for DeviceWatcherConnectToDeviceRequest
40{
41}
42
43/// Metadata concerning a given frame.
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct FrameInfo {
46    /// Identifies the buffer used for this frame as an index into the most recently negotiated
47    /// buffer collection.
48    pub buffer_index: u32,
49    /// A monotonically increasing counter indicating the number of frames written to this stream's
50    /// most recently negotiated buffer collection. Clients can use this to detect dropped frames
51    /// or generate nominal timestamps using the associated stream's framerate.
52    pub frame_counter: u64,
53    /// The value of the system monotonic clock, measured at the time the hardware completed
54    /// populating the buffer.
55    pub timestamp: i64,
56    /// The client must close this when it has completed reading from the buffer.
57    pub release_fence: fidl::EventPair,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
61
62#[derive(Debug, PartialEq)]
63pub struct StreamGetNextFrame2Response {
64    pub info: FrameInfo2,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
68    for StreamGetNextFrame2Response
69{
70}
71
72#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct StreamGetNextFrameResponse {
74    pub info: FrameInfo,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
78    for StreamGetNextFrameResponse
79{
80}
81
82#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct StreamRebindRequest {
84    pub request: fidl::endpoints::ServerEnd<Stream_Marker>,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StreamRebindRequest {}
88
89#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct StreamSetBufferCollection2Request {
91    pub token:
92        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
96    for StreamSetBufferCollection2Request
97{
98}
99
100#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct StreamSetBufferCollectionRequest {
102    pub token: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
106    for StreamSetBufferCollectionRequest
107{
108}
109
110#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct StreamWatchBufferCollection2Response {
112    pub token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
113}
114
115impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
116    for StreamWatchBufferCollection2Response
117{
118}
119
120#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
121pub struct StreamWatchBufferCollectionResponse {
122    pub token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
126    for StreamWatchBufferCollectionResponse
127{
128}
129
130/// Metadata concerning a given frame.
131#[derive(Debug, Default, PartialEq)]
132pub struct FrameInfo2 {
133    /// Identifies the buffer used for this frame as an index into the most recently negotiated
134    /// buffer collection.
135    pub buffer_index: Option<u32>,
136    /// A monotonically increasing counter indicating the number of frames written to this stream's
137    /// most recently negotiated buffer collection. Clients can use this to detect dropped frames
138    /// or generate nominal timestamps using the associated stream's framerate.
139    pub frame_counter: Option<u64>,
140    /// The value of the system monotonic clock, measured at the time the hardware completed
141    /// populating the buffer.
142    pub timestamp: Option<i64>,
143    /// The value of the system monotonic clock, measured at the time the hardware completed
144    /// populating the original buffer used to derive the contents of this buffer.
145    pub capture_timestamp: Option<i64>,
146    /// The client must close this when it has completed reading from the buffer.
147    pub release_fence: Option<fidl::EventPair>,
148    #[doc(hidden)]
149    pub __source_breaking: fidl::marker::SourceBreaking,
150}
151
152impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo2 {}
153
154#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
155pub struct DeviceMarker;
156
157impl fidl::endpoints::ProtocolMarker for DeviceMarker {
158    type Proxy = DeviceProxy;
159    type RequestStream = DeviceRequestStream;
160    #[cfg(target_os = "fuchsia")]
161    type SynchronousProxy = DeviceSynchronousProxy;
162
163    const DEBUG_NAME: &'static str = "(anonymous) Device";
164}
165
166pub trait DeviceProxyInterface: Send + Sync {
167    type GetIdentifierResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
168        + Send;
169    fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut;
170    type GetConfigurationsResponseFut: std::future::Future<Output = Result<Vec<Configuration>, fidl::Error>>
171        + Send;
172    fn r#get_configurations(&self) -> Self::GetConfigurationsResponseFut;
173    type GetConfigurations2ResponseFut: std::future::Future<Output = Result<Vec<Configuration2>, fidl::Error>>
174        + Send;
175    fn r#get_configurations2(&self) -> Self::GetConfigurations2ResponseFut;
176    type WatchCurrentConfigurationResponseFut: std::future::Future<Output = Result<u32, fidl::Error>>
177        + Send;
178    fn r#watch_current_configuration(&self) -> Self::WatchCurrentConfigurationResponseFut;
179    fn r#set_current_configuration(&self, index: u32) -> Result<(), fidl::Error>;
180    type WatchMuteStateResponseFut: std::future::Future<Output = Result<(bool, bool), fidl::Error>>
181        + Send;
182    fn r#watch_mute_state(&self) -> Self::WatchMuteStateResponseFut;
183    type SetSoftwareMuteStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
184        + Send;
185    fn r#set_software_mute_state(&self, muted: bool) -> Self::SetSoftwareMuteStateResponseFut;
186    fn r#connect_to_stream(
187        &self,
188        index: u32,
189        request: fidl::endpoints::ServerEnd<Stream_Marker>,
190    ) -> Result<(), fidl::Error>;
191    fn r#rebind(
192        &self,
193        request: fidl::endpoints::ServerEnd<DeviceMarker>,
194    ) -> Result<(), fidl::Error>;
195}
196#[derive(Debug)]
197#[cfg(target_os = "fuchsia")]
198pub struct DeviceSynchronousProxy {
199    client: fidl::client::sync::Client,
200}
201
202#[cfg(target_os = "fuchsia")]
203impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
204    type Proxy = DeviceProxy;
205    type Protocol = DeviceMarker;
206
207    fn from_channel(inner: fidl::Channel) -> Self {
208        Self::new(inner)
209    }
210
211    fn into_channel(self) -> fidl::Channel {
212        self.client.into_channel()
213    }
214
215    fn as_channel(&self) -> &fidl::Channel {
216        self.client.as_channel()
217    }
218}
219
220#[cfg(target_os = "fuchsia")]
221impl DeviceSynchronousProxy {
222    pub fn new(channel: fidl::Channel) -> Self {
223        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
224        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
225    }
226
227    pub fn into_channel(self) -> fidl::Channel {
228        self.client.into_channel()
229    }
230
231    /// Waits until an event arrives and returns it. It is safe for other
232    /// threads to make concurrent requests while waiting for an event.
233    pub fn wait_for_event(
234        &self,
235        deadline: zx::MonotonicInstant,
236    ) -> Result<DeviceEvent, fidl::Error> {
237        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
238    }
239
240    /// Returns an identifier for the camera. If present, identical devices on different systems
241    /// will have the same identifier. Clients may use this to determine if additional semantics
242    /// known a priori for a given device apply to the current camera.
243    pub fn r#get_identifier(
244        &self,
245        ___deadline: zx::MonotonicInstant,
246    ) -> Result<Option<String>, fidl::Error> {
247        let _response =
248            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetIdentifierResponse>(
249                (),
250                0x1417d1af92667e47,
251                fidl::encoding::DynamicFlags::empty(),
252                ___deadline,
253            )?;
254        Ok(_response.identifier)
255    }
256
257    /// Returns a list of configurations supported by the camera. All cameras will have at least
258    /// one configuration. The values returned are immutable - they will not change for the
259    /// lifetime of the client's connection to the Camera.
260    pub fn r#get_configurations(
261        &self,
262        ___deadline: zx::MonotonicInstant,
263    ) -> Result<Vec<Configuration>, fidl::Error> {
264        let _response = self
265            .client
266            .send_query::<fidl::encoding::EmptyPayload, DeviceGetConfigurationsResponse>(
267                (),
268                0x26c7a180d8eef786,
269                fidl::encoding::DynamicFlags::empty(),
270                ___deadline,
271            )?;
272        Ok(_response.configurations)
273    }
274
275    /// Returns a list of configurations supported by the camera. All cameras will have at least
276    /// one configuration. The values returned are immutable - they will not change for the
277    /// lifetime of the client's connection to the Camera.
278    pub fn r#get_configurations2(
279        &self,
280        ___deadline: zx::MonotonicInstant,
281    ) -> Result<Vec<Configuration2>, fidl::Error> {
282        let _response = self
283            .client
284            .send_query::<fidl::encoding::EmptyPayload, DeviceGetConfigurations2Response>(
285                (),
286                0x2667155e740fb9ff,
287                fidl::encoding::DynamicFlags::empty(),
288                ___deadline,
289            )?;
290        Ok(_response.configurations)
291    }
292
293    /// Returns the index of the current configuration when it has changed from a previously
294    /// returned configuration, or is called by a client for the first time.
295    pub fn r#watch_current_configuration(
296        &self,
297        ___deadline: zx::MonotonicInstant,
298    ) -> Result<u32, fidl::Error> {
299        let _response = self
300            .client
301            .send_query::<fidl::encoding::EmptyPayload, DeviceWatchCurrentConfigurationResponse>(
302                (),
303                0x7a82832a127834b7,
304                fidl::encoding::DynamicFlags::empty(),
305                ___deadline,
306            )?;
307        Ok(_response.index)
308    }
309
310    /// Sets the configuration using the provided index. Calling this method disconnects any
311    /// existing Stream clients associated with this camera. An epitaph of ZX_OK
312    /// will be sent for any connected Stream clients on closing.
313    pub fn r#set_current_configuration(&self, mut index: u32) -> Result<(), fidl::Error> {
314        self.client.send::<DeviceSetCurrentConfigurationRequest>(
315            (index,),
316            0x11d65c8f92593b87,
317            fidl::encoding::DynamicFlags::empty(),
318        )
319    }
320
321    /// Returns the camera's current mute state when it has changed from a previously returned
322    /// state, or is called by a client for the first time. A camera may be muted using
323    /// SetSoftwareMuteState or by a physical switch. If either muted mode is active, stream
324    /// clients associated with this physical camera will stop receiving new frames.
325    pub fn r#watch_mute_state(
326        &self,
327        ___deadline: zx::MonotonicInstant,
328    ) -> Result<(bool, bool), fidl::Error> {
329        let _response =
330            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceWatchMuteStateResponse>(
331                (),
332                0x2bafd68e6e7ef2fb,
333                fidl::encoding::DynamicFlags::empty(),
334                ___deadline,
335            )?;
336        Ok((_response.software_muted, _response.hardware_muted))
337    }
338
339    /// Sets the current camera's software mute state. When transitioning to the muted state, this
340    /// method returns when the camera has successfully ceased sending new frames to stream
341    /// clients. When transitioning to the unmuted state, this method returns immediately.
342    pub fn r#set_software_mute_state(
343        &self,
344        mut muted: bool,
345        ___deadline: zx::MonotonicInstant,
346    ) -> Result<(), fidl::Error> {
347        let _response = self
348            .client
349            .send_query::<DeviceSetSoftwareMuteStateRequest, fidl::encoding::EmptyPayload>(
350                (muted,),
351                0x6bb19cb687f560a5,
352                fidl::encoding::DynamicFlags::empty(),
353                ___deadline,
354            )?;
355        Ok(_response)
356    }
357
358    /// Connects to the Stream at the provided index. If any clients already exist for this stream,
359    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
360    pub fn r#connect_to_stream(
361        &self,
362        mut index: u32,
363        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
364    ) -> Result<(), fidl::Error> {
365        self.client.send::<DeviceConnectToStreamRequest>(
366            (index, request),
367            0x290a86763174c4c3,
368            fidl::encoding::DynamicFlags::empty(),
369        )
370    }
371
372    /// Request another connection to this Device. This allows a client to delegate different
373    /// operations to different coordinated clients.
374    pub fn r#rebind(
375        &self,
376        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
377    ) -> Result<(), fidl::Error> {
378        self.client.send::<DeviceRebindRequest>(
379            (request,),
380            0x24811b7cee5c51c3,
381            fidl::encoding::DynamicFlags::empty(),
382        )
383    }
384}
385
386#[cfg(target_os = "fuchsia")]
387impl From<DeviceSynchronousProxy> for zx::Handle {
388    fn from(value: DeviceSynchronousProxy) -> Self {
389        value.into_channel().into()
390    }
391}
392
393#[cfg(target_os = "fuchsia")]
394impl From<fidl::Channel> for DeviceSynchronousProxy {
395    fn from(value: fidl::Channel) -> Self {
396        Self::new(value)
397    }
398}
399
400#[cfg(target_os = "fuchsia")]
401impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
402    type Protocol = DeviceMarker;
403
404    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
405        Self::new(value.into_channel())
406    }
407}
408
409#[derive(Debug, Clone)]
410pub struct DeviceProxy {
411    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
412}
413
414impl fidl::endpoints::Proxy for DeviceProxy {
415    type Protocol = DeviceMarker;
416
417    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
418        Self::new(inner)
419    }
420
421    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
422        self.client.into_channel().map_err(|client| Self { client })
423    }
424
425    fn as_channel(&self) -> &::fidl::AsyncChannel {
426        self.client.as_channel()
427    }
428}
429
430impl DeviceProxy {
431    /// Create a new Proxy for fuchsia.camera3/Device.
432    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
433        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
434        Self { client: fidl::client::Client::new(channel, protocol_name) }
435    }
436
437    /// Get a Stream of events from the remote end of the protocol.
438    ///
439    /// # Panics
440    ///
441    /// Panics if the event stream was already taken.
442    pub fn take_event_stream(&self) -> DeviceEventStream {
443        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
444    }
445
446    /// Returns an identifier for the camera. If present, identical devices on different systems
447    /// will have the same identifier. Clients may use this to determine if additional semantics
448    /// known a priori for a given device apply to the current camera.
449    pub fn r#get_identifier(
450        &self,
451    ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
452    {
453        DeviceProxyInterface::r#get_identifier(self)
454    }
455
456    /// Returns a list of configurations supported by the camera. All cameras will have at least
457    /// one configuration. The values returned are immutable - they will not change for the
458    /// lifetime of the client's connection to the Camera.
459    pub fn r#get_configurations(
460        &self,
461    ) -> fidl::client::QueryResponseFut<
462        Vec<Configuration>,
463        fidl::encoding::DefaultFuchsiaResourceDialect,
464    > {
465        DeviceProxyInterface::r#get_configurations(self)
466    }
467
468    /// Returns a list of configurations supported by the camera. All cameras will have at least
469    /// one configuration. The values returned are immutable - they will not change for the
470    /// lifetime of the client's connection to the Camera.
471    pub fn r#get_configurations2(
472        &self,
473    ) -> fidl::client::QueryResponseFut<
474        Vec<Configuration2>,
475        fidl::encoding::DefaultFuchsiaResourceDialect,
476    > {
477        DeviceProxyInterface::r#get_configurations2(self)
478    }
479
480    /// Returns the index of the current configuration when it has changed from a previously
481    /// returned configuration, or is called by a client for the first time.
482    pub fn r#watch_current_configuration(
483        &self,
484    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
485        DeviceProxyInterface::r#watch_current_configuration(self)
486    }
487
488    /// Sets the configuration using the provided index. Calling this method disconnects any
489    /// existing Stream clients associated with this camera. An epitaph of ZX_OK
490    /// will be sent for any connected Stream clients on closing.
491    pub fn r#set_current_configuration(&self, mut index: u32) -> Result<(), fidl::Error> {
492        DeviceProxyInterface::r#set_current_configuration(self, index)
493    }
494
495    /// Returns the camera's current mute state when it has changed from a previously returned
496    /// state, or is called by a client for the first time. A camera may be muted using
497    /// SetSoftwareMuteState or by a physical switch. If either muted mode is active, stream
498    /// clients associated with this physical camera will stop receiving new frames.
499    pub fn r#watch_mute_state(
500        &self,
501    ) -> fidl::client::QueryResponseFut<(bool, bool), fidl::encoding::DefaultFuchsiaResourceDialect>
502    {
503        DeviceProxyInterface::r#watch_mute_state(self)
504    }
505
506    /// Sets the current camera's software mute state. When transitioning to the muted state, this
507    /// method returns when the camera has successfully ceased sending new frames to stream
508    /// clients. When transitioning to the unmuted state, this method returns immediately.
509    pub fn r#set_software_mute_state(
510        &self,
511        mut muted: bool,
512    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
513        DeviceProxyInterface::r#set_software_mute_state(self, muted)
514    }
515
516    /// Connects to the Stream at the provided index. If any clients already exist for this stream,
517    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
518    pub fn r#connect_to_stream(
519        &self,
520        mut index: u32,
521        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
522    ) -> Result<(), fidl::Error> {
523        DeviceProxyInterface::r#connect_to_stream(self, index, request)
524    }
525
526    /// Request another connection to this Device. This allows a client to delegate different
527    /// operations to different coordinated clients.
528    pub fn r#rebind(
529        &self,
530        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
531    ) -> Result<(), fidl::Error> {
532        DeviceProxyInterface::r#rebind(self, request)
533    }
534}
535
536impl DeviceProxyInterface for DeviceProxy {
537    type GetIdentifierResponseFut = fidl::client::QueryResponseFut<
538        Option<String>,
539        fidl::encoding::DefaultFuchsiaResourceDialect,
540    >;
541    fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut {
542        fn _decode(
543            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
544        ) -> Result<Option<String>, fidl::Error> {
545            let _response = fidl::client::decode_transaction_body::<
546                DeviceGetIdentifierResponse,
547                fidl::encoding::DefaultFuchsiaResourceDialect,
548                0x1417d1af92667e47,
549            >(_buf?)?;
550            Ok(_response.identifier)
551        }
552        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
553            (),
554            0x1417d1af92667e47,
555            fidl::encoding::DynamicFlags::empty(),
556            _decode,
557        )
558    }
559
560    type GetConfigurationsResponseFut = fidl::client::QueryResponseFut<
561        Vec<Configuration>,
562        fidl::encoding::DefaultFuchsiaResourceDialect,
563    >;
564    fn r#get_configurations(&self) -> Self::GetConfigurationsResponseFut {
565        fn _decode(
566            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
567        ) -> Result<Vec<Configuration>, fidl::Error> {
568            let _response = fidl::client::decode_transaction_body::<
569                DeviceGetConfigurationsResponse,
570                fidl::encoding::DefaultFuchsiaResourceDialect,
571                0x26c7a180d8eef786,
572            >(_buf?)?;
573            Ok(_response.configurations)
574        }
575        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Configuration>>(
576            (),
577            0x26c7a180d8eef786,
578            fidl::encoding::DynamicFlags::empty(),
579            _decode,
580        )
581    }
582
583    type GetConfigurations2ResponseFut = fidl::client::QueryResponseFut<
584        Vec<Configuration2>,
585        fidl::encoding::DefaultFuchsiaResourceDialect,
586    >;
587    fn r#get_configurations2(&self) -> Self::GetConfigurations2ResponseFut {
588        fn _decode(
589            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
590        ) -> Result<Vec<Configuration2>, fidl::Error> {
591            let _response = fidl::client::decode_transaction_body::<
592                DeviceGetConfigurations2Response,
593                fidl::encoding::DefaultFuchsiaResourceDialect,
594                0x2667155e740fb9ff,
595            >(_buf?)?;
596            Ok(_response.configurations)
597        }
598        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Configuration2>>(
599            (),
600            0x2667155e740fb9ff,
601            fidl::encoding::DynamicFlags::empty(),
602            _decode,
603        )
604    }
605
606    type WatchCurrentConfigurationResponseFut =
607        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
608    fn r#watch_current_configuration(&self) -> Self::WatchCurrentConfigurationResponseFut {
609        fn _decode(
610            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
611        ) -> Result<u32, fidl::Error> {
612            let _response = fidl::client::decode_transaction_body::<
613                DeviceWatchCurrentConfigurationResponse,
614                fidl::encoding::DefaultFuchsiaResourceDialect,
615                0x7a82832a127834b7,
616            >(_buf?)?;
617            Ok(_response.index)
618        }
619        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
620            (),
621            0x7a82832a127834b7,
622            fidl::encoding::DynamicFlags::empty(),
623            _decode,
624        )
625    }
626
627    fn r#set_current_configuration(&self, mut index: u32) -> Result<(), fidl::Error> {
628        self.client.send::<DeviceSetCurrentConfigurationRequest>(
629            (index,),
630            0x11d65c8f92593b87,
631            fidl::encoding::DynamicFlags::empty(),
632        )
633    }
634
635    type WatchMuteStateResponseFut =
636        fidl::client::QueryResponseFut<(bool, bool), fidl::encoding::DefaultFuchsiaResourceDialect>;
637    fn r#watch_mute_state(&self) -> Self::WatchMuteStateResponseFut {
638        fn _decode(
639            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
640        ) -> Result<(bool, bool), fidl::Error> {
641            let _response = fidl::client::decode_transaction_body::<
642                DeviceWatchMuteStateResponse,
643                fidl::encoding::DefaultFuchsiaResourceDialect,
644                0x2bafd68e6e7ef2fb,
645            >(_buf?)?;
646            Ok((_response.software_muted, _response.hardware_muted))
647        }
648        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (bool, bool)>(
649            (),
650            0x2bafd68e6e7ef2fb,
651            fidl::encoding::DynamicFlags::empty(),
652            _decode,
653        )
654    }
655
656    type SetSoftwareMuteStateResponseFut =
657        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
658    fn r#set_software_mute_state(&self, mut muted: bool) -> Self::SetSoftwareMuteStateResponseFut {
659        fn _decode(
660            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
661        ) -> Result<(), fidl::Error> {
662            let _response = fidl::client::decode_transaction_body::<
663                fidl::encoding::EmptyPayload,
664                fidl::encoding::DefaultFuchsiaResourceDialect,
665                0x6bb19cb687f560a5,
666            >(_buf?)?;
667            Ok(_response)
668        }
669        self.client.send_query_and_decode::<DeviceSetSoftwareMuteStateRequest, ()>(
670            (muted,),
671            0x6bb19cb687f560a5,
672            fidl::encoding::DynamicFlags::empty(),
673            _decode,
674        )
675    }
676
677    fn r#connect_to_stream(
678        &self,
679        mut index: u32,
680        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
681    ) -> Result<(), fidl::Error> {
682        self.client.send::<DeviceConnectToStreamRequest>(
683            (index, request),
684            0x290a86763174c4c3,
685            fidl::encoding::DynamicFlags::empty(),
686        )
687    }
688
689    fn r#rebind(
690        &self,
691        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
692    ) -> Result<(), fidl::Error> {
693        self.client.send::<DeviceRebindRequest>(
694            (request,),
695            0x24811b7cee5c51c3,
696            fidl::encoding::DynamicFlags::empty(),
697        )
698    }
699}
700
701pub struct DeviceEventStream {
702    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
703}
704
705impl std::marker::Unpin for DeviceEventStream {}
706
707impl futures::stream::FusedStream for DeviceEventStream {
708    fn is_terminated(&self) -> bool {
709        self.event_receiver.is_terminated()
710    }
711}
712
713impl futures::Stream for DeviceEventStream {
714    type Item = Result<DeviceEvent, fidl::Error>;
715
716    fn poll_next(
717        mut self: std::pin::Pin<&mut Self>,
718        cx: &mut std::task::Context<'_>,
719    ) -> std::task::Poll<Option<Self::Item>> {
720        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
721            &mut self.event_receiver,
722            cx
723        )?) {
724            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
725            None => std::task::Poll::Ready(None),
726        }
727    }
728}
729
730#[derive(Debug)]
731pub enum DeviceEvent {}
732
733impl DeviceEvent {
734    /// Decodes a message buffer as a [`DeviceEvent`].
735    fn decode(
736        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
737    ) -> Result<DeviceEvent, fidl::Error> {
738        let (bytes, _handles) = buf.split_mut();
739        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
740        debug_assert_eq!(tx_header.tx_id, 0);
741        match tx_header.ordinal {
742            _ => Err(fidl::Error::UnknownOrdinal {
743                ordinal: tx_header.ordinal,
744                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
745            }),
746        }
747    }
748}
749
750/// A Stream of incoming requests for fuchsia.camera3/Device.
751pub struct DeviceRequestStream {
752    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
753    is_terminated: bool,
754}
755
756impl std::marker::Unpin for DeviceRequestStream {}
757
758impl futures::stream::FusedStream for DeviceRequestStream {
759    fn is_terminated(&self) -> bool {
760        self.is_terminated
761    }
762}
763
764impl fidl::endpoints::RequestStream for DeviceRequestStream {
765    type Protocol = DeviceMarker;
766    type ControlHandle = DeviceControlHandle;
767
768    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
769        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
770    }
771
772    fn control_handle(&self) -> Self::ControlHandle {
773        DeviceControlHandle { inner: self.inner.clone() }
774    }
775
776    fn into_inner(
777        self,
778    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
779    {
780        (self.inner, self.is_terminated)
781    }
782
783    fn from_inner(
784        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
785        is_terminated: bool,
786    ) -> Self {
787        Self { inner, is_terminated }
788    }
789}
790
791impl futures::Stream for DeviceRequestStream {
792    type Item = Result<DeviceRequest, 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        let this = &mut *self;
799        if this.inner.check_shutdown(cx) {
800            this.is_terminated = true;
801            return std::task::Poll::Ready(None);
802        }
803        if this.is_terminated {
804            panic!("polled DeviceRequestStream after completion");
805        }
806        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
807            |bytes, handles| {
808                match this.inner.channel().read_etc(cx, bytes, handles) {
809                    std::task::Poll::Ready(Ok(())) => {}
810                    std::task::Poll::Pending => return std::task::Poll::Pending,
811                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
812                        this.is_terminated = true;
813                        return std::task::Poll::Ready(None);
814                    }
815                    std::task::Poll::Ready(Err(e)) => {
816                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
817                            e.into(),
818                        ))));
819                    }
820                }
821
822                // A message has been received from the channel
823                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
824
825                std::task::Poll::Ready(Some(match header.ordinal {
826                    0x1417d1af92667e47 => {
827                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
828                        let mut req = fidl::new_empty!(
829                            fidl::encoding::EmptyPayload,
830                            fidl::encoding::DefaultFuchsiaResourceDialect
831                        );
832                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
833                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
834                        Ok(DeviceRequest::GetIdentifier {
835                            responder: DeviceGetIdentifierResponder {
836                                control_handle: std::mem::ManuallyDrop::new(control_handle),
837                                tx_id: header.tx_id,
838                            },
839                        })
840                    }
841                    0x26c7a180d8eef786 => {
842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
843                        let mut req = fidl::new_empty!(
844                            fidl::encoding::EmptyPayload,
845                            fidl::encoding::DefaultFuchsiaResourceDialect
846                        );
847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
848                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
849                        Ok(DeviceRequest::GetConfigurations {
850                            responder: DeviceGetConfigurationsResponder {
851                                control_handle: std::mem::ManuallyDrop::new(control_handle),
852                                tx_id: header.tx_id,
853                            },
854                        })
855                    }
856                    0x2667155e740fb9ff => {
857                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
858                        let mut req = fidl::new_empty!(
859                            fidl::encoding::EmptyPayload,
860                            fidl::encoding::DefaultFuchsiaResourceDialect
861                        );
862                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
863                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
864                        Ok(DeviceRequest::GetConfigurations2 {
865                            responder: DeviceGetConfigurations2Responder {
866                                control_handle: std::mem::ManuallyDrop::new(control_handle),
867                                tx_id: header.tx_id,
868                            },
869                        })
870                    }
871                    0x7a82832a127834b7 => {
872                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
873                        let mut req = fidl::new_empty!(
874                            fidl::encoding::EmptyPayload,
875                            fidl::encoding::DefaultFuchsiaResourceDialect
876                        );
877                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
878                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
879                        Ok(DeviceRequest::WatchCurrentConfiguration {
880                            responder: DeviceWatchCurrentConfigurationResponder {
881                                control_handle: std::mem::ManuallyDrop::new(control_handle),
882                                tx_id: header.tx_id,
883                            },
884                        })
885                    }
886                    0x11d65c8f92593b87 => {
887                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
888                        let mut req = fidl::new_empty!(
889                            DeviceSetCurrentConfigurationRequest,
890                            fidl::encoding::DefaultFuchsiaResourceDialect
891                        );
892                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetCurrentConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
893                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
894                        Ok(DeviceRequest::SetCurrentConfiguration {
895                            index: req.index,
896
897                            control_handle,
898                        })
899                    }
900                    0x2bafd68e6e7ef2fb => {
901                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
902                        let mut req = fidl::new_empty!(
903                            fidl::encoding::EmptyPayload,
904                            fidl::encoding::DefaultFuchsiaResourceDialect
905                        );
906                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
907                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
908                        Ok(DeviceRequest::WatchMuteState {
909                            responder: DeviceWatchMuteStateResponder {
910                                control_handle: std::mem::ManuallyDrop::new(control_handle),
911                                tx_id: header.tx_id,
912                            },
913                        })
914                    }
915                    0x6bb19cb687f560a5 => {
916                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
917                        let mut req = fidl::new_empty!(
918                            DeviceSetSoftwareMuteStateRequest,
919                            fidl::encoding::DefaultFuchsiaResourceDialect
920                        );
921                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetSoftwareMuteStateRequest>(&header, _body_bytes, handles, &mut req)?;
922                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
923                        Ok(DeviceRequest::SetSoftwareMuteState {
924                            muted: req.muted,
925
926                            responder: DeviceSetSoftwareMuteStateResponder {
927                                control_handle: std::mem::ManuallyDrop::new(control_handle),
928                                tx_id: header.tx_id,
929                            },
930                        })
931                    }
932                    0x290a86763174c4c3 => {
933                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
934                        let mut req = fidl::new_empty!(
935                            DeviceConnectToStreamRequest,
936                            fidl::encoding::DefaultFuchsiaResourceDialect
937                        );
938                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectToStreamRequest>(&header, _body_bytes, handles, &mut req)?;
939                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
940                        Ok(DeviceRequest::ConnectToStream {
941                            index: req.index,
942                            request: req.request,
943
944                            control_handle,
945                        })
946                    }
947                    0x24811b7cee5c51c3 => {
948                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
949                        let mut req = fidl::new_empty!(
950                            DeviceRebindRequest,
951                            fidl::encoding::DefaultFuchsiaResourceDialect
952                        );
953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRebindRequest>(&header, _body_bytes, handles, &mut req)?;
954                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
955                        Ok(DeviceRequest::Rebind { request: req.request, control_handle })
956                    }
957                    _ => Err(fidl::Error::UnknownOrdinal {
958                        ordinal: header.ordinal,
959                        protocol_name:
960                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
961                    }),
962                }))
963            },
964        )
965    }
966}
967
968/// A Device represents a unique physical camera present in the system. Only one client may connect
969/// to an unbound physical camera, however the "Rebind" method can be used to create multiple
970/// connections to it to be used by a coordinated set of clients.
971#[derive(Debug)]
972pub enum DeviceRequest {
973    /// Returns an identifier for the camera. If present, identical devices on different systems
974    /// will have the same identifier. Clients may use this to determine if additional semantics
975    /// known a priori for a given device apply to the current camera.
976    GetIdentifier { responder: DeviceGetIdentifierResponder },
977    /// Returns a list of configurations supported by the camera. All cameras will have at least
978    /// one configuration. The values returned are immutable - they will not change for the
979    /// lifetime of the client's connection to the Camera.
980    GetConfigurations { responder: DeviceGetConfigurationsResponder },
981    /// Returns a list of configurations supported by the camera. All cameras will have at least
982    /// one configuration. The values returned are immutable - they will not change for the
983    /// lifetime of the client's connection to the Camera.
984    GetConfigurations2 { responder: DeviceGetConfigurations2Responder },
985    /// Returns the index of the current configuration when it has changed from a previously
986    /// returned configuration, or is called by a client for the first time.
987    WatchCurrentConfiguration { responder: DeviceWatchCurrentConfigurationResponder },
988    /// Sets the configuration using the provided index. Calling this method disconnects any
989    /// existing Stream clients associated with this camera. An epitaph of ZX_OK
990    /// will be sent for any connected Stream clients on closing.
991    SetCurrentConfiguration { index: u32, control_handle: DeviceControlHandle },
992    /// Returns the camera's current mute state when it has changed from a previously returned
993    /// state, or is called by a client for the first time. A camera may be muted using
994    /// SetSoftwareMuteState or by a physical switch. If either muted mode is active, stream
995    /// clients associated with this physical camera will stop receiving new frames.
996    WatchMuteState { responder: DeviceWatchMuteStateResponder },
997    /// Sets the current camera's software mute state. When transitioning to the muted state, this
998    /// method returns when the camera has successfully ceased sending new frames to stream
999    /// clients. When transitioning to the unmuted state, this method returns immediately.
1000    SetSoftwareMuteState { muted: bool, responder: DeviceSetSoftwareMuteStateResponder },
1001    /// Connects to the Stream at the provided index. If any clients already exist for this stream,
1002    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
1003    ConnectToStream {
1004        index: u32,
1005        request: fidl::endpoints::ServerEnd<Stream_Marker>,
1006        control_handle: DeviceControlHandle,
1007    },
1008    /// Request another connection to this Device. This allows a client to delegate different
1009    /// operations to different coordinated clients.
1010    Rebind {
1011        request: fidl::endpoints::ServerEnd<DeviceMarker>,
1012        control_handle: DeviceControlHandle,
1013    },
1014}
1015
1016impl DeviceRequest {
1017    #[allow(irrefutable_let_patterns)]
1018    pub fn into_get_identifier(self) -> Option<(DeviceGetIdentifierResponder)> {
1019        if let DeviceRequest::GetIdentifier { responder } = self { Some((responder)) } else { None }
1020    }
1021
1022    #[allow(irrefutable_let_patterns)]
1023    pub fn into_get_configurations(self) -> Option<(DeviceGetConfigurationsResponder)> {
1024        if let DeviceRequest::GetConfigurations { responder } = self {
1025            Some((responder))
1026        } else {
1027            None
1028        }
1029    }
1030
1031    #[allow(irrefutable_let_patterns)]
1032    pub fn into_get_configurations2(self) -> Option<(DeviceGetConfigurations2Responder)> {
1033        if let DeviceRequest::GetConfigurations2 { responder } = self {
1034            Some((responder))
1035        } else {
1036            None
1037        }
1038    }
1039
1040    #[allow(irrefutable_let_patterns)]
1041    pub fn into_watch_current_configuration(
1042        self,
1043    ) -> Option<(DeviceWatchCurrentConfigurationResponder)> {
1044        if let DeviceRequest::WatchCurrentConfiguration { responder } = self {
1045            Some((responder))
1046        } else {
1047            None
1048        }
1049    }
1050
1051    #[allow(irrefutable_let_patterns)]
1052    pub fn into_set_current_configuration(self) -> Option<(u32, DeviceControlHandle)> {
1053        if let DeviceRequest::SetCurrentConfiguration { index, control_handle } = self {
1054            Some((index, control_handle))
1055        } else {
1056            None
1057        }
1058    }
1059
1060    #[allow(irrefutable_let_patterns)]
1061    pub fn into_watch_mute_state(self) -> Option<(DeviceWatchMuteStateResponder)> {
1062        if let DeviceRequest::WatchMuteState { responder } = self {
1063            Some((responder))
1064        } else {
1065            None
1066        }
1067    }
1068
1069    #[allow(irrefutable_let_patterns)]
1070    pub fn into_set_software_mute_state(
1071        self,
1072    ) -> Option<(bool, DeviceSetSoftwareMuteStateResponder)> {
1073        if let DeviceRequest::SetSoftwareMuteState { muted, responder } = self {
1074            Some((muted, responder))
1075        } else {
1076            None
1077        }
1078    }
1079
1080    #[allow(irrefutable_let_patterns)]
1081    pub fn into_connect_to_stream(
1082        self,
1083    ) -> Option<(u32, fidl::endpoints::ServerEnd<Stream_Marker>, DeviceControlHandle)> {
1084        if let DeviceRequest::ConnectToStream { index, request, control_handle } = self {
1085            Some((index, request, control_handle))
1086        } else {
1087            None
1088        }
1089    }
1090
1091    #[allow(irrefutable_let_patterns)]
1092    pub fn into_rebind(
1093        self,
1094    ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceControlHandle)> {
1095        if let DeviceRequest::Rebind { request, control_handle } = self {
1096            Some((request, control_handle))
1097        } else {
1098            None
1099        }
1100    }
1101
1102    /// Name of the method defined in FIDL
1103    pub fn method_name(&self) -> &'static str {
1104        match *self {
1105            DeviceRequest::GetIdentifier { .. } => "get_identifier",
1106            DeviceRequest::GetConfigurations { .. } => "get_configurations",
1107            DeviceRequest::GetConfigurations2 { .. } => "get_configurations2",
1108            DeviceRequest::WatchCurrentConfiguration { .. } => "watch_current_configuration",
1109            DeviceRequest::SetCurrentConfiguration { .. } => "set_current_configuration",
1110            DeviceRequest::WatchMuteState { .. } => "watch_mute_state",
1111            DeviceRequest::SetSoftwareMuteState { .. } => "set_software_mute_state",
1112            DeviceRequest::ConnectToStream { .. } => "connect_to_stream",
1113            DeviceRequest::Rebind { .. } => "rebind",
1114        }
1115    }
1116}
1117
1118#[derive(Debug, Clone)]
1119pub struct DeviceControlHandle {
1120    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1121}
1122
1123impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1124    fn shutdown(&self) {
1125        self.inner.shutdown()
1126    }
1127    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1128        self.inner.shutdown_with_epitaph(status)
1129    }
1130
1131    fn is_closed(&self) -> bool {
1132        self.inner.channel().is_closed()
1133    }
1134    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1135        self.inner.channel().on_closed()
1136    }
1137
1138    #[cfg(target_os = "fuchsia")]
1139    fn signal_peer(
1140        &self,
1141        clear_mask: zx::Signals,
1142        set_mask: zx::Signals,
1143    ) -> Result<(), zx_status::Status> {
1144        use fidl::Peered;
1145        self.inner.channel().signal_peer(clear_mask, set_mask)
1146    }
1147}
1148
1149impl DeviceControlHandle {}
1150
1151#[must_use = "FIDL methods require a response to be sent"]
1152#[derive(Debug)]
1153pub struct DeviceGetIdentifierResponder {
1154    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1155    tx_id: u32,
1156}
1157
1158/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1159/// if the responder is dropped without sending a response, so that the client
1160/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1161impl std::ops::Drop for DeviceGetIdentifierResponder {
1162    fn drop(&mut self) {
1163        self.control_handle.shutdown();
1164        // Safety: drops once, never accessed again
1165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166    }
1167}
1168
1169impl fidl::endpoints::Responder for DeviceGetIdentifierResponder {
1170    type ControlHandle = DeviceControlHandle;
1171
1172    fn control_handle(&self) -> &DeviceControlHandle {
1173        &self.control_handle
1174    }
1175
1176    fn drop_without_shutdown(mut self) {
1177        // Safety: drops once, never accessed again due to mem::forget
1178        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1179        // Prevent Drop from running (which would shut down the channel)
1180        std::mem::forget(self);
1181    }
1182}
1183
1184impl DeviceGetIdentifierResponder {
1185    /// Sends a response to the FIDL transaction.
1186    ///
1187    /// Sets the channel to shutdown if an error occurs.
1188    pub fn send(self, mut identifier: Option<&str>) -> Result<(), fidl::Error> {
1189        let _result = self.send_raw(identifier);
1190        if _result.is_err() {
1191            self.control_handle.shutdown();
1192        }
1193        self.drop_without_shutdown();
1194        _result
1195    }
1196
1197    /// Similar to "send" but does not shutdown the channel if an error occurs.
1198    pub fn send_no_shutdown_on_err(self, mut identifier: Option<&str>) -> Result<(), fidl::Error> {
1199        let _result = self.send_raw(identifier);
1200        self.drop_without_shutdown();
1201        _result
1202    }
1203
1204    fn send_raw(&self, mut identifier: Option<&str>) -> Result<(), fidl::Error> {
1205        self.control_handle.inner.send::<DeviceGetIdentifierResponse>(
1206            (identifier,),
1207            self.tx_id,
1208            0x1417d1af92667e47,
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 DeviceGetConfigurationsResponder {
1217    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1218    tx_id: u32,
1219}
1220
1221/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1222/// if the responder is dropped without sending a response, so that the client
1223/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1224impl std::ops::Drop for DeviceGetConfigurationsResponder {
1225    fn drop(&mut self) {
1226        self.control_handle.shutdown();
1227        // Safety: drops once, never accessed again
1228        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1229    }
1230}
1231
1232impl fidl::endpoints::Responder for DeviceGetConfigurationsResponder {
1233    type ControlHandle = DeviceControlHandle;
1234
1235    fn control_handle(&self) -> &DeviceControlHandle {
1236        &self.control_handle
1237    }
1238
1239    fn drop_without_shutdown(mut self) {
1240        // Safety: drops once, never accessed again due to mem::forget
1241        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1242        // Prevent Drop from running (which would shut down the channel)
1243        std::mem::forget(self);
1244    }
1245}
1246
1247impl DeviceGetConfigurationsResponder {
1248    /// Sends a response to the FIDL transaction.
1249    ///
1250    /// Sets the channel to shutdown if an error occurs.
1251    pub fn send(self, mut configurations: &[Configuration]) -> Result<(), fidl::Error> {
1252        let _result = self.send_raw(configurations);
1253        if _result.is_err() {
1254            self.control_handle.shutdown();
1255        }
1256        self.drop_without_shutdown();
1257        _result
1258    }
1259
1260    /// Similar to "send" but does not shutdown the channel if an error occurs.
1261    pub fn send_no_shutdown_on_err(
1262        self,
1263        mut configurations: &[Configuration],
1264    ) -> Result<(), fidl::Error> {
1265        let _result = self.send_raw(configurations);
1266        self.drop_without_shutdown();
1267        _result
1268    }
1269
1270    fn send_raw(&self, mut configurations: &[Configuration]) -> Result<(), fidl::Error> {
1271        self.control_handle.inner.send::<DeviceGetConfigurationsResponse>(
1272            (configurations,),
1273            self.tx_id,
1274            0x26c7a180d8eef786,
1275            fidl::encoding::DynamicFlags::empty(),
1276        )
1277    }
1278}
1279
1280#[must_use = "FIDL methods require a response to be sent"]
1281#[derive(Debug)]
1282pub struct DeviceGetConfigurations2Responder {
1283    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1284    tx_id: u32,
1285}
1286
1287/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1288/// if the responder is dropped without sending a response, so that the client
1289/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1290impl std::ops::Drop for DeviceGetConfigurations2Responder {
1291    fn drop(&mut self) {
1292        self.control_handle.shutdown();
1293        // Safety: drops once, never accessed again
1294        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1295    }
1296}
1297
1298impl fidl::endpoints::Responder for DeviceGetConfigurations2Responder {
1299    type ControlHandle = DeviceControlHandle;
1300
1301    fn control_handle(&self) -> &DeviceControlHandle {
1302        &self.control_handle
1303    }
1304
1305    fn drop_without_shutdown(mut self) {
1306        // Safety: drops once, never accessed again due to mem::forget
1307        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1308        // Prevent Drop from running (which would shut down the channel)
1309        std::mem::forget(self);
1310    }
1311}
1312
1313impl DeviceGetConfigurations2Responder {
1314    /// Sends a response to the FIDL transaction.
1315    ///
1316    /// Sets the channel to shutdown if an error occurs.
1317    pub fn send(self, mut configurations: &[Configuration2]) -> Result<(), fidl::Error> {
1318        let _result = self.send_raw(configurations);
1319        if _result.is_err() {
1320            self.control_handle.shutdown();
1321        }
1322        self.drop_without_shutdown();
1323        _result
1324    }
1325
1326    /// Similar to "send" but does not shutdown the channel if an error occurs.
1327    pub fn send_no_shutdown_on_err(
1328        self,
1329        mut configurations: &[Configuration2],
1330    ) -> Result<(), fidl::Error> {
1331        let _result = self.send_raw(configurations);
1332        self.drop_without_shutdown();
1333        _result
1334    }
1335
1336    fn send_raw(&self, mut configurations: &[Configuration2]) -> Result<(), fidl::Error> {
1337        self.control_handle.inner.send::<DeviceGetConfigurations2Response>(
1338            (configurations,),
1339            self.tx_id,
1340            0x2667155e740fb9ff,
1341            fidl::encoding::DynamicFlags::empty(),
1342        )
1343    }
1344}
1345
1346#[must_use = "FIDL methods require a response to be sent"]
1347#[derive(Debug)]
1348pub struct DeviceWatchCurrentConfigurationResponder {
1349    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1350    tx_id: u32,
1351}
1352
1353/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1354/// if the responder is dropped without sending a response, so that the client
1355/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1356impl std::ops::Drop for DeviceWatchCurrentConfigurationResponder {
1357    fn drop(&mut self) {
1358        self.control_handle.shutdown();
1359        // Safety: drops once, never accessed again
1360        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361    }
1362}
1363
1364impl fidl::endpoints::Responder for DeviceWatchCurrentConfigurationResponder {
1365    type ControlHandle = DeviceControlHandle;
1366
1367    fn control_handle(&self) -> &DeviceControlHandle {
1368        &self.control_handle
1369    }
1370
1371    fn drop_without_shutdown(mut self) {
1372        // Safety: drops once, never accessed again due to mem::forget
1373        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1374        // Prevent Drop from running (which would shut down the channel)
1375        std::mem::forget(self);
1376    }
1377}
1378
1379impl DeviceWatchCurrentConfigurationResponder {
1380    /// Sends a response to the FIDL transaction.
1381    ///
1382    /// Sets the channel to shutdown if an error occurs.
1383    pub fn send(self, mut index: u32) -> Result<(), fidl::Error> {
1384        let _result = self.send_raw(index);
1385        if _result.is_err() {
1386            self.control_handle.shutdown();
1387        }
1388        self.drop_without_shutdown();
1389        _result
1390    }
1391
1392    /// Similar to "send" but does not shutdown the channel if an error occurs.
1393    pub fn send_no_shutdown_on_err(self, mut index: u32) -> Result<(), fidl::Error> {
1394        let _result = self.send_raw(index);
1395        self.drop_without_shutdown();
1396        _result
1397    }
1398
1399    fn send_raw(&self, mut index: u32) -> Result<(), fidl::Error> {
1400        self.control_handle.inner.send::<DeviceWatchCurrentConfigurationResponse>(
1401            (index,),
1402            self.tx_id,
1403            0x7a82832a127834b7,
1404            fidl::encoding::DynamicFlags::empty(),
1405        )
1406    }
1407}
1408
1409#[must_use = "FIDL methods require a response to be sent"]
1410#[derive(Debug)]
1411pub struct DeviceWatchMuteStateResponder {
1412    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1413    tx_id: u32,
1414}
1415
1416/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1417/// if the responder is dropped without sending a response, so that the client
1418/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1419impl std::ops::Drop for DeviceWatchMuteStateResponder {
1420    fn drop(&mut self) {
1421        self.control_handle.shutdown();
1422        // Safety: drops once, never accessed again
1423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424    }
1425}
1426
1427impl fidl::endpoints::Responder for DeviceWatchMuteStateResponder {
1428    type ControlHandle = DeviceControlHandle;
1429
1430    fn control_handle(&self) -> &DeviceControlHandle {
1431        &self.control_handle
1432    }
1433
1434    fn drop_without_shutdown(mut self) {
1435        // Safety: drops once, never accessed again due to mem::forget
1436        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1437        // Prevent Drop from running (which would shut down the channel)
1438        std::mem::forget(self);
1439    }
1440}
1441
1442impl DeviceWatchMuteStateResponder {
1443    /// Sends a response to the FIDL transaction.
1444    ///
1445    /// Sets the channel to shutdown if an error occurs.
1446    pub fn send(
1447        self,
1448        mut software_muted: bool,
1449        mut hardware_muted: bool,
1450    ) -> Result<(), fidl::Error> {
1451        let _result = self.send_raw(software_muted, hardware_muted);
1452        if _result.is_err() {
1453            self.control_handle.shutdown();
1454        }
1455        self.drop_without_shutdown();
1456        _result
1457    }
1458
1459    /// Similar to "send" but does not shutdown the channel if an error occurs.
1460    pub fn send_no_shutdown_on_err(
1461        self,
1462        mut software_muted: bool,
1463        mut hardware_muted: bool,
1464    ) -> Result<(), fidl::Error> {
1465        let _result = self.send_raw(software_muted, hardware_muted);
1466        self.drop_without_shutdown();
1467        _result
1468    }
1469
1470    fn send_raw(
1471        &self,
1472        mut software_muted: bool,
1473        mut hardware_muted: bool,
1474    ) -> Result<(), fidl::Error> {
1475        self.control_handle.inner.send::<DeviceWatchMuteStateResponse>(
1476            (software_muted, hardware_muted),
1477            self.tx_id,
1478            0x2bafd68e6e7ef2fb,
1479            fidl::encoding::DynamicFlags::empty(),
1480        )
1481    }
1482}
1483
1484#[must_use = "FIDL methods require a response to be sent"]
1485#[derive(Debug)]
1486pub struct DeviceSetSoftwareMuteStateResponder {
1487    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1488    tx_id: u32,
1489}
1490
1491/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1492/// if the responder is dropped without sending a response, so that the client
1493/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1494impl std::ops::Drop for DeviceSetSoftwareMuteStateResponder {
1495    fn drop(&mut self) {
1496        self.control_handle.shutdown();
1497        // Safety: drops once, never accessed again
1498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1499    }
1500}
1501
1502impl fidl::endpoints::Responder for DeviceSetSoftwareMuteStateResponder {
1503    type ControlHandle = DeviceControlHandle;
1504
1505    fn control_handle(&self) -> &DeviceControlHandle {
1506        &self.control_handle
1507    }
1508
1509    fn drop_without_shutdown(mut self) {
1510        // Safety: drops once, never accessed again due to mem::forget
1511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1512        // Prevent Drop from running (which would shut down the channel)
1513        std::mem::forget(self);
1514    }
1515}
1516
1517impl DeviceSetSoftwareMuteStateResponder {
1518    /// Sends a response to the FIDL transaction.
1519    ///
1520    /// Sets the channel to shutdown if an error occurs.
1521    pub fn send(self) -> Result<(), fidl::Error> {
1522        let _result = self.send_raw();
1523        if _result.is_err() {
1524            self.control_handle.shutdown();
1525        }
1526        self.drop_without_shutdown();
1527        _result
1528    }
1529
1530    /// Similar to "send" but does not shutdown the channel if an error occurs.
1531    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1532        let _result = self.send_raw();
1533        self.drop_without_shutdown();
1534        _result
1535    }
1536
1537    fn send_raw(&self) -> Result<(), fidl::Error> {
1538        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1539            (),
1540            self.tx_id,
1541            0x6bb19cb687f560a5,
1542            fidl::encoding::DynamicFlags::empty(),
1543        )
1544    }
1545}
1546
1547#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1548pub struct DeviceWatcherMarker;
1549
1550impl fidl::endpoints::ProtocolMarker for DeviceWatcherMarker {
1551    type Proxy = DeviceWatcherProxy;
1552    type RequestStream = DeviceWatcherRequestStream;
1553    #[cfg(target_os = "fuchsia")]
1554    type SynchronousProxy = DeviceWatcherSynchronousProxy;
1555
1556    const DEBUG_NAME: &'static str = "fuchsia.camera3.DeviceWatcher";
1557}
1558impl fidl::endpoints::DiscoverableProtocolMarker for DeviceWatcherMarker {}
1559
1560pub trait DeviceWatcherProxyInterface: Send + Sync {
1561    type WatchDevicesResponseFut: std::future::Future<Output = Result<Vec<WatchDevicesEvent>, fidl::Error>>
1562        + Send;
1563    fn r#watch_devices(&self) -> Self::WatchDevicesResponseFut;
1564    fn r#connect_to_device(
1565        &self,
1566        id: u64,
1567        request: fidl::endpoints::ServerEnd<DeviceMarker>,
1568    ) -> Result<(), fidl::Error>;
1569}
1570#[derive(Debug)]
1571#[cfg(target_os = "fuchsia")]
1572pub struct DeviceWatcherSynchronousProxy {
1573    client: fidl::client::sync::Client,
1574}
1575
1576#[cfg(target_os = "fuchsia")]
1577impl fidl::endpoints::SynchronousProxy for DeviceWatcherSynchronousProxy {
1578    type Proxy = DeviceWatcherProxy;
1579    type Protocol = DeviceWatcherMarker;
1580
1581    fn from_channel(inner: fidl::Channel) -> Self {
1582        Self::new(inner)
1583    }
1584
1585    fn into_channel(self) -> fidl::Channel {
1586        self.client.into_channel()
1587    }
1588
1589    fn as_channel(&self) -> &fidl::Channel {
1590        self.client.as_channel()
1591    }
1592}
1593
1594#[cfg(target_os = "fuchsia")]
1595impl DeviceWatcherSynchronousProxy {
1596    pub fn new(channel: fidl::Channel) -> Self {
1597        let protocol_name = <DeviceWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1598        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1599    }
1600
1601    pub fn into_channel(self) -> fidl::Channel {
1602        self.client.into_channel()
1603    }
1604
1605    /// Waits until an event arrives and returns it. It is safe for other
1606    /// threads to make concurrent requests while waiting for an event.
1607    pub fn wait_for_event(
1608        &self,
1609        deadline: zx::MonotonicInstant,
1610    ) -> Result<DeviceWatcherEvent, fidl::Error> {
1611        DeviceWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1612    }
1613
1614    /// Returns a list of available camera IDs when it has changed from the previously returned
1615    /// list of IDs, or when it is called by a client for the first time. The returned list may be
1616    /// empty, indicating no cameras are available. The IDs returned to the client will remain
1617    /// consistent with respect to the physical devices they represent for the duration of the
1618    /// client's connection. Events will be sorted first by event type - `existing`, `added`,
1619    /// `removed`. Within each event type range, IDs will be provided in ascending order. Events
1620    /// are coalesced by the server, so a given ID will only appear once in each list of events.
1621    ///
1622    /// Please note that it is entirely possible for the list returned to be temporarily empty even
1623    /// if the local camera hardware is hardwired (vs plug-in like USB). The empty list condition
1624    /// is temporary on such a platform.
1625    ///
1626    /// Camera applications should tolerate an empty list returned, and attempt to retry the
1627    /// `WatchDevices()` call.
1628    pub fn r#watch_devices(
1629        &self,
1630        ___deadline: zx::MonotonicInstant,
1631    ) -> Result<Vec<WatchDevicesEvent>, fidl::Error> {
1632        let _response = self
1633            .client
1634            .send_query::<fidl::encoding::EmptyPayload, DeviceWatcherWatchDevicesResponse>(
1635                (),
1636                0x5f38542e295e8575,
1637                fidl::encoding::DynamicFlags::empty(),
1638                ___deadline,
1639            )?;
1640        Ok(_response.events)
1641    }
1642
1643    /// Acquires a camera interface for the given ID. If any clients already exist for this camera,
1644    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
1645    pub fn r#connect_to_device(
1646        &self,
1647        mut id: u64,
1648        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
1649    ) -> Result<(), fidl::Error> {
1650        self.client.send::<DeviceWatcherConnectToDeviceRequest>(
1651            (id, request),
1652            0x5f175a8283b26b2d,
1653            fidl::encoding::DynamicFlags::empty(),
1654        )
1655    }
1656}
1657
1658#[cfg(target_os = "fuchsia")]
1659impl From<DeviceWatcherSynchronousProxy> for zx::Handle {
1660    fn from(value: DeviceWatcherSynchronousProxy) -> Self {
1661        value.into_channel().into()
1662    }
1663}
1664
1665#[cfg(target_os = "fuchsia")]
1666impl From<fidl::Channel> for DeviceWatcherSynchronousProxy {
1667    fn from(value: fidl::Channel) -> Self {
1668        Self::new(value)
1669    }
1670}
1671
1672#[cfg(target_os = "fuchsia")]
1673impl fidl::endpoints::FromClient for DeviceWatcherSynchronousProxy {
1674    type Protocol = DeviceWatcherMarker;
1675
1676    fn from_client(value: fidl::endpoints::ClientEnd<DeviceWatcherMarker>) -> Self {
1677        Self::new(value.into_channel())
1678    }
1679}
1680
1681#[derive(Debug, Clone)]
1682pub struct DeviceWatcherProxy {
1683    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1684}
1685
1686impl fidl::endpoints::Proxy for DeviceWatcherProxy {
1687    type Protocol = DeviceWatcherMarker;
1688
1689    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1690        Self::new(inner)
1691    }
1692
1693    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1694        self.client.into_channel().map_err(|client| Self { client })
1695    }
1696
1697    fn as_channel(&self) -> &::fidl::AsyncChannel {
1698        self.client.as_channel()
1699    }
1700}
1701
1702impl DeviceWatcherProxy {
1703    /// Create a new Proxy for fuchsia.camera3/DeviceWatcher.
1704    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1705        let protocol_name = <DeviceWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1706        Self { client: fidl::client::Client::new(channel, protocol_name) }
1707    }
1708
1709    /// Get a Stream of events from the remote end of the protocol.
1710    ///
1711    /// # Panics
1712    ///
1713    /// Panics if the event stream was already taken.
1714    pub fn take_event_stream(&self) -> DeviceWatcherEventStream {
1715        DeviceWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1716    }
1717
1718    /// Returns a list of available camera IDs when it has changed from the previously returned
1719    /// list of IDs, or when it is called by a client for the first time. The returned list may be
1720    /// empty, indicating no cameras are available. The IDs returned to the client will remain
1721    /// consistent with respect to the physical devices they represent for the duration of the
1722    /// client's connection. Events will be sorted first by event type - `existing`, `added`,
1723    /// `removed`. Within each event type range, IDs will be provided in ascending order. Events
1724    /// are coalesced by the server, so a given ID will only appear once in each list of events.
1725    ///
1726    /// Please note that it is entirely possible for the list returned to be temporarily empty even
1727    /// if the local camera hardware is hardwired (vs plug-in like USB). The empty list condition
1728    /// is temporary on such a platform.
1729    ///
1730    /// Camera applications should tolerate an empty list returned, and attempt to retry the
1731    /// `WatchDevices()` call.
1732    pub fn r#watch_devices(
1733        &self,
1734    ) -> fidl::client::QueryResponseFut<
1735        Vec<WatchDevicesEvent>,
1736        fidl::encoding::DefaultFuchsiaResourceDialect,
1737    > {
1738        DeviceWatcherProxyInterface::r#watch_devices(self)
1739    }
1740
1741    /// Acquires a camera interface for the given ID. If any clients already exist for this camera,
1742    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
1743    pub fn r#connect_to_device(
1744        &self,
1745        mut id: u64,
1746        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
1747    ) -> Result<(), fidl::Error> {
1748        DeviceWatcherProxyInterface::r#connect_to_device(self, id, request)
1749    }
1750}
1751
1752impl DeviceWatcherProxyInterface for DeviceWatcherProxy {
1753    type WatchDevicesResponseFut = fidl::client::QueryResponseFut<
1754        Vec<WatchDevicesEvent>,
1755        fidl::encoding::DefaultFuchsiaResourceDialect,
1756    >;
1757    fn r#watch_devices(&self) -> Self::WatchDevicesResponseFut {
1758        fn _decode(
1759            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1760        ) -> Result<Vec<WatchDevicesEvent>, fidl::Error> {
1761            let _response = fidl::client::decode_transaction_body::<
1762                DeviceWatcherWatchDevicesResponse,
1763                fidl::encoding::DefaultFuchsiaResourceDialect,
1764                0x5f38542e295e8575,
1765            >(_buf?)?;
1766            Ok(_response.events)
1767        }
1768        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<WatchDevicesEvent>>(
1769            (),
1770            0x5f38542e295e8575,
1771            fidl::encoding::DynamicFlags::empty(),
1772            _decode,
1773        )
1774    }
1775
1776    fn r#connect_to_device(
1777        &self,
1778        mut id: u64,
1779        mut request: fidl::endpoints::ServerEnd<DeviceMarker>,
1780    ) -> Result<(), fidl::Error> {
1781        self.client.send::<DeviceWatcherConnectToDeviceRequest>(
1782            (id, request),
1783            0x5f175a8283b26b2d,
1784            fidl::encoding::DynamicFlags::empty(),
1785        )
1786    }
1787}
1788
1789pub struct DeviceWatcherEventStream {
1790    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1791}
1792
1793impl std::marker::Unpin for DeviceWatcherEventStream {}
1794
1795impl futures::stream::FusedStream for DeviceWatcherEventStream {
1796    fn is_terminated(&self) -> bool {
1797        self.event_receiver.is_terminated()
1798    }
1799}
1800
1801impl futures::Stream for DeviceWatcherEventStream {
1802    type Item = Result<DeviceWatcherEvent, fidl::Error>;
1803
1804    fn poll_next(
1805        mut self: std::pin::Pin<&mut Self>,
1806        cx: &mut std::task::Context<'_>,
1807    ) -> std::task::Poll<Option<Self::Item>> {
1808        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1809            &mut self.event_receiver,
1810            cx
1811        )?) {
1812            Some(buf) => std::task::Poll::Ready(Some(DeviceWatcherEvent::decode(buf))),
1813            None => std::task::Poll::Ready(None),
1814        }
1815    }
1816}
1817
1818#[derive(Debug)]
1819pub enum DeviceWatcherEvent {}
1820
1821impl DeviceWatcherEvent {
1822    /// Decodes a message buffer as a [`DeviceWatcherEvent`].
1823    fn decode(
1824        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1825    ) -> Result<DeviceWatcherEvent, fidl::Error> {
1826        let (bytes, _handles) = buf.split_mut();
1827        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1828        debug_assert_eq!(tx_header.tx_id, 0);
1829        match tx_header.ordinal {
1830            _ => Err(fidl::Error::UnknownOrdinal {
1831                ordinal: tx_header.ordinal,
1832                protocol_name: <DeviceWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1833            }),
1834        }
1835    }
1836}
1837
1838/// A Stream of incoming requests for fuchsia.camera3/DeviceWatcher.
1839pub struct DeviceWatcherRequestStream {
1840    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1841    is_terminated: bool,
1842}
1843
1844impl std::marker::Unpin for DeviceWatcherRequestStream {}
1845
1846impl futures::stream::FusedStream for DeviceWatcherRequestStream {
1847    fn is_terminated(&self) -> bool {
1848        self.is_terminated
1849    }
1850}
1851
1852impl fidl::endpoints::RequestStream for DeviceWatcherRequestStream {
1853    type Protocol = DeviceWatcherMarker;
1854    type ControlHandle = DeviceWatcherControlHandle;
1855
1856    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1857        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1858    }
1859
1860    fn control_handle(&self) -> Self::ControlHandle {
1861        DeviceWatcherControlHandle { inner: self.inner.clone() }
1862    }
1863
1864    fn into_inner(
1865        self,
1866    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1867    {
1868        (self.inner, self.is_terminated)
1869    }
1870
1871    fn from_inner(
1872        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1873        is_terminated: bool,
1874    ) -> Self {
1875        Self { inner, is_terminated }
1876    }
1877}
1878
1879impl futures::Stream for DeviceWatcherRequestStream {
1880    type Item = Result<DeviceWatcherRequest, fidl::Error>;
1881
1882    fn poll_next(
1883        mut self: std::pin::Pin<&mut Self>,
1884        cx: &mut std::task::Context<'_>,
1885    ) -> std::task::Poll<Option<Self::Item>> {
1886        let this = &mut *self;
1887        if this.inner.check_shutdown(cx) {
1888            this.is_terminated = true;
1889            return std::task::Poll::Ready(None);
1890        }
1891        if this.is_terminated {
1892            panic!("polled DeviceWatcherRequestStream after completion");
1893        }
1894        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1895            |bytes, handles| {
1896                match this.inner.channel().read_etc(cx, bytes, handles) {
1897                    std::task::Poll::Ready(Ok(())) => {}
1898                    std::task::Poll::Pending => return std::task::Poll::Pending,
1899                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1900                        this.is_terminated = true;
1901                        return std::task::Poll::Ready(None);
1902                    }
1903                    std::task::Poll::Ready(Err(e)) => {
1904                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1905                            e.into(),
1906                        ))));
1907                    }
1908                }
1909
1910                // A message has been received from the channel
1911                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1912
1913                std::task::Poll::Ready(Some(match header.ordinal {
1914                    0x5f38542e295e8575 => {
1915                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1916                        let mut req = fidl::new_empty!(
1917                            fidl::encoding::EmptyPayload,
1918                            fidl::encoding::DefaultFuchsiaResourceDialect
1919                        );
1920                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1921                        let control_handle =
1922                            DeviceWatcherControlHandle { inner: this.inner.clone() };
1923                        Ok(DeviceWatcherRequest::WatchDevices {
1924                            responder: DeviceWatcherWatchDevicesResponder {
1925                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1926                                tx_id: header.tx_id,
1927                            },
1928                        })
1929                    }
1930                    0x5f175a8283b26b2d => {
1931                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1932                        let mut req = fidl::new_empty!(
1933                            DeviceWatcherConnectToDeviceRequest,
1934                            fidl::encoding::DefaultFuchsiaResourceDialect
1935                        );
1936                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWatcherConnectToDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1937                        let control_handle =
1938                            DeviceWatcherControlHandle { inner: this.inner.clone() };
1939                        Ok(DeviceWatcherRequest::ConnectToDevice {
1940                            id: req.id,
1941                            request: req.request,
1942
1943                            control_handle,
1944                        })
1945                    }
1946                    _ => Err(fidl::Error::UnknownOrdinal {
1947                        ordinal: header.ordinal,
1948                        protocol_name:
1949                            <DeviceWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1950                    }),
1951                }))
1952            },
1953        )
1954    }
1955}
1956
1957/// The DeviceWatcher provides clients a mechanism to discover camera devices present on the
1958/// system. This is a temporary mechanism intended to be replaced by go/drivers-as-components,
1959/// which will allow multiple instances of the same protocol to exist side-by-side. Clients are
1960/// not required to maintain a connection to the Watcher in order to use established Camera
1961/// connections.
1962#[derive(Debug)]
1963pub enum DeviceWatcherRequest {
1964    /// Returns a list of available camera IDs when it has changed from the previously returned
1965    /// list of IDs, or when it is called by a client for the first time. The returned list may be
1966    /// empty, indicating no cameras are available. The IDs returned to the client will remain
1967    /// consistent with respect to the physical devices they represent for the duration of the
1968    /// client's connection. Events will be sorted first by event type - `existing`, `added`,
1969    /// `removed`. Within each event type range, IDs will be provided in ascending order. Events
1970    /// are coalesced by the server, so a given ID will only appear once in each list of events.
1971    ///
1972    /// Please note that it is entirely possible for the list returned to be temporarily empty even
1973    /// if the local camera hardware is hardwired (vs plug-in like USB). The empty list condition
1974    /// is temporary on such a platform.
1975    ///
1976    /// Camera applications should tolerate an empty list returned, and attempt to retry the
1977    /// `WatchDevices()` call.
1978    WatchDevices { responder: DeviceWatcherWatchDevicesResponder },
1979    /// Acquires a camera interface for the given ID. If any clients already exist for this camera,
1980    /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph.
1981    ConnectToDevice {
1982        id: u64,
1983        request: fidl::endpoints::ServerEnd<DeviceMarker>,
1984        control_handle: DeviceWatcherControlHandle,
1985    },
1986}
1987
1988impl DeviceWatcherRequest {
1989    #[allow(irrefutable_let_patterns)]
1990    pub fn into_watch_devices(self) -> Option<(DeviceWatcherWatchDevicesResponder)> {
1991        if let DeviceWatcherRequest::WatchDevices { responder } = self {
1992            Some((responder))
1993        } else {
1994            None
1995        }
1996    }
1997
1998    #[allow(irrefutable_let_patterns)]
1999    pub fn into_connect_to_device(
2000        self,
2001    ) -> Option<(u64, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceWatcherControlHandle)> {
2002        if let DeviceWatcherRequest::ConnectToDevice { id, request, control_handle } = self {
2003            Some((id, request, control_handle))
2004        } else {
2005            None
2006        }
2007    }
2008
2009    /// Name of the method defined in FIDL
2010    pub fn method_name(&self) -> &'static str {
2011        match *self {
2012            DeviceWatcherRequest::WatchDevices { .. } => "watch_devices",
2013            DeviceWatcherRequest::ConnectToDevice { .. } => "connect_to_device",
2014        }
2015    }
2016}
2017
2018#[derive(Debug, Clone)]
2019pub struct DeviceWatcherControlHandle {
2020    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2021}
2022
2023impl fidl::endpoints::ControlHandle for DeviceWatcherControlHandle {
2024    fn shutdown(&self) {
2025        self.inner.shutdown()
2026    }
2027    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2028        self.inner.shutdown_with_epitaph(status)
2029    }
2030
2031    fn is_closed(&self) -> bool {
2032        self.inner.channel().is_closed()
2033    }
2034    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2035        self.inner.channel().on_closed()
2036    }
2037
2038    #[cfg(target_os = "fuchsia")]
2039    fn signal_peer(
2040        &self,
2041        clear_mask: zx::Signals,
2042        set_mask: zx::Signals,
2043    ) -> Result<(), zx_status::Status> {
2044        use fidl::Peered;
2045        self.inner.channel().signal_peer(clear_mask, set_mask)
2046    }
2047}
2048
2049impl DeviceWatcherControlHandle {}
2050
2051#[must_use = "FIDL methods require a response to be sent"]
2052#[derive(Debug)]
2053pub struct DeviceWatcherWatchDevicesResponder {
2054    control_handle: std::mem::ManuallyDrop<DeviceWatcherControlHandle>,
2055    tx_id: u32,
2056}
2057
2058/// Set the the channel to be shutdown (see [`DeviceWatcherControlHandle::shutdown`])
2059/// if the responder is dropped without sending a response, so that the client
2060/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2061impl std::ops::Drop for DeviceWatcherWatchDevicesResponder {
2062    fn drop(&mut self) {
2063        self.control_handle.shutdown();
2064        // Safety: drops once, never accessed again
2065        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2066    }
2067}
2068
2069impl fidl::endpoints::Responder for DeviceWatcherWatchDevicesResponder {
2070    type ControlHandle = DeviceWatcherControlHandle;
2071
2072    fn control_handle(&self) -> &DeviceWatcherControlHandle {
2073        &self.control_handle
2074    }
2075
2076    fn drop_without_shutdown(mut self) {
2077        // Safety: drops once, never accessed again due to mem::forget
2078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2079        // Prevent Drop from running (which would shut down the channel)
2080        std::mem::forget(self);
2081    }
2082}
2083
2084impl DeviceWatcherWatchDevicesResponder {
2085    /// Sends a response to the FIDL transaction.
2086    ///
2087    /// Sets the channel to shutdown if an error occurs.
2088    pub fn send(self, mut events: &[WatchDevicesEvent]) -> Result<(), fidl::Error> {
2089        let _result = self.send_raw(events);
2090        if _result.is_err() {
2091            self.control_handle.shutdown();
2092        }
2093        self.drop_without_shutdown();
2094        _result
2095    }
2096
2097    /// Similar to "send" but does not shutdown the channel if an error occurs.
2098    pub fn send_no_shutdown_on_err(
2099        self,
2100        mut events: &[WatchDevicesEvent],
2101    ) -> Result<(), fidl::Error> {
2102        let _result = self.send_raw(events);
2103        self.drop_without_shutdown();
2104        _result
2105    }
2106
2107    fn send_raw(&self, mut events: &[WatchDevicesEvent]) -> Result<(), fidl::Error> {
2108        self.control_handle.inner.send::<DeviceWatcherWatchDevicesResponse>(
2109            (events,),
2110            self.tx_id,
2111            0x5f38542e295e8575,
2112            fidl::encoding::DynamicFlags::empty(),
2113        )
2114    }
2115}
2116
2117#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2118pub struct Stream_Marker;
2119
2120impl fidl::endpoints::ProtocolMarker for Stream_Marker {
2121    type Proxy = Stream_Proxy;
2122    type RequestStream = Stream_RequestStream;
2123    #[cfg(target_os = "fuchsia")]
2124    type SynchronousProxy = Stream_SynchronousProxy;
2125
2126    const DEBUG_NAME: &'static str = "(anonymous) Stream_";
2127}
2128
2129pub trait Stream_ProxyInterface: Send + Sync {
2130    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
2131        + Send;
2132    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2133    type GetProperties2ResponseFut: std::future::Future<Output = Result<StreamProperties2, fidl::Error>>
2134        + Send;
2135    fn r#get_properties2(&self) -> Self::GetProperties2ResponseFut;
2136    fn r#set_crop_region(
2137        &self,
2138        region: Option<&fidl_fuchsia_math::RectF>,
2139    ) -> Result<(), fidl::Error>;
2140    type WatchCropRegionResponseFut: std::future::Future<Output = Result<Option<Box<fidl_fuchsia_math::RectF>>, fidl::Error>>
2141        + Send;
2142    fn r#watch_crop_region(&self) -> Self::WatchCropRegionResponseFut;
2143    fn r#set_resolution(&self, coded_size: &fidl_fuchsia_math::Size) -> Result<(), fidl::Error>;
2144    type WatchResolutionResponseFut: std::future::Future<Output = Result<fidl_fuchsia_math::Size, fidl::Error>>
2145        + Send;
2146    fn r#watch_resolution(&self) -> Self::WatchResolutionResponseFut;
2147    fn r#set_buffer_collection2(
2148        &self,
2149        token: Option<
2150            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2151        >,
2152    ) -> Result<(), fidl::Error>;
2153    fn r#set_buffer_collection(
2154        &self,
2155        token: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
2156    ) -> Result<(), fidl::Error>;
2157    type WatchBufferCollection2ResponseFut: std::future::Future<
2158            Output = Result<
2159                fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2160                fidl::Error,
2161            >,
2162        > + Send;
2163    fn r#watch_buffer_collection2(&self) -> Self::WatchBufferCollection2ResponseFut;
2164    type WatchBufferCollectionResponseFut: std::future::Future<
2165            Output = Result<
2166                fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2167                fidl::Error,
2168            >,
2169        > + Send;
2170    fn r#watch_buffer_collection(&self) -> Self::WatchBufferCollectionResponseFut;
2171    type WatchOrientationResponseFut: std::future::Future<Output = Result<Orientation, fidl::Error>>
2172        + Send;
2173    fn r#watch_orientation(&self) -> Self::WatchOrientationResponseFut;
2174    type GetNextFrameResponseFut: std::future::Future<Output = Result<FrameInfo, fidl::Error>>
2175        + Send;
2176    fn r#get_next_frame(&self) -> Self::GetNextFrameResponseFut;
2177    type GetNextFrame2ResponseFut: std::future::Future<Output = Result<FrameInfo2, fidl::Error>>
2178        + Send;
2179    fn r#get_next_frame2(&self) -> Self::GetNextFrame2ResponseFut;
2180    fn r#rebind(
2181        &self,
2182        request: fidl::endpoints::ServerEnd<Stream_Marker>,
2183    ) -> Result<(), fidl::Error>;
2184}
2185#[derive(Debug)]
2186#[cfg(target_os = "fuchsia")]
2187pub struct Stream_SynchronousProxy {
2188    client: fidl::client::sync::Client,
2189}
2190
2191#[cfg(target_os = "fuchsia")]
2192impl fidl::endpoints::SynchronousProxy for Stream_SynchronousProxy {
2193    type Proxy = Stream_Proxy;
2194    type Protocol = Stream_Marker;
2195
2196    fn from_channel(inner: fidl::Channel) -> Self {
2197        Self::new(inner)
2198    }
2199
2200    fn into_channel(self) -> fidl::Channel {
2201        self.client.into_channel()
2202    }
2203
2204    fn as_channel(&self) -> &fidl::Channel {
2205        self.client.as_channel()
2206    }
2207}
2208
2209#[cfg(target_os = "fuchsia")]
2210impl Stream_SynchronousProxy {
2211    pub fn new(channel: fidl::Channel) -> Self {
2212        let protocol_name = <Stream_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2213        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2214    }
2215
2216    pub fn into_channel(self) -> fidl::Channel {
2217        self.client.into_channel()
2218    }
2219
2220    /// Waits until an event arrives and returns it. It is safe for other
2221    /// threads to make concurrent requests while waiting for an event.
2222    pub fn wait_for_event(
2223        &self,
2224        deadline: zx::MonotonicInstant,
2225    ) -> Result<Stream_Event, fidl::Error> {
2226        Stream_Event::decode(self.client.wait_for_event(deadline)?)
2227    }
2228
2229    /// Gets the properties associated with this stream. The value returned is identical to the one
2230    /// corresponding to this stream as returned by |Device.GetConfigurations|.
2231    pub fn r#get_properties(
2232        &self,
2233        ___deadline: zx::MonotonicInstant,
2234    ) -> Result<StreamProperties, fidl::Error> {
2235        let _response =
2236            self.client.send_query::<fidl::encoding::EmptyPayload, StreamGetPropertiesResponse>(
2237                (),
2238                0x13662921504b55f7,
2239                fidl::encoding::DynamicFlags::empty(),
2240                ___deadline,
2241            )?;
2242        Ok(_response.properties)
2243    }
2244
2245    /// Gets the properties associated with this stream. The value returned is identical to the one
2246    /// corresponding to this stream as returned by |Device.GetConfigurations|.
2247    pub fn r#get_properties2(
2248        &self,
2249        ___deadline: zx::MonotonicInstant,
2250    ) -> Result<StreamProperties2, fidl::Error> {
2251        let _response =
2252            self.client.send_query::<fidl::encoding::EmptyPayload, StreamGetProperties2Response>(
2253                (),
2254                0x70346d69a8cbc391,
2255                fidl::encoding::DynamicFlags::empty(),
2256                ___deadline,
2257            )?;
2258        Ok(_response.properties)
2259    }
2260
2261    /// Sets the Stream's crop region to the provided region, with the top-left of the image
2262    /// represented by (0,0) and the bottom-right of the image represented by (1,1). The resulting
2263    /// content is subsequently scaled to fill the output buffer. If the implementation does not
2264    /// precisely support the provided value, it will be expanded to the minimum region that covers
2265    /// the provided region. If region is set to null, the crop region is unset, which is equivalent
2266    /// to specifying a region covering the entire image. Upon initial connection, the region is
2267    /// unset. If the stream does not support crop region, the connection is closed with the
2268    /// ZX_ERR_NOT_SUPPORTED epitaph.
2269    pub fn r#set_crop_region(
2270        &self,
2271        mut region: Option<&fidl_fuchsia_math::RectF>,
2272    ) -> Result<(), fidl::Error> {
2273        self.client.send::<StreamSetCropRegionRequest>(
2274            (region,),
2275            0x72dde73bf7a94302,
2276            fidl::encoding::DynamicFlags::empty(),
2277        )
2278    }
2279
2280    /// Returns the crop region if it has changed from a previously returned value, or is called by
2281    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2282    /// the use of the new region. See SetCropRegion for a description of the region parameter.
2283    pub fn r#watch_crop_region(
2284        &self,
2285        ___deadline: zx::MonotonicInstant,
2286    ) -> Result<Option<Box<fidl_fuchsia_math::RectF>>, fidl::Error> {
2287        let _response =
2288            self.client.send_query::<fidl::encoding::EmptyPayload, StreamWatchCropRegionResponse>(
2289                (),
2290                0x4c28250035dbbb90,
2291                fidl::encoding::DynamicFlags::empty(),
2292                ___deadline,
2293            )?;
2294        Ok(_response.region)
2295    }
2296
2297    /// Sets the resolution of the stream to the provided value. If the implementation does not
2298    /// precisely support the provided value, it will be expanded to the minimum resolution that
2299    /// exceeds the provided resolution.
2300    pub fn r#set_resolution(
2301        &self,
2302        mut coded_size: &fidl_fuchsia_math::Size,
2303    ) -> Result<(), fidl::Error> {
2304        self.client.send::<StreamSetResolutionRequest>(
2305            (coded_size,),
2306            0x6ef2c207ff2b74e3,
2307            fidl::encoding::DynamicFlags::empty(),
2308        )
2309    }
2310
2311    /// Returns the resolution if it has changed from a previously returned value, or is called by
2312    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2313    /// the new resolution.
2314    pub fn r#watch_resolution(
2315        &self,
2316        ___deadline: zx::MonotonicInstant,
2317    ) -> Result<fidl_fuchsia_math::Size, fidl::Error> {
2318        let _response =
2319            self.client.send_query::<fidl::encoding::EmptyPayload, StreamWatchResolutionResponse>(
2320                (),
2321                0x6c7b28be2b72ea7f,
2322                fidl::encoding::DynamicFlags::empty(),
2323                ___deadline,
2324            )?;
2325        Ok(_response.coded_size)
2326    }
2327
2328    /// If non-null, requests renegotiation of the buffer collection backing this stream, and
2329    /// identifies this client as a participant in buffer negotiation. If null, identifies this
2330    /// client as a non-participant in buffer negotiation. Upon initial connection, the client is a
2331    /// non-participant. After registering as a participant, clients must always have an outstanding
2332    /// call to WatchBufferCollection to receive tokens from the server so that they are able to
2333    /// respond to current and future renegotiation requests.
2334    pub fn r#set_buffer_collection2(
2335        &self,
2336        mut token: Option<
2337            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2338        >,
2339    ) -> Result<(), fidl::Error> {
2340        self.client.send::<StreamSetBufferCollection2Request>(
2341            (token,),
2342            0x6691d2eed219c8e6,
2343            fidl::encoding::DynamicFlags::empty(),
2344        )
2345    }
2346
2347    pub fn r#set_buffer_collection(
2348        &self,
2349        mut token: Option<
2350            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2351        >,
2352    ) -> Result<(), fidl::Error> {
2353        self.client.send::<StreamSetBufferCollectionRequest>(
2354            (token,),
2355            0x730ab5c4ee023c6d,
2356            fidl::encoding::DynamicFlags::empty(),
2357        )
2358    }
2359
2360    /// Returns when the server or any buffer negotiation participant (including the current client)
2361    /// requires buffer renegotiation, and the current client is registered as a participant. Frame
2362    /// callbacks received after receiving this callback apply to the newly negotiated collection.
2363    ///
2364    /// Because the camera can output directly to these collections, each client should support
2365    /// reading from a |fuchsia.sysmem.CoherencyDomain| of RAM, and set |ram_domain_supported| in
2366    /// their |fuchsia.sysmem.BufferMemoryConstraints|.
2367    pub fn r#watch_buffer_collection2(
2368        &self,
2369        ___deadline: zx::MonotonicInstant,
2370    ) -> Result<
2371        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2372        fidl::Error,
2373    > {
2374        let _response = self
2375            .client
2376            .send_query::<fidl::encoding::EmptyPayload, StreamWatchBufferCollection2Response>(
2377                (),
2378                0x60c9daa36b3d2cf1,
2379                fidl::encoding::DynamicFlags::empty(),
2380                ___deadline,
2381            )?;
2382        Ok(_response.token)
2383    }
2384
2385    pub fn r#watch_buffer_collection(
2386        &self,
2387        ___deadline: zx::MonotonicInstant,
2388    ) -> Result<
2389        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2390        fidl::Error,
2391    > {
2392        let _response = self
2393            .client
2394            .send_query::<fidl::encoding::EmptyPayload, StreamWatchBufferCollectionResponse>(
2395                (),
2396                0x35d855a45e19e5d6,
2397                fidl::encoding::DynamicFlags::empty(),
2398                ___deadline,
2399            )?;
2400        Ok(_response.token)
2401    }
2402
2403    /// Returns the orientation if it has changed from a previously returned value, or is called by
2404    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2405    /// the new orientation.
2406    pub fn r#watch_orientation(
2407        &self,
2408        ___deadline: zx::MonotonicInstant,
2409    ) -> Result<Orientation, fidl::Error> {
2410        let _response = self
2411            .client
2412            .send_query::<fidl::encoding::EmptyPayload, StreamWatchOrientationResponse>(
2413                (),
2414                0x1f0d1cd93daa1dd4,
2415                fidl::encoding::DynamicFlags::empty(),
2416                ___deadline,
2417            )?;
2418        Ok(_response.orientation)
2419    }
2420
2421    /// See GetNextFrame2.
2422    pub fn r#get_next_frame(
2423        &self,
2424        ___deadline: zx::MonotonicInstant,
2425    ) -> Result<FrameInfo, fidl::Error> {
2426        let _response =
2427            self.client.send_query::<fidl::encoding::EmptyPayload, StreamGetNextFrameResponse>(
2428                (),
2429                0x4b06b8dfbcbdc658,
2430                fidl::encoding::DynamicFlags::empty(),
2431                ___deadline,
2432            )?;
2433        Ok(_response.info)
2434    }
2435
2436    /// Request the next available frame for this stream that has not yet been acquired by the
2437    /// current client. Multiple participating clients may concurrently hold the same frame. Returns
2438    /// when the stream has completed populating the buffer and may be read by the client, provided
2439    /// the number of unreleased buffers is less than the count provided via the most recently
2440    /// negotiated buffer collection token. If a buffer renegotiation is in progress, this call will
2441    /// return only after the negotiation is complete and a new collection is available.
2442    pub fn r#get_next_frame2(
2443        &self,
2444        ___deadline: zx::MonotonicInstant,
2445    ) -> Result<FrameInfo2, fidl::Error> {
2446        let _response =
2447            self.client.send_query::<fidl::encoding::EmptyPayload, StreamGetNextFrame2Response>(
2448                (),
2449                0x7142a7a6aa6a6f10,
2450                fidl::encoding::DynamicFlags::empty(),
2451                ___deadline,
2452            )?;
2453        Ok(_response.info)
2454    }
2455
2456    /// Request another connection to this Stream. This allows a client to delegate different
2457    /// operations to different coordinated clients, or have multiple clients concurrently observe
2458    /// frames produced by the stream.
2459    pub fn r#rebind(
2460        &self,
2461        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
2462    ) -> Result<(), fidl::Error> {
2463        self.client.send::<StreamRebindRequest>(
2464            (request,),
2465            0x75b84fa09b68dbef,
2466            fidl::encoding::DynamicFlags::empty(),
2467        )
2468    }
2469}
2470
2471#[cfg(target_os = "fuchsia")]
2472impl From<Stream_SynchronousProxy> for zx::Handle {
2473    fn from(value: Stream_SynchronousProxy) -> Self {
2474        value.into_channel().into()
2475    }
2476}
2477
2478#[cfg(target_os = "fuchsia")]
2479impl From<fidl::Channel> for Stream_SynchronousProxy {
2480    fn from(value: fidl::Channel) -> Self {
2481        Self::new(value)
2482    }
2483}
2484
2485#[cfg(target_os = "fuchsia")]
2486impl fidl::endpoints::FromClient for Stream_SynchronousProxy {
2487    type Protocol = Stream_Marker;
2488
2489    fn from_client(value: fidl::endpoints::ClientEnd<Stream_Marker>) -> Self {
2490        Self::new(value.into_channel())
2491    }
2492}
2493
2494#[derive(Debug, Clone)]
2495pub struct Stream_Proxy {
2496    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2497}
2498
2499impl fidl::endpoints::Proxy for Stream_Proxy {
2500    type Protocol = Stream_Marker;
2501
2502    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2503        Self::new(inner)
2504    }
2505
2506    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2507        self.client.into_channel().map_err(|client| Self { client })
2508    }
2509
2510    fn as_channel(&self) -> &::fidl::AsyncChannel {
2511        self.client.as_channel()
2512    }
2513}
2514
2515impl Stream_Proxy {
2516    /// Create a new Proxy for fuchsia.camera3/Stream.
2517    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2518        let protocol_name = <Stream_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2519        Self { client: fidl::client::Client::new(channel, protocol_name) }
2520    }
2521
2522    /// Get a Stream of events from the remote end of the protocol.
2523    ///
2524    /// # Panics
2525    ///
2526    /// Panics if the event stream was already taken.
2527    pub fn take_event_stream(&self) -> Stream_EventStream {
2528        Stream_EventStream { event_receiver: self.client.take_event_receiver() }
2529    }
2530
2531    /// Gets the properties associated with this stream. The value returned is identical to the one
2532    /// corresponding to this stream as returned by |Device.GetConfigurations|.
2533    pub fn r#get_properties(
2534        &self,
2535    ) -> fidl::client::QueryResponseFut<
2536        StreamProperties,
2537        fidl::encoding::DefaultFuchsiaResourceDialect,
2538    > {
2539        Stream_ProxyInterface::r#get_properties(self)
2540    }
2541
2542    /// Gets the properties associated with this stream. The value returned is identical to the one
2543    /// corresponding to this stream as returned by |Device.GetConfigurations|.
2544    pub fn r#get_properties2(
2545        &self,
2546    ) -> fidl::client::QueryResponseFut<
2547        StreamProperties2,
2548        fidl::encoding::DefaultFuchsiaResourceDialect,
2549    > {
2550        Stream_ProxyInterface::r#get_properties2(self)
2551    }
2552
2553    /// Sets the Stream's crop region to the provided region, with the top-left of the image
2554    /// represented by (0,0) and the bottom-right of the image represented by (1,1). The resulting
2555    /// content is subsequently scaled to fill the output buffer. If the implementation does not
2556    /// precisely support the provided value, it will be expanded to the minimum region that covers
2557    /// the provided region. If region is set to null, the crop region is unset, which is equivalent
2558    /// to specifying a region covering the entire image. Upon initial connection, the region is
2559    /// unset. If the stream does not support crop region, the connection is closed with the
2560    /// ZX_ERR_NOT_SUPPORTED epitaph.
2561    pub fn r#set_crop_region(
2562        &self,
2563        mut region: Option<&fidl_fuchsia_math::RectF>,
2564    ) -> Result<(), fidl::Error> {
2565        Stream_ProxyInterface::r#set_crop_region(self, region)
2566    }
2567
2568    /// Returns the crop region if it has changed from a previously returned value, or is called by
2569    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2570    /// the use of the new region. See SetCropRegion for a description of the region parameter.
2571    pub fn r#watch_crop_region(
2572        &self,
2573    ) -> fidl::client::QueryResponseFut<
2574        Option<Box<fidl_fuchsia_math::RectF>>,
2575        fidl::encoding::DefaultFuchsiaResourceDialect,
2576    > {
2577        Stream_ProxyInterface::r#watch_crop_region(self)
2578    }
2579
2580    /// Sets the resolution of the stream to the provided value. If the implementation does not
2581    /// precisely support the provided value, it will be expanded to the minimum resolution that
2582    /// exceeds the provided resolution.
2583    pub fn r#set_resolution(
2584        &self,
2585        mut coded_size: &fidl_fuchsia_math::Size,
2586    ) -> Result<(), fidl::Error> {
2587        Stream_ProxyInterface::r#set_resolution(self, coded_size)
2588    }
2589
2590    /// Returns the resolution if it has changed from a previously returned value, or is called by
2591    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2592    /// the new resolution.
2593    pub fn r#watch_resolution(
2594        &self,
2595    ) -> fidl::client::QueryResponseFut<
2596        fidl_fuchsia_math::Size,
2597        fidl::encoding::DefaultFuchsiaResourceDialect,
2598    > {
2599        Stream_ProxyInterface::r#watch_resolution(self)
2600    }
2601
2602    /// If non-null, requests renegotiation of the buffer collection backing this stream, and
2603    /// identifies this client as a participant in buffer negotiation. If null, identifies this
2604    /// client as a non-participant in buffer negotiation. Upon initial connection, the client is a
2605    /// non-participant. After registering as a participant, clients must always have an outstanding
2606    /// call to WatchBufferCollection to receive tokens from the server so that they are able to
2607    /// respond to current and future renegotiation requests.
2608    pub fn r#set_buffer_collection2(
2609        &self,
2610        mut token: Option<
2611            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2612        >,
2613    ) -> Result<(), fidl::Error> {
2614        Stream_ProxyInterface::r#set_buffer_collection2(self, token)
2615    }
2616
2617    pub fn r#set_buffer_collection(
2618        &self,
2619        mut token: Option<
2620            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2621        >,
2622    ) -> Result<(), fidl::Error> {
2623        Stream_ProxyInterface::r#set_buffer_collection(self, token)
2624    }
2625
2626    /// Returns when the server or any buffer negotiation participant (including the current client)
2627    /// requires buffer renegotiation, and the current client is registered as a participant. Frame
2628    /// callbacks received after receiving this callback apply to the newly negotiated collection.
2629    ///
2630    /// Because the camera can output directly to these collections, each client should support
2631    /// reading from a |fuchsia.sysmem.CoherencyDomain| of RAM, and set |ram_domain_supported| in
2632    /// their |fuchsia.sysmem.BufferMemoryConstraints|.
2633    pub fn r#watch_buffer_collection2(
2634        &self,
2635    ) -> fidl::client::QueryResponseFut<
2636        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2637        fidl::encoding::DefaultFuchsiaResourceDialect,
2638    > {
2639        Stream_ProxyInterface::r#watch_buffer_collection2(self)
2640    }
2641
2642    pub fn r#watch_buffer_collection(
2643        &self,
2644    ) -> fidl::client::QueryResponseFut<
2645        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2646        fidl::encoding::DefaultFuchsiaResourceDialect,
2647    > {
2648        Stream_ProxyInterface::r#watch_buffer_collection(self)
2649    }
2650
2651    /// Returns the orientation if it has changed from a previously returned value, or is called by
2652    /// a client for the first time. Frame callbacks received after receiving this callback reflect
2653    /// the new orientation.
2654    pub fn r#watch_orientation(
2655        &self,
2656    ) -> fidl::client::QueryResponseFut<Orientation, fidl::encoding::DefaultFuchsiaResourceDialect>
2657    {
2658        Stream_ProxyInterface::r#watch_orientation(self)
2659    }
2660
2661    /// See GetNextFrame2.
2662    pub fn r#get_next_frame(
2663        &self,
2664    ) -> fidl::client::QueryResponseFut<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2665    {
2666        Stream_ProxyInterface::r#get_next_frame(self)
2667    }
2668
2669    /// Request the next available frame for this stream that has not yet been acquired by the
2670    /// current client. Multiple participating clients may concurrently hold the same frame. Returns
2671    /// when the stream has completed populating the buffer and may be read by the client, provided
2672    /// the number of unreleased buffers is less than the count provided via the most recently
2673    /// negotiated buffer collection token. If a buffer renegotiation is in progress, this call will
2674    /// return only after the negotiation is complete and a new collection is available.
2675    pub fn r#get_next_frame2(
2676        &self,
2677    ) -> fidl::client::QueryResponseFut<FrameInfo2, fidl::encoding::DefaultFuchsiaResourceDialect>
2678    {
2679        Stream_ProxyInterface::r#get_next_frame2(self)
2680    }
2681
2682    /// Request another connection to this Stream. This allows a client to delegate different
2683    /// operations to different coordinated clients, or have multiple clients concurrently observe
2684    /// frames produced by the stream.
2685    pub fn r#rebind(
2686        &self,
2687        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
2688    ) -> Result<(), fidl::Error> {
2689        Stream_ProxyInterface::r#rebind(self, request)
2690    }
2691}
2692
2693impl Stream_ProxyInterface for Stream_Proxy {
2694    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2695        StreamProperties,
2696        fidl::encoding::DefaultFuchsiaResourceDialect,
2697    >;
2698    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2699        fn _decode(
2700            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2701        ) -> Result<StreamProperties, fidl::Error> {
2702            let _response = fidl::client::decode_transaction_body::<
2703                StreamGetPropertiesResponse,
2704                fidl::encoding::DefaultFuchsiaResourceDialect,
2705                0x13662921504b55f7,
2706            >(_buf?)?;
2707            Ok(_response.properties)
2708        }
2709        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
2710            (),
2711            0x13662921504b55f7,
2712            fidl::encoding::DynamicFlags::empty(),
2713            _decode,
2714        )
2715    }
2716
2717    type GetProperties2ResponseFut = fidl::client::QueryResponseFut<
2718        StreamProperties2,
2719        fidl::encoding::DefaultFuchsiaResourceDialect,
2720    >;
2721    fn r#get_properties2(&self) -> Self::GetProperties2ResponseFut {
2722        fn _decode(
2723            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2724        ) -> Result<StreamProperties2, fidl::Error> {
2725            let _response = fidl::client::decode_transaction_body::<
2726                StreamGetProperties2Response,
2727                fidl::encoding::DefaultFuchsiaResourceDialect,
2728                0x70346d69a8cbc391,
2729            >(_buf?)?;
2730            Ok(_response.properties)
2731        }
2732        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties2>(
2733            (),
2734            0x70346d69a8cbc391,
2735            fidl::encoding::DynamicFlags::empty(),
2736            _decode,
2737        )
2738    }
2739
2740    fn r#set_crop_region(
2741        &self,
2742        mut region: Option<&fidl_fuchsia_math::RectF>,
2743    ) -> Result<(), fidl::Error> {
2744        self.client.send::<StreamSetCropRegionRequest>(
2745            (region,),
2746            0x72dde73bf7a94302,
2747            fidl::encoding::DynamicFlags::empty(),
2748        )
2749    }
2750
2751    type WatchCropRegionResponseFut = fidl::client::QueryResponseFut<
2752        Option<Box<fidl_fuchsia_math::RectF>>,
2753        fidl::encoding::DefaultFuchsiaResourceDialect,
2754    >;
2755    fn r#watch_crop_region(&self) -> Self::WatchCropRegionResponseFut {
2756        fn _decode(
2757            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2758        ) -> Result<Option<Box<fidl_fuchsia_math::RectF>>, fidl::Error> {
2759            let _response = fidl::client::decode_transaction_body::<
2760                StreamWatchCropRegionResponse,
2761                fidl::encoding::DefaultFuchsiaResourceDialect,
2762                0x4c28250035dbbb90,
2763            >(_buf?)?;
2764            Ok(_response.region)
2765        }
2766        self.client.send_query_and_decode::<
2767            fidl::encoding::EmptyPayload,
2768            Option<Box<fidl_fuchsia_math::RectF>>,
2769        >(
2770            (),
2771            0x4c28250035dbbb90,
2772            fidl::encoding::DynamicFlags::empty(),
2773            _decode,
2774        )
2775    }
2776
2777    fn r#set_resolution(
2778        &self,
2779        mut coded_size: &fidl_fuchsia_math::Size,
2780    ) -> Result<(), fidl::Error> {
2781        self.client.send::<StreamSetResolutionRequest>(
2782            (coded_size,),
2783            0x6ef2c207ff2b74e3,
2784            fidl::encoding::DynamicFlags::empty(),
2785        )
2786    }
2787
2788    type WatchResolutionResponseFut = fidl::client::QueryResponseFut<
2789        fidl_fuchsia_math::Size,
2790        fidl::encoding::DefaultFuchsiaResourceDialect,
2791    >;
2792    fn r#watch_resolution(&self) -> Self::WatchResolutionResponseFut {
2793        fn _decode(
2794            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2795        ) -> Result<fidl_fuchsia_math::Size, fidl::Error> {
2796            let _response = fidl::client::decode_transaction_body::<
2797                StreamWatchResolutionResponse,
2798                fidl::encoding::DefaultFuchsiaResourceDialect,
2799                0x6c7b28be2b72ea7f,
2800            >(_buf?)?;
2801            Ok(_response.coded_size)
2802        }
2803        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_math::Size>(
2804            (),
2805            0x6c7b28be2b72ea7f,
2806            fidl::encoding::DynamicFlags::empty(),
2807            _decode,
2808        )
2809    }
2810
2811    fn r#set_buffer_collection2(
2812        &self,
2813        mut token: Option<
2814            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2815        >,
2816    ) -> Result<(), fidl::Error> {
2817        self.client.send::<StreamSetBufferCollection2Request>(
2818            (token,),
2819            0x6691d2eed219c8e6,
2820            fidl::encoding::DynamicFlags::empty(),
2821        )
2822    }
2823
2824    fn r#set_buffer_collection(
2825        &self,
2826        mut token: Option<
2827            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2828        >,
2829    ) -> Result<(), fidl::Error> {
2830        self.client.send::<StreamSetBufferCollectionRequest>(
2831            (token,),
2832            0x730ab5c4ee023c6d,
2833            fidl::encoding::DynamicFlags::empty(),
2834        )
2835    }
2836
2837    type WatchBufferCollection2ResponseFut = fidl::client::QueryResponseFut<
2838        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2839        fidl::encoding::DefaultFuchsiaResourceDialect,
2840    >;
2841    fn r#watch_buffer_collection2(&self) -> Self::WatchBufferCollection2ResponseFut {
2842        fn _decode(
2843            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2844        ) -> Result<
2845            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2846            fidl::Error,
2847        > {
2848            let _response = fidl::client::decode_transaction_body::<
2849                StreamWatchBufferCollection2Response,
2850                fidl::encoding::DefaultFuchsiaResourceDialect,
2851                0x60c9daa36b3d2cf1,
2852            >(_buf?)?;
2853            Ok(_response.token)
2854        }
2855        self.client.send_query_and_decode::<
2856            fidl::encoding::EmptyPayload,
2857            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2858        >(
2859            (),
2860            0x60c9daa36b3d2cf1,
2861            fidl::encoding::DynamicFlags::empty(),
2862            _decode,
2863        )
2864    }
2865
2866    type WatchBufferCollectionResponseFut = fidl::client::QueryResponseFut<
2867        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2868        fidl::encoding::DefaultFuchsiaResourceDialect,
2869    >;
2870    fn r#watch_buffer_collection(&self) -> Self::WatchBufferCollectionResponseFut {
2871        fn _decode(
2872            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2873        ) -> Result<
2874            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2875            fidl::Error,
2876        > {
2877            let _response = fidl::client::decode_transaction_body::<
2878                StreamWatchBufferCollectionResponse,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880                0x35d855a45e19e5d6,
2881            >(_buf?)?;
2882            Ok(_response.token)
2883        }
2884        self.client.send_query_and_decode::<
2885            fidl::encoding::EmptyPayload,
2886            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2887        >(
2888            (),
2889            0x35d855a45e19e5d6,
2890            fidl::encoding::DynamicFlags::empty(),
2891            _decode,
2892        )
2893    }
2894
2895    type WatchOrientationResponseFut =
2896        fidl::client::QueryResponseFut<Orientation, fidl::encoding::DefaultFuchsiaResourceDialect>;
2897    fn r#watch_orientation(&self) -> Self::WatchOrientationResponseFut {
2898        fn _decode(
2899            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2900        ) -> Result<Orientation, fidl::Error> {
2901            let _response = fidl::client::decode_transaction_body::<
2902                StreamWatchOrientationResponse,
2903                fidl::encoding::DefaultFuchsiaResourceDialect,
2904                0x1f0d1cd93daa1dd4,
2905            >(_buf?)?;
2906            Ok(_response.orientation)
2907        }
2908        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Orientation>(
2909            (),
2910            0x1f0d1cd93daa1dd4,
2911            fidl::encoding::DynamicFlags::empty(),
2912            _decode,
2913        )
2914    }
2915
2916    type GetNextFrameResponseFut =
2917        fidl::client::QueryResponseFut<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
2918    fn r#get_next_frame(&self) -> Self::GetNextFrameResponseFut {
2919        fn _decode(
2920            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2921        ) -> Result<FrameInfo, fidl::Error> {
2922            let _response = fidl::client::decode_transaction_body::<
2923                StreamGetNextFrameResponse,
2924                fidl::encoding::DefaultFuchsiaResourceDialect,
2925                0x4b06b8dfbcbdc658,
2926            >(_buf?)?;
2927            Ok(_response.info)
2928        }
2929        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FrameInfo>(
2930            (),
2931            0x4b06b8dfbcbdc658,
2932            fidl::encoding::DynamicFlags::empty(),
2933            _decode,
2934        )
2935    }
2936
2937    type GetNextFrame2ResponseFut =
2938        fidl::client::QueryResponseFut<FrameInfo2, fidl::encoding::DefaultFuchsiaResourceDialect>;
2939    fn r#get_next_frame2(&self) -> Self::GetNextFrame2ResponseFut {
2940        fn _decode(
2941            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2942        ) -> Result<FrameInfo2, fidl::Error> {
2943            let _response = fidl::client::decode_transaction_body::<
2944                StreamGetNextFrame2Response,
2945                fidl::encoding::DefaultFuchsiaResourceDialect,
2946                0x7142a7a6aa6a6f10,
2947            >(_buf?)?;
2948            Ok(_response.info)
2949        }
2950        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FrameInfo2>(
2951            (),
2952            0x7142a7a6aa6a6f10,
2953            fidl::encoding::DynamicFlags::empty(),
2954            _decode,
2955        )
2956    }
2957
2958    fn r#rebind(
2959        &self,
2960        mut request: fidl::endpoints::ServerEnd<Stream_Marker>,
2961    ) -> Result<(), fidl::Error> {
2962        self.client.send::<StreamRebindRequest>(
2963            (request,),
2964            0x75b84fa09b68dbef,
2965            fidl::encoding::DynamicFlags::empty(),
2966        )
2967    }
2968}
2969
2970pub struct Stream_EventStream {
2971    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2972}
2973
2974impl std::marker::Unpin for Stream_EventStream {}
2975
2976impl futures::stream::FusedStream for Stream_EventStream {
2977    fn is_terminated(&self) -> bool {
2978        self.event_receiver.is_terminated()
2979    }
2980}
2981
2982impl futures::Stream for Stream_EventStream {
2983    type Item = Result<Stream_Event, fidl::Error>;
2984
2985    fn poll_next(
2986        mut self: std::pin::Pin<&mut Self>,
2987        cx: &mut std::task::Context<'_>,
2988    ) -> std::task::Poll<Option<Self::Item>> {
2989        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2990            &mut self.event_receiver,
2991            cx
2992        )?) {
2993            Some(buf) => std::task::Poll::Ready(Some(Stream_Event::decode(buf))),
2994            None => std::task::Poll::Ready(None),
2995        }
2996    }
2997}
2998
2999#[derive(Debug)]
3000pub enum Stream_Event {}
3001
3002impl Stream_Event {
3003    /// Decodes a message buffer as a [`Stream_Event`].
3004    fn decode(
3005        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3006    ) -> Result<Stream_Event, fidl::Error> {
3007        let (bytes, _handles) = buf.split_mut();
3008        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3009        debug_assert_eq!(tx_header.tx_id, 0);
3010        match tx_header.ordinal {
3011            _ => Err(fidl::Error::UnknownOrdinal {
3012                ordinal: tx_header.ordinal,
3013                protocol_name: <Stream_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3014            }),
3015        }
3016    }
3017}
3018
3019/// A Stream of incoming requests for fuchsia.camera3/Stream.
3020pub struct Stream_RequestStream {
3021    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3022    is_terminated: bool,
3023}
3024
3025impl std::marker::Unpin for Stream_RequestStream {}
3026
3027impl futures::stream::FusedStream for Stream_RequestStream {
3028    fn is_terminated(&self) -> bool {
3029        self.is_terminated
3030    }
3031}
3032
3033impl fidl::endpoints::RequestStream for Stream_RequestStream {
3034    type Protocol = Stream_Marker;
3035    type ControlHandle = Stream_ControlHandle;
3036
3037    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3038        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3039    }
3040
3041    fn control_handle(&self) -> Self::ControlHandle {
3042        Stream_ControlHandle { inner: self.inner.clone() }
3043    }
3044
3045    fn into_inner(
3046        self,
3047    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3048    {
3049        (self.inner, self.is_terminated)
3050    }
3051
3052    fn from_inner(
3053        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3054        is_terminated: bool,
3055    ) -> Self {
3056        Self { inner, is_terminated }
3057    }
3058}
3059
3060impl futures::Stream for Stream_RequestStream {
3061    type Item = Result<Stream_Request, fidl::Error>;
3062
3063    fn poll_next(
3064        mut self: std::pin::Pin<&mut Self>,
3065        cx: &mut std::task::Context<'_>,
3066    ) -> std::task::Poll<Option<Self::Item>> {
3067        let this = &mut *self;
3068        if this.inner.check_shutdown(cx) {
3069            this.is_terminated = true;
3070            return std::task::Poll::Ready(None);
3071        }
3072        if this.is_terminated {
3073            panic!("polled Stream_RequestStream after completion");
3074        }
3075        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3076            |bytes, handles| {
3077                match this.inner.channel().read_etc(cx, bytes, handles) {
3078                    std::task::Poll::Ready(Ok(())) => {}
3079                    std::task::Poll::Pending => return std::task::Poll::Pending,
3080                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3081                        this.is_terminated = true;
3082                        return std::task::Poll::Ready(None);
3083                    }
3084                    std::task::Poll::Ready(Err(e)) => {
3085                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3086                            e.into(),
3087                        ))));
3088                    }
3089                }
3090
3091                // A message has been received from the channel
3092                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3093
3094                std::task::Poll::Ready(Some(match header.ordinal {
3095                    0x13662921504b55f7 => {
3096                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3097                        let mut req = fidl::new_empty!(
3098                            fidl::encoding::EmptyPayload,
3099                            fidl::encoding::DefaultFuchsiaResourceDialect
3100                        );
3101                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3102                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3103                        Ok(Stream_Request::GetProperties {
3104                            responder: Stream_GetPropertiesResponder {
3105                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3106                                tx_id: header.tx_id,
3107                            },
3108                        })
3109                    }
3110                    0x70346d69a8cbc391 => {
3111                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3112                        let mut req = fidl::new_empty!(
3113                            fidl::encoding::EmptyPayload,
3114                            fidl::encoding::DefaultFuchsiaResourceDialect
3115                        );
3116                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3117                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3118                        Ok(Stream_Request::GetProperties2 {
3119                            responder: Stream_GetProperties2Responder {
3120                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3121                                tx_id: header.tx_id,
3122                            },
3123                        })
3124                    }
3125                    0x72dde73bf7a94302 => {
3126                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3127                        let mut req = fidl::new_empty!(
3128                            StreamSetCropRegionRequest,
3129                            fidl::encoding::DefaultFuchsiaResourceDialect
3130                        );
3131                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSetCropRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3132                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3133                        Ok(Stream_Request::SetCropRegion { region: req.region, control_handle })
3134                    }
3135                    0x4c28250035dbbb90 => {
3136                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3137                        let mut req = fidl::new_empty!(
3138                            fidl::encoding::EmptyPayload,
3139                            fidl::encoding::DefaultFuchsiaResourceDialect
3140                        );
3141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3142                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3143                        Ok(Stream_Request::WatchCropRegion {
3144                            responder: Stream_WatchCropRegionResponder {
3145                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3146                                tx_id: header.tx_id,
3147                            },
3148                        })
3149                    }
3150                    0x6ef2c207ff2b74e3 => {
3151                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3152                        let mut req = fidl::new_empty!(
3153                            StreamSetResolutionRequest,
3154                            fidl::encoding::DefaultFuchsiaResourceDialect
3155                        );
3156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSetResolutionRequest>(&header, _body_bytes, handles, &mut req)?;
3157                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3158                        Ok(Stream_Request::SetResolution {
3159                            coded_size: req.coded_size,
3160
3161                            control_handle,
3162                        })
3163                    }
3164                    0x6c7b28be2b72ea7f => {
3165                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3166                        let mut req = fidl::new_empty!(
3167                            fidl::encoding::EmptyPayload,
3168                            fidl::encoding::DefaultFuchsiaResourceDialect
3169                        );
3170                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3171                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3172                        Ok(Stream_Request::WatchResolution {
3173                            responder: Stream_WatchResolutionResponder {
3174                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3175                                tx_id: header.tx_id,
3176                            },
3177                        })
3178                    }
3179                    0x6691d2eed219c8e6 => {
3180                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3181                        let mut req = fidl::new_empty!(
3182                            StreamSetBufferCollection2Request,
3183                            fidl::encoding::DefaultFuchsiaResourceDialect
3184                        );
3185                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSetBufferCollection2Request>(&header, _body_bytes, handles, &mut req)?;
3186                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3187                        Ok(Stream_Request::SetBufferCollection2 {
3188                            token: req.token,
3189
3190                            control_handle,
3191                        })
3192                    }
3193                    0x730ab5c4ee023c6d => {
3194                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3195                        let mut req = fidl::new_empty!(
3196                            StreamSetBufferCollectionRequest,
3197                            fidl::encoding::DefaultFuchsiaResourceDialect
3198                        );
3199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSetBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
3200                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3201                        Ok(Stream_Request::SetBufferCollection { token: req.token, control_handle })
3202                    }
3203                    0x60c9daa36b3d2cf1 => {
3204                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3205                        let mut req = fidl::new_empty!(
3206                            fidl::encoding::EmptyPayload,
3207                            fidl::encoding::DefaultFuchsiaResourceDialect
3208                        );
3209                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3210                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3211                        Ok(Stream_Request::WatchBufferCollection2 {
3212                            responder: Stream_WatchBufferCollection2Responder {
3213                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3214                                tx_id: header.tx_id,
3215                            },
3216                        })
3217                    }
3218                    0x35d855a45e19e5d6 => {
3219                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3220                        let mut req = fidl::new_empty!(
3221                            fidl::encoding::EmptyPayload,
3222                            fidl::encoding::DefaultFuchsiaResourceDialect
3223                        );
3224                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3225                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3226                        Ok(Stream_Request::WatchBufferCollection {
3227                            responder: Stream_WatchBufferCollectionResponder {
3228                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3229                                tx_id: header.tx_id,
3230                            },
3231                        })
3232                    }
3233                    0x1f0d1cd93daa1dd4 => {
3234                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3235                        let mut req = fidl::new_empty!(
3236                            fidl::encoding::EmptyPayload,
3237                            fidl::encoding::DefaultFuchsiaResourceDialect
3238                        );
3239                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3240                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3241                        Ok(Stream_Request::WatchOrientation {
3242                            responder: Stream_WatchOrientationResponder {
3243                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3244                                tx_id: header.tx_id,
3245                            },
3246                        })
3247                    }
3248                    0x4b06b8dfbcbdc658 => {
3249                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3250                        let mut req = fidl::new_empty!(
3251                            fidl::encoding::EmptyPayload,
3252                            fidl::encoding::DefaultFuchsiaResourceDialect
3253                        );
3254                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3255                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3256                        Ok(Stream_Request::GetNextFrame {
3257                            responder: Stream_GetNextFrameResponder {
3258                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3259                                tx_id: header.tx_id,
3260                            },
3261                        })
3262                    }
3263                    0x7142a7a6aa6a6f10 => {
3264                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3265                        let mut req = fidl::new_empty!(
3266                            fidl::encoding::EmptyPayload,
3267                            fidl::encoding::DefaultFuchsiaResourceDialect
3268                        );
3269                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3270                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3271                        Ok(Stream_Request::GetNextFrame2 {
3272                            responder: Stream_GetNextFrame2Responder {
3273                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3274                                tx_id: header.tx_id,
3275                            },
3276                        })
3277                    }
3278                    0x75b84fa09b68dbef => {
3279                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3280                        let mut req = fidl::new_empty!(
3281                            StreamRebindRequest,
3282                            fidl::encoding::DefaultFuchsiaResourceDialect
3283                        );
3284                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamRebindRequest>(&header, _body_bytes, handles, &mut req)?;
3285                        let control_handle = Stream_ControlHandle { inner: this.inner.clone() };
3286                        Ok(Stream_Request::Rebind { request: req.request, control_handle })
3287                    }
3288                    _ => Err(fidl::Error::UnknownOrdinal {
3289                        ordinal: header.ordinal,
3290                        protocol_name:
3291                            <Stream_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3292                    }),
3293                }))
3294            },
3295        )
3296    }
3297}
3298
3299/// A Stream represents timing, sequencing, and other camera-specific properties applied to a buffer
3300/// collection.
3301#[derive(Debug)]
3302pub enum Stream_Request {
3303    /// Gets the properties associated with this stream. The value returned is identical to the one
3304    /// corresponding to this stream as returned by |Device.GetConfigurations|.
3305    GetProperties {
3306        responder: Stream_GetPropertiesResponder,
3307    },
3308    /// Gets the properties associated with this stream. The value returned is identical to the one
3309    /// corresponding to this stream as returned by |Device.GetConfigurations|.
3310    GetProperties2 {
3311        responder: Stream_GetProperties2Responder,
3312    },
3313    /// Sets the Stream's crop region to the provided region, with the top-left of the image
3314    /// represented by (0,0) and the bottom-right of the image represented by (1,1). The resulting
3315    /// content is subsequently scaled to fill the output buffer. If the implementation does not
3316    /// precisely support the provided value, it will be expanded to the minimum region that covers
3317    /// the provided region. If region is set to null, the crop region is unset, which is equivalent
3318    /// to specifying a region covering the entire image. Upon initial connection, the region is
3319    /// unset. If the stream does not support crop region, the connection is closed with the
3320    /// ZX_ERR_NOT_SUPPORTED epitaph.
3321    SetCropRegion {
3322        region: Option<Box<fidl_fuchsia_math::RectF>>,
3323        control_handle: Stream_ControlHandle,
3324    },
3325    /// Returns the crop region if it has changed from a previously returned value, or is called by
3326    /// a client for the first time. Frame callbacks received after receiving this callback reflect
3327    /// the use of the new region. See SetCropRegion for a description of the region parameter.
3328    WatchCropRegion {
3329        responder: Stream_WatchCropRegionResponder,
3330    },
3331    /// Sets the resolution of the stream to the provided value. If the implementation does not
3332    /// precisely support the provided value, it will be expanded to the minimum resolution that
3333    /// exceeds the provided resolution.
3334    SetResolution {
3335        coded_size: fidl_fuchsia_math::Size,
3336        control_handle: Stream_ControlHandle,
3337    },
3338    /// Returns the resolution if it has changed from a previously returned value, or is called by
3339    /// a client for the first time. Frame callbacks received after receiving this callback reflect
3340    /// the new resolution.
3341    WatchResolution {
3342        responder: Stream_WatchResolutionResponder,
3343    },
3344    /// If non-null, requests renegotiation of the buffer collection backing this stream, and
3345    /// identifies this client as a participant in buffer negotiation. If null, identifies this
3346    /// client as a non-participant in buffer negotiation. Upon initial connection, the client is a
3347    /// non-participant. After registering as a participant, clients must always have an outstanding
3348    /// call to WatchBufferCollection to receive tokens from the server so that they are able to
3349    /// respond to current and future renegotiation requests.
3350    SetBufferCollection2 {
3351        token:
3352            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
3353        control_handle: Stream_ControlHandle,
3354    },
3355    SetBufferCollection {
3356        token: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
3357        control_handle: Stream_ControlHandle,
3358    },
3359    /// Returns when the server or any buffer negotiation participant (including the current client)
3360    /// requires buffer renegotiation, and the current client is registered as a participant. Frame
3361    /// callbacks received after receiving this callback apply to the newly negotiated collection.
3362    ///
3363    /// Because the camera can output directly to these collections, each client should support
3364    /// reading from a |fuchsia.sysmem.CoherencyDomain| of RAM, and set |ram_domain_supported| in
3365    /// their |fuchsia.sysmem.BufferMemoryConstraints|.
3366    WatchBufferCollection2 {
3367        responder: Stream_WatchBufferCollection2Responder,
3368    },
3369    WatchBufferCollection {
3370        responder: Stream_WatchBufferCollectionResponder,
3371    },
3372    /// Returns the orientation if it has changed from a previously returned value, or is called by
3373    /// a client for the first time. Frame callbacks received after receiving this callback reflect
3374    /// the new orientation.
3375    WatchOrientation {
3376        responder: Stream_WatchOrientationResponder,
3377    },
3378    /// See GetNextFrame2.
3379    GetNextFrame {
3380        responder: Stream_GetNextFrameResponder,
3381    },
3382    /// Request the next available frame for this stream that has not yet been acquired by the
3383    /// current client. Multiple participating clients may concurrently hold the same frame. Returns
3384    /// when the stream has completed populating the buffer and may be read by the client, provided
3385    /// the number of unreleased buffers is less than the count provided via the most recently
3386    /// negotiated buffer collection token. If a buffer renegotiation is in progress, this call will
3387    /// return only after the negotiation is complete and a new collection is available.
3388    GetNextFrame2 {
3389        responder: Stream_GetNextFrame2Responder,
3390    },
3391    /// Request another connection to this Stream. This allows a client to delegate different
3392    /// operations to different coordinated clients, or have multiple clients concurrently observe
3393    /// frames produced by the stream.
3394    Rebind {
3395        request: fidl::endpoints::ServerEnd<Stream_Marker>,
3396        control_handle: Stream_ControlHandle,
3397    },
3398}
3399
3400impl Stream_Request {
3401    #[allow(irrefutable_let_patterns)]
3402    pub fn into_get_properties(self) -> Option<(Stream_GetPropertiesResponder)> {
3403        if let Stream_Request::GetProperties { responder } = self {
3404            Some((responder))
3405        } else {
3406            None
3407        }
3408    }
3409
3410    #[allow(irrefutable_let_patterns)]
3411    pub fn into_get_properties2(self) -> Option<(Stream_GetProperties2Responder)> {
3412        if let Stream_Request::GetProperties2 { responder } = self {
3413            Some((responder))
3414        } else {
3415            None
3416        }
3417    }
3418
3419    #[allow(irrefutable_let_patterns)]
3420    pub fn into_set_crop_region(
3421        self,
3422    ) -> Option<(Option<Box<fidl_fuchsia_math::RectF>>, Stream_ControlHandle)> {
3423        if let Stream_Request::SetCropRegion { region, control_handle } = self {
3424            Some((region, control_handle))
3425        } else {
3426            None
3427        }
3428    }
3429
3430    #[allow(irrefutable_let_patterns)]
3431    pub fn into_watch_crop_region(self) -> Option<(Stream_WatchCropRegionResponder)> {
3432        if let Stream_Request::WatchCropRegion { responder } = self {
3433            Some((responder))
3434        } else {
3435            None
3436        }
3437    }
3438
3439    #[allow(irrefutable_let_patterns)]
3440    pub fn into_set_resolution(self) -> Option<(fidl_fuchsia_math::Size, Stream_ControlHandle)> {
3441        if let Stream_Request::SetResolution { coded_size, control_handle } = self {
3442            Some((coded_size, control_handle))
3443        } else {
3444            None
3445        }
3446    }
3447
3448    #[allow(irrefutable_let_patterns)]
3449    pub fn into_watch_resolution(self) -> Option<(Stream_WatchResolutionResponder)> {
3450        if let Stream_Request::WatchResolution { responder } = self {
3451            Some((responder))
3452        } else {
3453            None
3454        }
3455    }
3456
3457    #[allow(irrefutable_let_patterns)]
3458    pub fn into_set_buffer_collection2(
3459        self,
3460    ) -> Option<(
3461        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
3462        Stream_ControlHandle,
3463    )> {
3464        if let Stream_Request::SetBufferCollection2 { token, control_handle } = self {
3465            Some((token, control_handle))
3466        } else {
3467            None
3468        }
3469    }
3470
3471    #[allow(irrefutable_let_patterns)]
3472    pub fn into_set_buffer_collection(
3473        self,
3474    ) -> Option<(
3475        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
3476        Stream_ControlHandle,
3477    )> {
3478        if let Stream_Request::SetBufferCollection { token, control_handle } = self {
3479            Some((token, control_handle))
3480        } else {
3481            None
3482        }
3483    }
3484
3485    #[allow(irrefutable_let_patterns)]
3486    pub fn into_watch_buffer_collection2(self) -> Option<(Stream_WatchBufferCollection2Responder)> {
3487        if let Stream_Request::WatchBufferCollection2 { responder } = self {
3488            Some((responder))
3489        } else {
3490            None
3491        }
3492    }
3493
3494    #[allow(irrefutable_let_patterns)]
3495    pub fn into_watch_buffer_collection(self) -> Option<(Stream_WatchBufferCollectionResponder)> {
3496        if let Stream_Request::WatchBufferCollection { responder } = self {
3497            Some((responder))
3498        } else {
3499            None
3500        }
3501    }
3502
3503    #[allow(irrefutable_let_patterns)]
3504    pub fn into_watch_orientation(self) -> Option<(Stream_WatchOrientationResponder)> {
3505        if let Stream_Request::WatchOrientation { responder } = self {
3506            Some((responder))
3507        } else {
3508            None
3509        }
3510    }
3511
3512    #[allow(irrefutable_let_patterns)]
3513    pub fn into_get_next_frame(self) -> Option<(Stream_GetNextFrameResponder)> {
3514        if let Stream_Request::GetNextFrame { responder } = self { Some((responder)) } else { None }
3515    }
3516
3517    #[allow(irrefutable_let_patterns)]
3518    pub fn into_get_next_frame2(self) -> Option<(Stream_GetNextFrame2Responder)> {
3519        if let Stream_Request::GetNextFrame2 { responder } = self {
3520            Some((responder))
3521        } else {
3522            None
3523        }
3524    }
3525
3526    #[allow(irrefutable_let_patterns)]
3527    pub fn into_rebind(
3528        self,
3529    ) -> Option<(fidl::endpoints::ServerEnd<Stream_Marker>, Stream_ControlHandle)> {
3530        if let Stream_Request::Rebind { request, control_handle } = self {
3531            Some((request, control_handle))
3532        } else {
3533            None
3534        }
3535    }
3536
3537    /// Name of the method defined in FIDL
3538    pub fn method_name(&self) -> &'static str {
3539        match *self {
3540            Stream_Request::GetProperties { .. } => "get_properties",
3541            Stream_Request::GetProperties2 { .. } => "get_properties2",
3542            Stream_Request::SetCropRegion { .. } => "set_crop_region",
3543            Stream_Request::WatchCropRegion { .. } => "watch_crop_region",
3544            Stream_Request::SetResolution { .. } => "set_resolution",
3545            Stream_Request::WatchResolution { .. } => "watch_resolution",
3546            Stream_Request::SetBufferCollection2 { .. } => "set_buffer_collection2",
3547            Stream_Request::SetBufferCollection { .. } => "set_buffer_collection",
3548            Stream_Request::WatchBufferCollection2 { .. } => "watch_buffer_collection2",
3549            Stream_Request::WatchBufferCollection { .. } => "watch_buffer_collection",
3550            Stream_Request::WatchOrientation { .. } => "watch_orientation",
3551            Stream_Request::GetNextFrame { .. } => "get_next_frame",
3552            Stream_Request::GetNextFrame2 { .. } => "get_next_frame2",
3553            Stream_Request::Rebind { .. } => "rebind",
3554        }
3555    }
3556}
3557
3558#[derive(Debug, Clone)]
3559pub struct Stream_ControlHandle {
3560    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3561}
3562
3563impl fidl::endpoints::ControlHandle for Stream_ControlHandle {
3564    fn shutdown(&self) {
3565        self.inner.shutdown()
3566    }
3567    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3568        self.inner.shutdown_with_epitaph(status)
3569    }
3570
3571    fn is_closed(&self) -> bool {
3572        self.inner.channel().is_closed()
3573    }
3574    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3575        self.inner.channel().on_closed()
3576    }
3577
3578    #[cfg(target_os = "fuchsia")]
3579    fn signal_peer(
3580        &self,
3581        clear_mask: zx::Signals,
3582        set_mask: zx::Signals,
3583    ) -> Result<(), zx_status::Status> {
3584        use fidl::Peered;
3585        self.inner.channel().signal_peer(clear_mask, set_mask)
3586    }
3587}
3588
3589impl Stream_ControlHandle {}
3590
3591#[must_use = "FIDL methods require a response to be sent"]
3592#[derive(Debug)]
3593pub struct Stream_GetPropertiesResponder {
3594    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3595    tx_id: u32,
3596}
3597
3598/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3599/// if the responder is dropped without sending a response, so that the client
3600/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3601impl std::ops::Drop for Stream_GetPropertiesResponder {
3602    fn drop(&mut self) {
3603        self.control_handle.shutdown();
3604        // Safety: drops once, never accessed again
3605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3606    }
3607}
3608
3609impl fidl::endpoints::Responder for Stream_GetPropertiesResponder {
3610    type ControlHandle = Stream_ControlHandle;
3611
3612    fn control_handle(&self) -> &Stream_ControlHandle {
3613        &self.control_handle
3614    }
3615
3616    fn drop_without_shutdown(mut self) {
3617        // Safety: drops once, never accessed again due to mem::forget
3618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3619        // Prevent Drop from running (which would shut down the channel)
3620        std::mem::forget(self);
3621    }
3622}
3623
3624impl Stream_GetPropertiesResponder {
3625    /// Sends a response to the FIDL transaction.
3626    ///
3627    /// Sets the channel to shutdown if an error occurs.
3628    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
3629        let _result = self.send_raw(properties);
3630        if _result.is_err() {
3631            self.control_handle.shutdown();
3632        }
3633        self.drop_without_shutdown();
3634        _result
3635    }
3636
3637    /// Similar to "send" but does not shutdown the channel if an error occurs.
3638    pub fn send_no_shutdown_on_err(
3639        self,
3640        mut properties: &StreamProperties,
3641    ) -> Result<(), fidl::Error> {
3642        let _result = self.send_raw(properties);
3643        self.drop_without_shutdown();
3644        _result
3645    }
3646
3647    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
3648        self.control_handle.inner.send::<StreamGetPropertiesResponse>(
3649            (properties,),
3650            self.tx_id,
3651            0x13662921504b55f7,
3652            fidl::encoding::DynamicFlags::empty(),
3653        )
3654    }
3655}
3656
3657#[must_use = "FIDL methods require a response to be sent"]
3658#[derive(Debug)]
3659pub struct Stream_GetProperties2Responder {
3660    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3661    tx_id: u32,
3662}
3663
3664/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3665/// if the responder is dropped without sending a response, so that the client
3666/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3667impl std::ops::Drop for Stream_GetProperties2Responder {
3668    fn drop(&mut self) {
3669        self.control_handle.shutdown();
3670        // Safety: drops once, never accessed again
3671        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3672    }
3673}
3674
3675impl fidl::endpoints::Responder for Stream_GetProperties2Responder {
3676    type ControlHandle = Stream_ControlHandle;
3677
3678    fn control_handle(&self) -> &Stream_ControlHandle {
3679        &self.control_handle
3680    }
3681
3682    fn drop_without_shutdown(mut self) {
3683        // Safety: drops once, never accessed again due to mem::forget
3684        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3685        // Prevent Drop from running (which would shut down the channel)
3686        std::mem::forget(self);
3687    }
3688}
3689
3690impl Stream_GetProperties2Responder {
3691    /// Sends a response to the FIDL transaction.
3692    ///
3693    /// Sets the channel to shutdown if an error occurs.
3694    pub fn send(self, mut properties: &StreamProperties2) -> Result<(), fidl::Error> {
3695        let _result = self.send_raw(properties);
3696        if _result.is_err() {
3697            self.control_handle.shutdown();
3698        }
3699        self.drop_without_shutdown();
3700        _result
3701    }
3702
3703    /// Similar to "send" but does not shutdown the channel if an error occurs.
3704    pub fn send_no_shutdown_on_err(
3705        self,
3706        mut properties: &StreamProperties2,
3707    ) -> Result<(), fidl::Error> {
3708        let _result = self.send_raw(properties);
3709        self.drop_without_shutdown();
3710        _result
3711    }
3712
3713    fn send_raw(&self, mut properties: &StreamProperties2) -> Result<(), fidl::Error> {
3714        self.control_handle.inner.send::<StreamGetProperties2Response>(
3715            (properties,),
3716            self.tx_id,
3717            0x70346d69a8cbc391,
3718            fidl::encoding::DynamicFlags::empty(),
3719        )
3720    }
3721}
3722
3723#[must_use = "FIDL methods require a response to be sent"]
3724#[derive(Debug)]
3725pub struct Stream_WatchCropRegionResponder {
3726    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3727    tx_id: u32,
3728}
3729
3730/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3731/// if the responder is dropped without sending a response, so that the client
3732/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3733impl std::ops::Drop for Stream_WatchCropRegionResponder {
3734    fn drop(&mut self) {
3735        self.control_handle.shutdown();
3736        // Safety: drops once, never accessed again
3737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3738    }
3739}
3740
3741impl fidl::endpoints::Responder for Stream_WatchCropRegionResponder {
3742    type ControlHandle = Stream_ControlHandle;
3743
3744    fn control_handle(&self) -> &Stream_ControlHandle {
3745        &self.control_handle
3746    }
3747
3748    fn drop_without_shutdown(mut self) {
3749        // Safety: drops once, never accessed again due to mem::forget
3750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3751        // Prevent Drop from running (which would shut down the channel)
3752        std::mem::forget(self);
3753    }
3754}
3755
3756impl Stream_WatchCropRegionResponder {
3757    /// Sends a response to the FIDL transaction.
3758    ///
3759    /// Sets the channel to shutdown if an error occurs.
3760    pub fn send(self, mut region: Option<&fidl_fuchsia_math::RectF>) -> Result<(), fidl::Error> {
3761        let _result = self.send_raw(region);
3762        if _result.is_err() {
3763            self.control_handle.shutdown();
3764        }
3765        self.drop_without_shutdown();
3766        _result
3767    }
3768
3769    /// Similar to "send" but does not shutdown the channel if an error occurs.
3770    pub fn send_no_shutdown_on_err(
3771        self,
3772        mut region: Option<&fidl_fuchsia_math::RectF>,
3773    ) -> Result<(), fidl::Error> {
3774        let _result = self.send_raw(region);
3775        self.drop_without_shutdown();
3776        _result
3777    }
3778
3779    fn send_raw(&self, mut region: Option<&fidl_fuchsia_math::RectF>) -> Result<(), fidl::Error> {
3780        self.control_handle.inner.send::<StreamWatchCropRegionResponse>(
3781            (region,),
3782            self.tx_id,
3783            0x4c28250035dbbb90,
3784            fidl::encoding::DynamicFlags::empty(),
3785        )
3786    }
3787}
3788
3789#[must_use = "FIDL methods require a response to be sent"]
3790#[derive(Debug)]
3791pub struct Stream_WatchResolutionResponder {
3792    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3793    tx_id: u32,
3794}
3795
3796/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3797/// if the responder is dropped without sending a response, so that the client
3798/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3799impl std::ops::Drop for Stream_WatchResolutionResponder {
3800    fn drop(&mut self) {
3801        self.control_handle.shutdown();
3802        // Safety: drops once, never accessed again
3803        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3804    }
3805}
3806
3807impl fidl::endpoints::Responder for Stream_WatchResolutionResponder {
3808    type ControlHandle = Stream_ControlHandle;
3809
3810    fn control_handle(&self) -> &Stream_ControlHandle {
3811        &self.control_handle
3812    }
3813
3814    fn drop_without_shutdown(mut self) {
3815        // Safety: drops once, never accessed again due to mem::forget
3816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3817        // Prevent Drop from running (which would shut down the channel)
3818        std::mem::forget(self);
3819    }
3820}
3821
3822impl Stream_WatchResolutionResponder {
3823    /// Sends a response to the FIDL transaction.
3824    ///
3825    /// Sets the channel to shutdown if an error occurs.
3826    pub fn send(self, mut coded_size: &fidl_fuchsia_math::Size) -> Result<(), fidl::Error> {
3827        let _result = self.send_raw(coded_size);
3828        if _result.is_err() {
3829            self.control_handle.shutdown();
3830        }
3831        self.drop_without_shutdown();
3832        _result
3833    }
3834
3835    /// Similar to "send" but does not shutdown the channel if an error occurs.
3836    pub fn send_no_shutdown_on_err(
3837        self,
3838        mut coded_size: &fidl_fuchsia_math::Size,
3839    ) -> Result<(), fidl::Error> {
3840        let _result = self.send_raw(coded_size);
3841        self.drop_without_shutdown();
3842        _result
3843    }
3844
3845    fn send_raw(&self, mut coded_size: &fidl_fuchsia_math::Size) -> Result<(), fidl::Error> {
3846        self.control_handle.inner.send::<StreamWatchResolutionResponse>(
3847            (coded_size,),
3848            self.tx_id,
3849            0x6c7b28be2b72ea7f,
3850            fidl::encoding::DynamicFlags::empty(),
3851        )
3852    }
3853}
3854
3855#[must_use = "FIDL methods require a response to be sent"]
3856#[derive(Debug)]
3857pub struct Stream_WatchBufferCollection2Responder {
3858    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3859    tx_id: u32,
3860}
3861
3862/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3863/// if the responder is dropped without sending a response, so that the client
3864/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3865impl std::ops::Drop for Stream_WatchBufferCollection2Responder {
3866    fn drop(&mut self) {
3867        self.control_handle.shutdown();
3868        // Safety: drops once, never accessed again
3869        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3870    }
3871}
3872
3873impl fidl::endpoints::Responder for Stream_WatchBufferCollection2Responder {
3874    type ControlHandle = Stream_ControlHandle;
3875
3876    fn control_handle(&self) -> &Stream_ControlHandle {
3877        &self.control_handle
3878    }
3879
3880    fn drop_without_shutdown(mut self) {
3881        // Safety: drops once, never accessed again due to mem::forget
3882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3883        // Prevent Drop from running (which would shut down the channel)
3884        std::mem::forget(self);
3885    }
3886}
3887
3888impl Stream_WatchBufferCollection2Responder {
3889    /// Sends a response to the FIDL transaction.
3890    ///
3891    /// Sets the channel to shutdown if an error occurs.
3892    pub fn send(
3893        self,
3894        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
3895    ) -> Result<(), fidl::Error> {
3896        let _result = self.send_raw(token);
3897        if _result.is_err() {
3898            self.control_handle.shutdown();
3899        }
3900        self.drop_without_shutdown();
3901        _result
3902    }
3903
3904    /// Similar to "send" but does not shutdown the channel if an error occurs.
3905    pub fn send_no_shutdown_on_err(
3906        self,
3907        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
3908    ) -> Result<(), fidl::Error> {
3909        let _result = self.send_raw(token);
3910        self.drop_without_shutdown();
3911        _result
3912    }
3913
3914    fn send_raw(
3915        &self,
3916        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
3917    ) -> Result<(), fidl::Error> {
3918        self.control_handle.inner.send::<StreamWatchBufferCollection2Response>(
3919            (token,),
3920            self.tx_id,
3921            0x60c9daa36b3d2cf1,
3922            fidl::encoding::DynamicFlags::empty(),
3923        )
3924    }
3925}
3926
3927#[must_use = "FIDL methods require a response to be sent"]
3928#[derive(Debug)]
3929pub struct Stream_WatchBufferCollectionResponder {
3930    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
3931    tx_id: u32,
3932}
3933
3934/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
3935/// if the responder is dropped without sending a response, so that the client
3936/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3937impl std::ops::Drop for Stream_WatchBufferCollectionResponder {
3938    fn drop(&mut self) {
3939        self.control_handle.shutdown();
3940        // Safety: drops once, never accessed again
3941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3942    }
3943}
3944
3945impl fidl::endpoints::Responder for Stream_WatchBufferCollectionResponder {
3946    type ControlHandle = Stream_ControlHandle;
3947
3948    fn control_handle(&self) -> &Stream_ControlHandle {
3949        &self.control_handle
3950    }
3951
3952    fn drop_without_shutdown(mut self) {
3953        // Safety: drops once, never accessed again due to mem::forget
3954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3955        // Prevent Drop from running (which would shut down the channel)
3956        std::mem::forget(self);
3957    }
3958}
3959
3960impl Stream_WatchBufferCollectionResponder {
3961    /// Sends a response to the FIDL transaction.
3962    ///
3963    /// Sets the channel to shutdown if an error occurs.
3964    pub fn send(
3965        self,
3966        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
3967    ) -> Result<(), fidl::Error> {
3968        let _result = self.send_raw(token);
3969        if _result.is_err() {
3970            self.control_handle.shutdown();
3971        }
3972        self.drop_without_shutdown();
3973        _result
3974    }
3975
3976    /// Similar to "send" but does not shutdown the channel if an error occurs.
3977    pub fn send_no_shutdown_on_err(
3978        self,
3979        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
3980    ) -> Result<(), fidl::Error> {
3981        let _result = self.send_raw(token);
3982        self.drop_without_shutdown();
3983        _result
3984    }
3985
3986    fn send_raw(
3987        &self,
3988        mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
3989    ) -> Result<(), fidl::Error> {
3990        self.control_handle.inner.send::<StreamWatchBufferCollectionResponse>(
3991            (token,),
3992            self.tx_id,
3993            0x35d855a45e19e5d6,
3994            fidl::encoding::DynamicFlags::empty(),
3995        )
3996    }
3997}
3998
3999#[must_use = "FIDL methods require a response to be sent"]
4000#[derive(Debug)]
4001pub struct Stream_WatchOrientationResponder {
4002    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
4003    tx_id: u32,
4004}
4005
4006/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
4007/// if the responder is dropped without sending a response, so that the client
4008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4009impl std::ops::Drop for Stream_WatchOrientationResponder {
4010    fn drop(&mut self) {
4011        self.control_handle.shutdown();
4012        // Safety: drops once, never accessed again
4013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4014    }
4015}
4016
4017impl fidl::endpoints::Responder for Stream_WatchOrientationResponder {
4018    type ControlHandle = Stream_ControlHandle;
4019
4020    fn control_handle(&self) -> &Stream_ControlHandle {
4021        &self.control_handle
4022    }
4023
4024    fn drop_without_shutdown(mut self) {
4025        // Safety: drops once, never accessed again due to mem::forget
4026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4027        // Prevent Drop from running (which would shut down the channel)
4028        std::mem::forget(self);
4029    }
4030}
4031
4032impl Stream_WatchOrientationResponder {
4033    /// Sends a response to the FIDL transaction.
4034    ///
4035    /// Sets the channel to shutdown if an error occurs.
4036    pub fn send(self, mut orientation: Orientation) -> Result<(), fidl::Error> {
4037        let _result = self.send_raw(orientation);
4038        if _result.is_err() {
4039            self.control_handle.shutdown();
4040        }
4041        self.drop_without_shutdown();
4042        _result
4043    }
4044
4045    /// Similar to "send" but does not shutdown the channel if an error occurs.
4046    pub fn send_no_shutdown_on_err(self, mut orientation: Orientation) -> Result<(), fidl::Error> {
4047        let _result = self.send_raw(orientation);
4048        self.drop_without_shutdown();
4049        _result
4050    }
4051
4052    fn send_raw(&self, mut orientation: Orientation) -> Result<(), fidl::Error> {
4053        self.control_handle.inner.send::<StreamWatchOrientationResponse>(
4054            (orientation,),
4055            self.tx_id,
4056            0x1f0d1cd93daa1dd4,
4057            fidl::encoding::DynamicFlags::empty(),
4058        )
4059    }
4060}
4061
4062#[must_use = "FIDL methods require a response to be sent"]
4063#[derive(Debug)]
4064pub struct Stream_GetNextFrameResponder {
4065    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
4066    tx_id: u32,
4067}
4068
4069/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
4070/// if the responder is dropped without sending a response, so that the client
4071/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4072impl std::ops::Drop for Stream_GetNextFrameResponder {
4073    fn drop(&mut self) {
4074        self.control_handle.shutdown();
4075        // Safety: drops once, never accessed again
4076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4077    }
4078}
4079
4080impl fidl::endpoints::Responder for Stream_GetNextFrameResponder {
4081    type ControlHandle = Stream_ControlHandle;
4082
4083    fn control_handle(&self) -> &Stream_ControlHandle {
4084        &self.control_handle
4085    }
4086
4087    fn drop_without_shutdown(mut self) {
4088        // Safety: drops once, never accessed again due to mem::forget
4089        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4090        // Prevent Drop from running (which would shut down the channel)
4091        std::mem::forget(self);
4092    }
4093}
4094
4095impl Stream_GetNextFrameResponder {
4096    /// Sends a response to the FIDL transaction.
4097    ///
4098    /// Sets the channel to shutdown if an error occurs.
4099    pub fn send(self, mut info: FrameInfo) -> Result<(), fidl::Error> {
4100        let _result = self.send_raw(info);
4101        if _result.is_err() {
4102            self.control_handle.shutdown();
4103        }
4104        self.drop_without_shutdown();
4105        _result
4106    }
4107
4108    /// Similar to "send" but does not shutdown the channel if an error occurs.
4109    pub fn send_no_shutdown_on_err(self, mut info: FrameInfo) -> Result<(), fidl::Error> {
4110        let _result = self.send_raw(info);
4111        self.drop_without_shutdown();
4112        _result
4113    }
4114
4115    fn send_raw(&self, mut info: FrameInfo) -> Result<(), fidl::Error> {
4116        self.control_handle.inner.send::<StreamGetNextFrameResponse>(
4117            (&mut info,),
4118            self.tx_id,
4119            0x4b06b8dfbcbdc658,
4120            fidl::encoding::DynamicFlags::empty(),
4121        )
4122    }
4123}
4124
4125#[must_use = "FIDL methods require a response to be sent"]
4126#[derive(Debug)]
4127pub struct Stream_GetNextFrame2Responder {
4128    control_handle: std::mem::ManuallyDrop<Stream_ControlHandle>,
4129    tx_id: u32,
4130}
4131
4132/// Set the the channel to be shutdown (see [`Stream_ControlHandle::shutdown`])
4133/// if the responder is dropped without sending a response, so that the client
4134/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4135impl std::ops::Drop for Stream_GetNextFrame2Responder {
4136    fn drop(&mut self) {
4137        self.control_handle.shutdown();
4138        // Safety: drops once, never accessed again
4139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4140    }
4141}
4142
4143impl fidl::endpoints::Responder for Stream_GetNextFrame2Responder {
4144    type ControlHandle = Stream_ControlHandle;
4145
4146    fn control_handle(&self) -> &Stream_ControlHandle {
4147        &self.control_handle
4148    }
4149
4150    fn drop_without_shutdown(mut self) {
4151        // Safety: drops once, never accessed again due to mem::forget
4152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4153        // Prevent Drop from running (which would shut down the channel)
4154        std::mem::forget(self);
4155    }
4156}
4157
4158impl Stream_GetNextFrame2Responder {
4159    /// Sends a response to the FIDL transaction.
4160    ///
4161    /// Sets the channel to shutdown if an error occurs.
4162    pub fn send(self, mut info: FrameInfo2) -> Result<(), fidl::Error> {
4163        let _result = self.send_raw(info);
4164        if _result.is_err() {
4165            self.control_handle.shutdown();
4166        }
4167        self.drop_without_shutdown();
4168        _result
4169    }
4170
4171    /// Similar to "send" but does not shutdown the channel if an error occurs.
4172    pub fn send_no_shutdown_on_err(self, mut info: FrameInfo2) -> Result<(), fidl::Error> {
4173        let _result = self.send_raw(info);
4174        self.drop_without_shutdown();
4175        _result
4176    }
4177
4178    fn send_raw(&self, mut info: FrameInfo2) -> Result<(), fidl::Error> {
4179        self.control_handle.inner.send::<StreamGetNextFrame2Response>(
4180            (&mut info,),
4181            self.tx_id,
4182            0x7142a7a6aa6a6f10,
4183            fidl::encoding::DynamicFlags::empty(),
4184        )
4185    }
4186}
4187
4188mod internal {
4189    use super::*;
4190
4191    impl fidl::encoding::ResourceTypeMarker for DeviceConnectToStreamRequest {
4192        type Borrowed<'a> = &'a mut Self;
4193        fn take_or_borrow<'a>(
4194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4195        ) -> Self::Borrowed<'a> {
4196            value
4197        }
4198    }
4199
4200    unsafe impl fidl::encoding::TypeMarker for DeviceConnectToStreamRequest {
4201        type Owned = Self;
4202
4203        #[inline(always)]
4204        fn inline_align(_context: fidl::encoding::Context) -> usize {
4205            4
4206        }
4207
4208        #[inline(always)]
4209        fn inline_size(_context: fidl::encoding::Context) -> usize {
4210            8
4211        }
4212    }
4213
4214    unsafe impl
4215        fidl::encoding::Encode<
4216            DeviceConnectToStreamRequest,
4217            fidl::encoding::DefaultFuchsiaResourceDialect,
4218        > for &mut DeviceConnectToStreamRequest
4219    {
4220        #[inline]
4221        unsafe fn encode(
4222            self,
4223            encoder: &mut fidl::encoding::Encoder<
4224                '_,
4225                fidl::encoding::DefaultFuchsiaResourceDialect,
4226            >,
4227            offset: usize,
4228            _depth: fidl::encoding::Depth,
4229        ) -> fidl::Result<()> {
4230            encoder.debug_check_bounds::<DeviceConnectToStreamRequest>(offset);
4231            // Delegate to tuple encoding.
4232            fidl::encoding::Encode::<DeviceConnectToStreamRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4233                (
4234                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
4235                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
4236                ),
4237                encoder, offset, _depth
4238            )
4239        }
4240    }
4241    unsafe impl<
4242        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4243        T1: fidl::encoding::Encode<
4244                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
4245                fidl::encoding::DefaultFuchsiaResourceDialect,
4246            >,
4247    >
4248        fidl::encoding::Encode<
4249            DeviceConnectToStreamRequest,
4250            fidl::encoding::DefaultFuchsiaResourceDialect,
4251        > for (T0, T1)
4252    {
4253        #[inline]
4254        unsafe fn encode(
4255            self,
4256            encoder: &mut fidl::encoding::Encoder<
4257                '_,
4258                fidl::encoding::DefaultFuchsiaResourceDialect,
4259            >,
4260            offset: usize,
4261            depth: fidl::encoding::Depth,
4262        ) -> fidl::Result<()> {
4263            encoder.debug_check_bounds::<DeviceConnectToStreamRequest>(offset);
4264            // Zero out padding regions. There's no need to apply masks
4265            // because the unmasked parts will be overwritten by fields.
4266            // Write the fields.
4267            self.0.encode(encoder, offset + 0, depth)?;
4268            self.1.encode(encoder, offset + 4, depth)?;
4269            Ok(())
4270        }
4271    }
4272
4273    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4274        for DeviceConnectToStreamRequest
4275    {
4276        #[inline(always)]
4277        fn new_empty() -> Self {
4278            Self {
4279                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4280                request: fidl::new_empty!(
4281                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
4282                    fidl::encoding::DefaultFuchsiaResourceDialect
4283                ),
4284            }
4285        }
4286
4287        #[inline]
4288        unsafe fn decode(
4289            &mut self,
4290            decoder: &mut fidl::encoding::Decoder<
4291                '_,
4292                fidl::encoding::DefaultFuchsiaResourceDialect,
4293            >,
4294            offset: usize,
4295            _depth: fidl::encoding::Depth,
4296        ) -> fidl::Result<()> {
4297            decoder.debug_check_bounds::<Self>(offset);
4298            // Verify that padding bytes are zero.
4299            fidl::decode!(
4300                u32,
4301                fidl::encoding::DefaultFuchsiaResourceDialect,
4302                &mut self.index,
4303                decoder,
4304                offset + 0,
4305                _depth
4306            )?;
4307            fidl::decode!(
4308                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
4309                fidl::encoding::DefaultFuchsiaResourceDialect,
4310                &mut self.request,
4311                decoder,
4312                offset + 4,
4313                _depth
4314            )?;
4315            Ok(())
4316        }
4317    }
4318
4319    impl fidl::encoding::ResourceTypeMarker for DeviceRebindRequest {
4320        type Borrowed<'a> = &'a mut Self;
4321        fn take_or_borrow<'a>(
4322            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4323        ) -> Self::Borrowed<'a> {
4324            value
4325        }
4326    }
4327
4328    unsafe impl fidl::encoding::TypeMarker for DeviceRebindRequest {
4329        type Owned = Self;
4330
4331        #[inline(always)]
4332        fn inline_align(_context: fidl::encoding::Context) -> usize {
4333            4
4334        }
4335
4336        #[inline(always)]
4337        fn inline_size(_context: fidl::encoding::Context) -> usize {
4338            4
4339        }
4340    }
4341
4342    unsafe impl
4343        fidl::encoding::Encode<DeviceRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4344        for &mut DeviceRebindRequest
4345    {
4346        #[inline]
4347        unsafe fn encode(
4348            self,
4349            encoder: &mut fidl::encoding::Encoder<
4350                '_,
4351                fidl::encoding::DefaultFuchsiaResourceDialect,
4352            >,
4353            offset: usize,
4354            _depth: fidl::encoding::Depth,
4355        ) -> fidl::Result<()> {
4356            encoder.debug_check_bounds::<DeviceRebindRequest>(offset);
4357            // Delegate to tuple encoding.
4358            fidl::encoding::Encode::<DeviceRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4359                (
4360                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
4361                ),
4362                encoder, offset, _depth
4363            )
4364        }
4365    }
4366    unsafe impl<
4367        T0: fidl::encoding::Encode<
4368                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4369                fidl::encoding::DefaultFuchsiaResourceDialect,
4370            >,
4371    > fidl::encoding::Encode<DeviceRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4372        for (T0,)
4373    {
4374        #[inline]
4375        unsafe fn encode(
4376            self,
4377            encoder: &mut fidl::encoding::Encoder<
4378                '_,
4379                fidl::encoding::DefaultFuchsiaResourceDialect,
4380            >,
4381            offset: usize,
4382            depth: fidl::encoding::Depth,
4383        ) -> fidl::Result<()> {
4384            encoder.debug_check_bounds::<DeviceRebindRequest>(offset);
4385            // Zero out padding regions. There's no need to apply masks
4386            // because the unmasked parts will be overwritten by fields.
4387            // Write the fields.
4388            self.0.encode(encoder, offset + 0, depth)?;
4389            Ok(())
4390        }
4391    }
4392
4393    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4394        for DeviceRebindRequest
4395    {
4396        #[inline(always)]
4397        fn new_empty() -> Self {
4398            Self {
4399                request: fidl::new_empty!(
4400                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4401                    fidl::encoding::DefaultFuchsiaResourceDialect
4402                ),
4403            }
4404        }
4405
4406        #[inline]
4407        unsafe fn decode(
4408            &mut self,
4409            decoder: &mut fidl::encoding::Decoder<
4410                '_,
4411                fidl::encoding::DefaultFuchsiaResourceDialect,
4412            >,
4413            offset: usize,
4414            _depth: fidl::encoding::Depth,
4415        ) -> fidl::Result<()> {
4416            decoder.debug_check_bounds::<Self>(offset);
4417            // Verify that padding bytes are zero.
4418            fidl::decode!(
4419                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4420                fidl::encoding::DefaultFuchsiaResourceDialect,
4421                &mut self.request,
4422                decoder,
4423                offset + 0,
4424                _depth
4425            )?;
4426            Ok(())
4427        }
4428    }
4429
4430    impl fidl::encoding::ResourceTypeMarker for DeviceWatcherConnectToDeviceRequest {
4431        type Borrowed<'a> = &'a mut Self;
4432        fn take_or_borrow<'a>(
4433            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4434        ) -> Self::Borrowed<'a> {
4435            value
4436        }
4437    }
4438
4439    unsafe impl fidl::encoding::TypeMarker for DeviceWatcherConnectToDeviceRequest {
4440        type Owned = Self;
4441
4442        #[inline(always)]
4443        fn inline_align(_context: fidl::encoding::Context) -> usize {
4444            8
4445        }
4446
4447        #[inline(always)]
4448        fn inline_size(_context: fidl::encoding::Context) -> usize {
4449            16
4450        }
4451    }
4452
4453    unsafe impl
4454        fidl::encoding::Encode<
4455            DeviceWatcherConnectToDeviceRequest,
4456            fidl::encoding::DefaultFuchsiaResourceDialect,
4457        > for &mut DeviceWatcherConnectToDeviceRequest
4458    {
4459        #[inline]
4460        unsafe fn encode(
4461            self,
4462            encoder: &mut fidl::encoding::Encoder<
4463                '_,
4464                fidl::encoding::DefaultFuchsiaResourceDialect,
4465            >,
4466            offset: usize,
4467            _depth: fidl::encoding::Depth,
4468        ) -> fidl::Result<()> {
4469            encoder.debug_check_bounds::<DeviceWatcherConnectToDeviceRequest>(offset);
4470            // Delegate to tuple encoding.
4471            fidl::encoding::Encode::<DeviceWatcherConnectToDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4472                (
4473                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4474                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
4475                ),
4476                encoder, offset, _depth
4477            )
4478        }
4479    }
4480    unsafe impl<
4481        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4482        T1: fidl::encoding::Encode<
4483                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4484                fidl::encoding::DefaultFuchsiaResourceDialect,
4485            >,
4486    >
4487        fidl::encoding::Encode<
4488            DeviceWatcherConnectToDeviceRequest,
4489            fidl::encoding::DefaultFuchsiaResourceDialect,
4490        > for (T0, T1)
4491    {
4492        #[inline]
4493        unsafe fn encode(
4494            self,
4495            encoder: &mut fidl::encoding::Encoder<
4496                '_,
4497                fidl::encoding::DefaultFuchsiaResourceDialect,
4498            >,
4499            offset: usize,
4500            depth: fidl::encoding::Depth,
4501        ) -> fidl::Result<()> {
4502            encoder.debug_check_bounds::<DeviceWatcherConnectToDeviceRequest>(offset);
4503            // Zero out padding regions. There's no need to apply masks
4504            // because the unmasked parts will be overwritten by fields.
4505            unsafe {
4506                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4507                (ptr as *mut u64).write_unaligned(0);
4508            }
4509            // Write the fields.
4510            self.0.encode(encoder, offset + 0, depth)?;
4511            self.1.encode(encoder, offset + 8, depth)?;
4512            Ok(())
4513        }
4514    }
4515
4516    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4517        for DeviceWatcherConnectToDeviceRequest
4518    {
4519        #[inline(always)]
4520        fn new_empty() -> Self {
4521            Self {
4522                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4523                request: fidl::new_empty!(
4524                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4525                    fidl::encoding::DefaultFuchsiaResourceDialect
4526                ),
4527            }
4528        }
4529
4530        #[inline]
4531        unsafe fn decode(
4532            &mut self,
4533            decoder: &mut fidl::encoding::Decoder<
4534                '_,
4535                fidl::encoding::DefaultFuchsiaResourceDialect,
4536            >,
4537            offset: usize,
4538            _depth: fidl::encoding::Depth,
4539        ) -> fidl::Result<()> {
4540            decoder.debug_check_bounds::<Self>(offset);
4541            // Verify that padding bytes are zero.
4542            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4543            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4544            let mask = 0xffffffff00000000u64;
4545            let maskedval = padval & mask;
4546            if maskedval != 0 {
4547                return Err(fidl::Error::NonZeroPadding {
4548                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4549                });
4550            }
4551            fidl::decode!(
4552                u64,
4553                fidl::encoding::DefaultFuchsiaResourceDialect,
4554                &mut self.id,
4555                decoder,
4556                offset + 0,
4557                _depth
4558            )?;
4559            fidl::decode!(
4560                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
4561                fidl::encoding::DefaultFuchsiaResourceDialect,
4562                &mut self.request,
4563                decoder,
4564                offset + 8,
4565                _depth
4566            )?;
4567            Ok(())
4568        }
4569    }
4570
4571    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
4572        type Borrowed<'a> = &'a mut Self;
4573        fn take_or_borrow<'a>(
4574            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4575        ) -> Self::Borrowed<'a> {
4576            value
4577        }
4578    }
4579
4580    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
4581        type Owned = Self;
4582
4583        #[inline(always)]
4584        fn inline_align(_context: fidl::encoding::Context) -> usize {
4585            8
4586        }
4587
4588        #[inline(always)]
4589        fn inline_size(_context: fidl::encoding::Context) -> usize {
4590            32
4591        }
4592    }
4593
4594    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
4595        for &mut FrameInfo
4596    {
4597        #[inline]
4598        unsafe fn encode(
4599            self,
4600            encoder: &mut fidl::encoding::Encoder<
4601                '_,
4602                fidl::encoding::DefaultFuchsiaResourceDialect,
4603            >,
4604            offset: usize,
4605            _depth: fidl::encoding::Depth,
4606        ) -> fidl::Result<()> {
4607            encoder.debug_check_bounds::<FrameInfo>(offset);
4608            // Delegate to tuple encoding.
4609            fidl::encoding::Encode::<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4610                (
4611                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_index),
4612                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_counter),
4613                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timestamp),
4614                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.release_fence),
4615                ),
4616                encoder, offset, _depth
4617            )
4618        }
4619    }
4620    unsafe impl<
4621        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4622        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4623        T2: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4624        T3: fidl::encoding::Encode<
4625                fidl::encoding::HandleType<
4626                    fidl::EventPair,
4627                    { fidl::ObjectType::EVENTPAIR.into_raw() },
4628                    2147483648,
4629                >,
4630                fidl::encoding::DefaultFuchsiaResourceDialect,
4631            >,
4632    > fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
4633        for (T0, T1, T2, T3)
4634    {
4635        #[inline]
4636        unsafe fn encode(
4637            self,
4638            encoder: &mut fidl::encoding::Encoder<
4639                '_,
4640                fidl::encoding::DefaultFuchsiaResourceDialect,
4641            >,
4642            offset: usize,
4643            depth: fidl::encoding::Depth,
4644        ) -> fidl::Result<()> {
4645            encoder.debug_check_bounds::<FrameInfo>(offset);
4646            // Zero out padding regions. There's no need to apply masks
4647            // because the unmasked parts will be overwritten by fields.
4648            unsafe {
4649                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4650                (ptr as *mut u64).write_unaligned(0);
4651            }
4652            unsafe {
4653                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
4654                (ptr as *mut u64).write_unaligned(0);
4655            }
4656            // Write the fields.
4657            self.0.encode(encoder, offset + 0, depth)?;
4658            self.1.encode(encoder, offset + 8, depth)?;
4659            self.2.encode(encoder, offset + 16, depth)?;
4660            self.3.encode(encoder, offset + 24, depth)?;
4661            Ok(())
4662        }
4663    }
4664
4665    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
4666        #[inline(always)]
4667        fn new_empty() -> Self {
4668            Self {
4669                buffer_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4670                frame_counter: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4671                timestamp: fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect),
4672                release_fence: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4673            }
4674        }
4675
4676        #[inline]
4677        unsafe fn decode(
4678            &mut self,
4679            decoder: &mut fidl::encoding::Decoder<
4680                '_,
4681                fidl::encoding::DefaultFuchsiaResourceDialect,
4682            >,
4683            offset: usize,
4684            _depth: fidl::encoding::Depth,
4685        ) -> fidl::Result<()> {
4686            decoder.debug_check_bounds::<Self>(offset);
4687            // Verify that padding bytes are zero.
4688            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4689            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4690            let mask = 0xffffffff00000000u64;
4691            let maskedval = padval & mask;
4692            if maskedval != 0 {
4693                return Err(fidl::Error::NonZeroPadding {
4694                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4695                });
4696            }
4697            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
4698            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4699            let mask = 0xffffffff00000000u64;
4700            let maskedval = padval & mask;
4701            if maskedval != 0 {
4702                return Err(fidl::Error::NonZeroPadding {
4703                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
4704                });
4705            }
4706            fidl::decode!(
4707                u32,
4708                fidl::encoding::DefaultFuchsiaResourceDialect,
4709                &mut self.buffer_index,
4710                decoder,
4711                offset + 0,
4712                _depth
4713            )?;
4714            fidl::decode!(
4715                u64,
4716                fidl::encoding::DefaultFuchsiaResourceDialect,
4717                &mut self.frame_counter,
4718                decoder,
4719                offset + 8,
4720                _depth
4721            )?;
4722            fidl::decode!(
4723                i64,
4724                fidl::encoding::DefaultFuchsiaResourceDialect,
4725                &mut self.timestamp,
4726                decoder,
4727                offset + 16,
4728                _depth
4729            )?;
4730            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.release_fence, decoder, offset + 24, _depth)?;
4731            Ok(())
4732        }
4733    }
4734
4735    impl fidl::encoding::ResourceTypeMarker for StreamGetNextFrame2Response {
4736        type Borrowed<'a> = &'a mut Self;
4737        fn take_or_borrow<'a>(
4738            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4739        ) -> Self::Borrowed<'a> {
4740            value
4741        }
4742    }
4743
4744    unsafe impl fidl::encoding::TypeMarker for StreamGetNextFrame2Response {
4745        type Owned = Self;
4746
4747        #[inline(always)]
4748        fn inline_align(_context: fidl::encoding::Context) -> usize {
4749            8
4750        }
4751
4752        #[inline(always)]
4753        fn inline_size(_context: fidl::encoding::Context) -> usize {
4754            16
4755        }
4756    }
4757
4758    unsafe impl
4759        fidl::encoding::Encode<
4760            StreamGetNextFrame2Response,
4761            fidl::encoding::DefaultFuchsiaResourceDialect,
4762        > for &mut StreamGetNextFrame2Response
4763    {
4764        #[inline]
4765        unsafe fn encode(
4766            self,
4767            encoder: &mut fidl::encoding::Encoder<
4768                '_,
4769                fidl::encoding::DefaultFuchsiaResourceDialect,
4770            >,
4771            offset: usize,
4772            _depth: fidl::encoding::Depth,
4773        ) -> fidl::Result<()> {
4774            encoder.debug_check_bounds::<StreamGetNextFrame2Response>(offset);
4775            // Delegate to tuple encoding.
4776            fidl::encoding::Encode::<
4777                StreamGetNextFrame2Response,
4778                fidl::encoding::DefaultFuchsiaResourceDialect,
4779            >::encode(
4780                (<FrameInfo2 as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4781                    &mut self.info,
4782                ),),
4783                encoder,
4784                offset,
4785                _depth,
4786            )
4787        }
4788    }
4789    unsafe impl<
4790        T0: fidl::encoding::Encode<FrameInfo2, fidl::encoding::DefaultFuchsiaResourceDialect>,
4791    >
4792        fidl::encoding::Encode<
4793            StreamGetNextFrame2Response,
4794            fidl::encoding::DefaultFuchsiaResourceDialect,
4795        > for (T0,)
4796    {
4797        #[inline]
4798        unsafe fn encode(
4799            self,
4800            encoder: &mut fidl::encoding::Encoder<
4801                '_,
4802                fidl::encoding::DefaultFuchsiaResourceDialect,
4803            >,
4804            offset: usize,
4805            depth: fidl::encoding::Depth,
4806        ) -> fidl::Result<()> {
4807            encoder.debug_check_bounds::<StreamGetNextFrame2Response>(offset);
4808            // Zero out padding regions. There's no need to apply masks
4809            // because the unmasked parts will be overwritten by fields.
4810            // Write the fields.
4811            self.0.encode(encoder, offset + 0, depth)?;
4812            Ok(())
4813        }
4814    }
4815
4816    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4817        for StreamGetNextFrame2Response
4818    {
4819        #[inline(always)]
4820        fn new_empty() -> Self {
4821            Self {
4822                info: fidl::new_empty!(FrameInfo2, fidl::encoding::DefaultFuchsiaResourceDialect),
4823            }
4824        }
4825
4826        #[inline]
4827        unsafe fn decode(
4828            &mut self,
4829            decoder: &mut fidl::encoding::Decoder<
4830                '_,
4831                fidl::encoding::DefaultFuchsiaResourceDialect,
4832            >,
4833            offset: usize,
4834            _depth: fidl::encoding::Depth,
4835        ) -> fidl::Result<()> {
4836            decoder.debug_check_bounds::<Self>(offset);
4837            // Verify that padding bytes are zero.
4838            fidl::decode!(
4839                FrameInfo2,
4840                fidl::encoding::DefaultFuchsiaResourceDialect,
4841                &mut self.info,
4842                decoder,
4843                offset + 0,
4844                _depth
4845            )?;
4846            Ok(())
4847        }
4848    }
4849
4850    impl fidl::encoding::ResourceTypeMarker for StreamGetNextFrameResponse {
4851        type Borrowed<'a> = &'a mut Self;
4852        fn take_or_borrow<'a>(
4853            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4854        ) -> Self::Borrowed<'a> {
4855            value
4856        }
4857    }
4858
4859    unsafe impl fidl::encoding::TypeMarker for StreamGetNextFrameResponse {
4860        type Owned = Self;
4861
4862        #[inline(always)]
4863        fn inline_align(_context: fidl::encoding::Context) -> usize {
4864            8
4865        }
4866
4867        #[inline(always)]
4868        fn inline_size(_context: fidl::encoding::Context) -> usize {
4869            32
4870        }
4871    }
4872
4873    unsafe impl
4874        fidl::encoding::Encode<
4875            StreamGetNextFrameResponse,
4876            fidl::encoding::DefaultFuchsiaResourceDialect,
4877        > for &mut StreamGetNextFrameResponse
4878    {
4879        #[inline]
4880        unsafe fn encode(
4881            self,
4882            encoder: &mut fidl::encoding::Encoder<
4883                '_,
4884                fidl::encoding::DefaultFuchsiaResourceDialect,
4885            >,
4886            offset: usize,
4887            _depth: fidl::encoding::Depth,
4888        ) -> fidl::Result<()> {
4889            encoder.debug_check_bounds::<StreamGetNextFrameResponse>(offset);
4890            // Delegate to tuple encoding.
4891            fidl::encoding::Encode::<
4892                StreamGetNextFrameResponse,
4893                fidl::encoding::DefaultFuchsiaResourceDialect,
4894            >::encode(
4895                (<FrameInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),),
4896                encoder,
4897                offset,
4898                _depth,
4899            )
4900        }
4901    }
4902    unsafe impl<
4903        T0: fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
4904    >
4905        fidl::encoding::Encode<
4906            StreamGetNextFrameResponse,
4907            fidl::encoding::DefaultFuchsiaResourceDialect,
4908        > for (T0,)
4909    {
4910        #[inline]
4911        unsafe fn encode(
4912            self,
4913            encoder: &mut fidl::encoding::Encoder<
4914                '_,
4915                fidl::encoding::DefaultFuchsiaResourceDialect,
4916            >,
4917            offset: usize,
4918            depth: fidl::encoding::Depth,
4919        ) -> fidl::Result<()> {
4920            encoder.debug_check_bounds::<StreamGetNextFrameResponse>(offset);
4921            // Zero out padding regions. There's no need to apply masks
4922            // because the unmasked parts will be overwritten by fields.
4923            // Write the fields.
4924            self.0.encode(encoder, offset + 0, depth)?;
4925            Ok(())
4926        }
4927    }
4928
4929    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4930        for StreamGetNextFrameResponse
4931    {
4932        #[inline(always)]
4933        fn new_empty() -> Self {
4934            Self {
4935                info: fidl::new_empty!(FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
4936            }
4937        }
4938
4939        #[inline]
4940        unsafe fn decode(
4941            &mut self,
4942            decoder: &mut fidl::encoding::Decoder<
4943                '_,
4944                fidl::encoding::DefaultFuchsiaResourceDialect,
4945            >,
4946            offset: usize,
4947            _depth: fidl::encoding::Depth,
4948        ) -> fidl::Result<()> {
4949            decoder.debug_check_bounds::<Self>(offset);
4950            // Verify that padding bytes are zero.
4951            fidl::decode!(
4952                FrameInfo,
4953                fidl::encoding::DefaultFuchsiaResourceDialect,
4954                &mut self.info,
4955                decoder,
4956                offset + 0,
4957                _depth
4958            )?;
4959            Ok(())
4960        }
4961    }
4962
4963    impl fidl::encoding::ResourceTypeMarker for StreamRebindRequest {
4964        type Borrowed<'a> = &'a mut Self;
4965        fn take_or_borrow<'a>(
4966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4967        ) -> Self::Borrowed<'a> {
4968            value
4969        }
4970    }
4971
4972    unsafe impl fidl::encoding::TypeMarker for StreamRebindRequest {
4973        type Owned = Self;
4974
4975        #[inline(always)]
4976        fn inline_align(_context: fidl::encoding::Context) -> usize {
4977            4
4978        }
4979
4980        #[inline(always)]
4981        fn inline_size(_context: fidl::encoding::Context) -> usize {
4982            4
4983        }
4984    }
4985
4986    unsafe impl
4987        fidl::encoding::Encode<StreamRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4988        for &mut StreamRebindRequest
4989    {
4990        #[inline]
4991        unsafe fn encode(
4992            self,
4993            encoder: &mut fidl::encoding::Encoder<
4994                '_,
4995                fidl::encoding::DefaultFuchsiaResourceDialect,
4996            >,
4997            offset: usize,
4998            _depth: fidl::encoding::Depth,
4999        ) -> fidl::Result<()> {
5000            encoder.debug_check_bounds::<StreamRebindRequest>(offset);
5001            // Delegate to tuple encoding.
5002            fidl::encoding::Encode::<StreamRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5003                (
5004                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
5005                ),
5006                encoder, offset, _depth
5007            )
5008        }
5009    }
5010    unsafe impl<
5011        T0: fidl::encoding::Encode<
5012                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
5013                fidl::encoding::DefaultFuchsiaResourceDialect,
5014            >,
5015    > fidl::encoding::Encode<StreamRebindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5016        for (T0,)
5017    {
5018        #[inline]
5019        unsafe fn encode(
5020            self,
5021            encoder: &mut fidl::encoding::Encoder<
5022                '_,
5023                fidl::encoding::DefaultFuchsiaResourceDialect,
5024            >,
5025            offset: usize,
5026            depth: fidl::encoding::Depth,
5027        ) -> fidl::Result<()> {
5028            encoder.debug_check_bounds::<StreamRebindRequest>(offset);
5029            // Zero out padding regions. There's no need to apply masks
5030            // because the unmasked parts will be overwritten by fields.
5031            // Write the fields.
5032            self.0.encode(encoder, offset + 0, depth)?;
5033            Ok(())
5034        }
5035    }
5036
5037    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5038        for StreamRebindRequest
5039    {
5040        #[inline(always)]
5041        fn new_empty() -> Self {
5042            Self {
5043                request: fidl::new_empty!(
5044                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
5045                    fidl::encoding::DefaultFuchsiaResourceDialect
5046                ),
5047            }
5048        }
5049
5050        #[inline]
5051        unsafe fn decode(
5052            &mut self,
5053            decoder: &mut fidl::encoding::Decoder<
5054                '_,
5055                fidl::encoding::DefaultFuchsiaResourceDialect,
5056            >,
5057            offset: usize,
5058            _depth: fidl::encoding::Depth,
5059        ) -> fidl::Result<()> {
5060            decoder.debug_check_bounds::<Self>(offset);
5061            // Verify that padding bytes are zero.
5062            fidl::decode!(
5063                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Stream_Marker>>,
5064                fidl::encoding::DefaultFuchsiaResourceDialect,
5065                &mut self.request,
5066                decoder,
5067                offset + 0,
5068                _depth
5069            )?;
5070            Ok(())
5071        }
5072    }
5073
5074    impl fidl::encoding::ResourceTypeMarker for StreamSetBufferCollection2Request {
5075        type Borrowed<'a> = &'a mut Self;
5076        fn take_or_borrow<'a>(
5077            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5078        ) -> Self::Borrowed<'a> {
5079            value
5080        }
5081    }
5082
5083    unsafe impl fidl::encoding::TypeMarker for StreamSetBufferCollection2Request {
5084        type Owned = Self;
5085
5086        #[inline(always)]
5087        fn inline_align(_context: fidl::encoding::Context) -> usize {
5088            4
5089        }
5090
5091        #[inline(always)]
5092        fn inline_size(_context: fidl::encoding::Context) -> usize {
5093            4
5094        }
5095    }
5096
5097    unsafe impl
5098        fidl::encoding::Encode<
5099            StreamSetBufferCollection2Request,
5100            fidl::encoding::DefaultFuchsiaResourceDialect,
5101        > for &mut StreamSetBufferCollection2Request
5102    {
5103        #[inline]
5104        unsafe fn encode(
5105            self,
5106            encoder: &mut fidl::encoding::Encoder<
5107                '_,
5108                fidl::encoding::DefaultFuchsiaResourceDialect,
5109            >,
5110            offset: usize,
5111            _depth: fidl::encoding::Depth,
5112        ) -> fidl::Result<()> {
5113            encoder.debug_check_bounds::<StreamSetBufferCollection2Request>(offset);
5114            // Delegate to tuple encoding.
5115            fidl::encoding::Encode::<
5116                StreamSetBufferCollection2Request,
5117                fidl::encoding::DefaultFuchsiaResourceDialect,
5118            >::encode(
5119                (<fidl::encoding::Optional<
5120                    fidl::encoding::Endpoint<
5121                        fidl::endpoints::ClientEnd<
5122                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5123                        >,
5124                    >,
5125                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5126                    &mut self.token
5127                ),),
5128                encoder,
5129                offset,
5130                _depth,
5131            )
5132        }
5133    }
5134    unsafe impl<
5135        T0: fidl::encoding::Encode<
5136                fidl::encoding::Optional<
5137                    fidl::encoding::Endpoint<
5138                        fidl::endpoints::ClientEnd<
5139                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5140                        >,
5141                    >,
5142                >,
5143                fidl::encoding::DefaultFuchsiaResourceDialect,
5144            >,
5145    >
5146        fidl::encoding::Encode<
5147            StreamSetBufferCollection2Request,
5148            fidl::encoding::DefaultFuchsiaResourceDialect,
5149        > for (T0,)
5150    {
5151        #[inline]
5152        unsafe fn encode(
5153            self,
5154            encoder: &mut fidl::encoding::Encoder<
5155                '_,
5156                fidl::encoding::DefaultFuchsiaResourceDialect,
5157            >,
5158            offset: usize,
5159            depth: fidl::encoding::Depth,
5160        ) -> fidl::Result<()> {
5161            encoder.debug_check_bounds::<StreamSetBufferCollection2Request>(offset);
5162            // Zero out padding regions. There's no need to apply masks
5163            // because the unmasked parts will be overwritten by fields.
5164            // Write the fields.
5165            self.0.encode(encoder, offset + 0, depth)?;
5166            Ok(())
5167        }
5168    }
5169
5170    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5171        for StreamSetBufferCollection2Request
5172    {
5173        #[inline(always)]
5174        fn new_empty() -> Self {
5175            Self {
5176                token: fidl::new_empty!(
5177                    fidl::encoding::Optional<
5178                        fidl::encoding::Endpoint<
5179                            fidl::endpoints::ClientEnd<
5180                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5181                            >,
5182                        >,
5183                    >,
5184                    fidl::encoding::DefaultFuchsiaResourceDialect
5185                ),
5186            }
5187        }
5188
5189        #[inline]
5190        unsafe fn decode(
5191            &mut self,
5192            decoder: &mut fidl::encoding::Decoder<
5193                '_,
5194                fidl::encoding::DefaultFuchsiaResourceDialect,
5195            >,
5196            offset: usize,
5197            _depth: fidl::encoding::Depth,
5198        ) -> fidl::Result<()> {
5199            decoder.debug_check_bounds::<Self>(offset);
5200            // Verify that padding bytes are zero.
5201            fidl::decode!(
5202                fidl::encoding::Optional<
5203                    fidl::encoding::Endpoint<
5204                        fidl::endpoints::ClientEnd<
5205                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5206                        >,
5207                    >,
5208                >,
5209                fidl::encoding::DefaultFuchsiaResourceDialect,
5210                &mut self.token,
5211                decoder,
5212                offset + 0,
5213                _depth
5214            )?;
5215            Ok(())
5216        }
5217    }
5218
5219    impl fidl::encoding::ResourceTypeMarker for StreamSetBufferCollectionRequest {
5220        type Borrowed<'a> = &'a mut Self;
5221        fn take_or_borrow<'a>(
5222            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5223        ) -> Self::Borrowed<'a> {
5224            value
5225        }
5226    }
5227
5228    unsafe impl fidl::encoding::TypeMarker for StreamSetBufferCollectionRequest {
5229        type Owned = Self;
5230
5231        #[inline(always)]
5232        fn inline_align(_context: fidl::encoding::Context) -> usize {
5233            4
5234        }
5235
5236        #[inline(always)]
5237        fn inline_size(_context: fidl::encoding::Context) -> usize {
5238            4
5239        }
5240    }
5241
5242    unsafe impl
5243        fidl::encoding::Encode<
5244            StreamSetBufferCollectionRequest,
5245            fidl::encoding::DefaultFuchsiaResourceDialect,
5246        > for &mut StreamSetBufferCollectionRequest
5247    {
5248        #[inline]
5249        unsafe fn encode(
5250            self,
5251            encoder: &mut fidl::encoding::Encoder<
5252                '_,
5253                fidl::encoding::DefaultFuchsiaResourceDialect,
5254            >,
5255            offset: usize,
5256            _depth: fidl::encoding::Depth,
5257        ) -> fidl::Result<()> {
5258            encoder.debug_check_bounds::<StreamSetBufferCollectionRequest>(offset);
5259            // Delegate to tuple encoding.
5260            fidl::encoding::Encode::<
5261                StreamSetBufferCollectionRequest,
5262                fidl::encoding::DefaultFuchsiaResourceDialect,
5263            >::encode(
5264                (<fidl::encoding::Optional<
5265                    fidl::encoding::Endpoint<
5266                        fidl::endpoints::ClientEnd<
5267                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
5268                        >,
5269                    >,
5270                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5271                    &mut self.token
5272                ),),
5273                encoder,
5274                offset,
5275                _depth,
5276            )
5277        }
5278    }
5279    unsafe impl<
5280        T0: fidl::encoding::Encode<
5281                fidl::encoding::Optional<
5282                    fidl::encoding::Endpoint<
5283                        fidl::endpoints::ClientEnd<
5284                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
5285                        >,
5286                    >,
5287                >,
5288                fidl::encoding::DefaultFuchsiaResourceDialect,
5289            >,
5290    >
5291        fidl::encoding::Encode<
5292            StreamSetBufferCollectionRequest,
5293            fidl::encoding::DefaultFuchsiaResourceDialect,
5294        > for (T0,)
5295    {
5296        #[inline]
5297        unsafe fn encode(
5298            self,
5299            encoder: &mut fidl::encoding::Encoder<
5300                '_,
5301                fidl::encoding::DefaultFuchsiaResourceDialect,
5302            >,
5303            offset: usize,
5304            depth: fidl::encoding::Depth,
5305        ) -> fidl::Result<()> {
5306            encoder.debug_check_bounds::<StreamSetBufferCollectionRequest>(offset);
5307            // Zero out padding regions. There's no need to apply masks
5308            // because the unmasked parts will be overwritten by fields.
5309            // Write the fields.
5310            self.0.encode(encoder, offset + 0, depth)?;
5311            Ok(())
5312        }
5313    }
5314
5315    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5316        for StreamSetBufferCollectionRequest
5317    {
5318        #[inline(always)]
5319        fn new_empty() -> Self {
5320            Self {
5321                token: fidl::new_empty!(
5322                    fidl::encoding::Optional<
5323                        fidl::encoding::Endpoint<
5324                            fidl::endpoints::ClientEnd<
5325                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
5326                            >,
5327                        >,
5328                    >,
5329                    fidl::encoding::DefaultFuchsiaResourceDialect
5330                ),
5331            }
5332        }
5333
5334        #[inline]
5335        unsafe fn decode(
5336            &mut self,
5337            decoder: &mut fidl::encoding::Decoder<
5338                '_,
5339                fidl::encoding::DefaultFuchsiaResourceDialect,
5340            >,
5341            offset: usize,
5342            _depth: fidl::encoding::Depth,
5343        ) -> fidl::Result<()> {
5344            decoder.debug_check_bounds::<Self>(offset);
5345            // Verify that padding bytes are zero.
5346            fidl::decode!(
5347                fidl::encoding::Optional<
5348                    fidl::encoding::Endpoint<
5349                        fidl::endpoints::ClientEnd<
5350                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
5351                        >,
5352                    >,
5353                >,
5354                fidl::encoding::DefaultFuchsiaResourceDialect,
5355                &mut self.token,
5356                decoder,
5357                offset + 0,
5358                _depth
5359            )?;
5360            Ok(())
5361        }
5362    }
5363
5364    impl fidl::encoding::ResourceTypeMarker for StreamWatchBufferCollection2Response {
5365        type Borrowed<'a> = &'a mut Self;
5366        fn take_or_borrow<'a>(
5367            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5368        ) -> Self::Borrowed<'a> {
5369            value
5370        }
5371    }
5372
5373    unsafe impl fidl::encoding::TypeMarker for StreamWatchBufferCollection2Response {
5374        type Owned = Self;
5375
5376        #[inline(always)]
5377        fn inline_align(_context: fidl::encoding::Context) -> usize {
5378            4
5379        }
5380
5381        #[inline(always)]
5382        fn inline_size(_context: fidl::encoding::Context) -> usize {
5383            4
5384        }
5385    }
5386
5387    unsafe impl
5388        fidl::encoding::Encode<
5389            StreamWatchBufferCollection2Response,
5390            fidl::encoding::DefaultFuchsiaResourceDialect,
5391        > for &mut StreamWatchBufferCollection2Response
5392    {
5393        #[inline]
5394        unsafe fn encode(
5395            self,
5396            encoder: &mut fidl::encoding::Encoder<
5397                '_,
5398                fidl::encoding::DefaultFuchsiaResourceDialect,
5399            >,
5400            offset: usize,
5401            _depth: fidl::encoding::Depth,
5402        ) -> fidl::Result<()> {
5403            encoder.debug_check_bounds::<StreamWatchBufferCollection2Response>(offset);
5404            // Delegate to tuple encoding.
5405            fidl::encoding::Encode::<
5406                StreamWatchBufferCollection2Response,
5407                fidl::encoding::DefaultFuchsiaResourceDialect,
5408            >::encode(
5409                (<fidl::encoding::Endpoint<
5410                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5411                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5412                    &mut self.token
5413                ),),
5414                encoder,
5415                offset,
5416                _depth,
5417            )
5418        }
5419    }
5420    unsafe impl<
5421        T0: fidl::encoding::Encode<
5422                fidl::encoding::Endpoint<
5423                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5424                >,
5425                fidl::encoding::DefaultFuchsiaResourceDialect,
5426            >,
5427    >
5428        fidl::encoding::Encode<
5429            StreamWatchBufferCollection2Response,
5430            fidl::encoding::DefaultFuchsiaResourceDialect,
5431        > for (T0,)
5432    {
5433        #[inline]
5434        unsafe fn encode(
5435            self,
5436            encoder: &mut fidl::encoding::Encoder<
5437                '_,
5438                fidl::encoding::DefaultFuchsiaResourceDialect,
5439            >,
5440            offset: usize,
5441            depth: fidl::encoding::Depth,
5442        ) -> fidl::Result<()> {
5443            encoder.debug_check_bounds::<StreamWatchBufferCollection2Response>(offset);
5444            // Zero out padding regions. There's no need to apply masks
5445            // because the unmasked parts will be overwritten by fields.
5446            // Write the fields.
5447            self.0.encode(encoder, offset + 0, depth)?;
5448            Ok(())
5449        }
5450    }
5451
5452    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5453        for StreamWatchBufferCollection2Response
5454    {
5455        #[inline(always)]
5456        fn new_empty() -> Self {
5457            Self {
5458                token: fidl::new_empty!(
5459                    fidl::encoding::Endpoint<
5460                        fidl::endpoints::ClientEnd<
5461                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5462                        >,
5463                    >,
5464                    fidl::encoding::DefaultFuchsiaResourceDialect
5465                ),
5466            }
5467        }
5468
5469        #[inline]
5470        unsafe fn decode(
5471            &mut self,
5472            decoder: &mut fidl::encoding::Decoder<
5473                '_,
5474                fidl::encoding::DefaultFuchsiaResourceDialect,
5475            >,
5476            offset: usize,
5477            _depth: fidl::encoding::Depth,
5478        ) -> fidl::Result<()> {
5479            decoder.debug_check_bounds::<Self>(offset);
5480            // Verify that padding bytes are zero.
5481            fidl::decode!(
5482                fidl::encoding::Endpoint<
5483                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5484                >,
5485                fidl::encoding::DefaultFuchsiaResourceDialect,
5486                &mut self.token,
5487                decoder,
5488                offset + 0,
5489                _depth
5490            )?;
5491            Ok(())
5492        }
5493    }
5494
5495    impl fidl::encoding::ResourceTypeMarker for StreamWatchBufferCollectionResponse {
5496        type Borrowed<'a> = &'a mut Self;
5497        fn take_or_borrow<'a>(
5498            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5499        ) -> Self::Borrowed<'a> {
5500            value
5501        }
5502    }
5503
5504    unsafe impl fidl::encoding::TypeMarker for StreamWatchBufferCollectionResponse {
5505        type Owned = Self;
5506
5507        #[inline(always)]
5508        fn inline_align(_context: fidl::encoding::Context) -> usize {
5509            4
5510        }
5511
5512        #[inline(always)]
5513        fn inline_size(_context: fidl::encoding::Context) -> usize {
5514            4
5515        }
5516    }
5517
5518    unsafe impl
5519        fidl::encoding::Encode<
5520            StreamWatchBufferCollectionResponse,
5521            fidl::encoding::DefaultFuchsiaResourceDialect,
5522        > for &mut StreamWatchBufferCollectionResponse
5523    {
5524        #[inline]
5525        unsafe fn encode(
5526            self,
5527            encoder: &mut fidl::encoding::Encoder<
5528                '_,
5529                fidl::encoding::DefaultFuchsiaResourceDialect,
5530            >,
5531            offset: usize,
5532            _depth: fidl::encoding::Depth,
5533        ) -> fidl::Result<()> {
5534            encoder.debug_check_bounds::<StreamWatchBufferCollectionResponse>(offset);
5535            // Delegate to tuple encoding.
5536            fidl::encoding::Encode::<
5537                StreamWatchBufferCollectionResponse,
5538                fidl::encoding::DefaultFuchsiaResourceDialect,
5539            >::encode(
5540                (<fidl::encoding::Endpoint<
5541                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
5542                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5543                    &mut self.token
5544                ),),
5545                encoder,
5546                offset,
5547                _depth,
5548            )
5549        }
5550    }
5551    unsafe impl<
5552        T0: fidl::encoding::Encode<
5553                fidl::encoding::Endpoint<
5554                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
5555                >,
5556                fidl::encoding::DefaultFuchsiaResourceDialect,
5557            >,
5558    >
5559        fidl::encoding::Encode<
5560            StreamWatchBufferCollectionResponse,
5561            fidl::encoding::DefaultFuchsiaResourceDialect,
5562        > for (T0,)
5563    {
5564        #[inline]
5565        unsafe fn encode(
5566            self,
5567            encoder: &mut fidl::encoding::Encoder<
5568                '_,
5569                fidl::encoding::DefaultFuchsiaResourceDialect,
5570            >,
5571            offset: usize,
5572            depth: fidl::encoding::Depth,
5573        ) -> fidl::Result<()> {
5574            encoder.debug_check_bounds::<StreamWatchBufferCollectionResponse>(offset);
5575            // Zero out padding regions. There's no need to apply masks
5576            // because the unmasked parts will be overwritten by fields.
5577            // Write the fields.
5578            self.0.encode(encoder, offset + 0, depth)?;
5579            Ok(())
5580        }
5581    }
5582
5583    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5584        for StreamWatchBufferCollectionResponse
5585    {
5586        #[inline(always)]
5587        fn new_empty() -> Self {
5588            Self {
5589                token: fidl::new_empty!(
5590                    fidl::encoding::Endpoint<
5591                        fidl::endpoints::ClientEnd<
5592                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
5593                        >,
5594                    >,
5595                    fidl::encoding::DefaultFuchsiaResourceDialect
5596                ),
5597            }
5598        }
5599
5600        #[inline]
5601        unsafe fn decode(
5602            &mut self,
5603            decoder: &mut fidl::encoding::Decoder<
5604                '_,
5605                fidl::encoding::DefaultFuchsiaResourceDialect,
5606            >,
5607            offset: usize,
5608            _depth: fidl::encoding::Depth,
5609        ) -> fidl::Result<()> {
5610            decoder.debug_check_bounds::<Self>(offset);
5611            // Verify that padding bytes are zero.
5612            fidl::decode!(
5613                fidl::encoding::Endpoint<
5614                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
5615                >,
5616                fidl::encoding::DefaultFuchsiaResourceDialect,
5617                &mut self.token,
5618                decoder,
5619                offset + 0,
5620                _depth
5621            )?;
5622            Ok(())
5623        }
5624    }
5625
5626    impl FrameInfo2 {
5627        #[inline(always)]
5628        fn max_ordinal_present(&self) -> u64 {
5629            if let Some(_) = self.release_fence {
5630                return 5;
5631            }
5632            if let Some(_) = self.capture_timestamp {
5633                return 4;
5634            }
5635            if let Some(_) = self.timestamp {
5636                return 3;
5637            }
5638            if let Some(_) = self.frame_counter {
5639                return 2;
5640            }
5641            if let Some(_) = self.buffer_index {
5642                return 1;
5643            }
5644            0
5645        }
5646    }
5647
5648    impl fidl::encoding::ResourceTypeMarker for FrameInfo2 {
5649        type Borrowed<'a> = &'a mut Self;
5650        fn take_or_borrow<'a>(
5651            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5652        ) -> Self::Borrowed<'a> {
5653            value
5654        }
5655    }
5656
5657    unsafe impl fidl::encoding::TypeMarker for FrameInfo2 {
5658        type Owned = Self;
5659
5660        #[inline(always)]
5661        fn inline_align(_context: fidl::encoding::Context) -> usize {
5662            8
5663        }
5664
5665        #[inline(always)]
5666        fn inline_size(_context: fidl::encoding::Context) -> usize {
5667            16
5668        }
5669    }
5670
5671    unsafe impl fidl::encoding::Encode<FrameInfo2, fidl::encoding::DefaultFuchsiaResourceDialect>
5672        for &mut FrameInfo2
5673    {
5674        unsafe fn encode(
5675            self,
5676            encoder: &mut fidl::encoding::Encoder<
5677                '_,
5678                fidl::encoding::DefaultFuchsiaResourceDialect,
5679            >,
5680            offset: usize,
5681            mut depth: fidl::encoding::Depth,
5682        ) -> fidl::Result<()> {
5683            encoder.debug_check_bounds::<FrameInfo2>(offset);
5684            // Vector header
5685            let max_ordinal: u64 = self.max_ordinal_present();
5686            encoder.write_num(max_ordinal, offset);
5687            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5688            // Calling encoder.out_of_line_offset(0) is not allowed.
5689            if max_ordinal == 0 {
5690                return Ok(());
5691            }
5692            depth.increment()?;
5693            let envelope_size = 8;
5694            let bytes_len = max_ordinal as usize * envelope_size;
5695            #[allow(unused_variables)]
5696            let offset = encoder.out_of_line_offset(bytes_len);
5697            let mut _prev_end_offset: usize = 0;
5698            if 1 > max_ordinal {
5699                return Ok(());
5700            }
5701
5702            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5703            // are envelope_size bytes.
5704            let cur_offset: usize = (1 - 1) * envelope_size;
5705
5706            // Zero reserved fields.
5707            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5708
5709            // Safety:
5710            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5711            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5712            //   envelope_size bytes, there is always sufficient room.
5713            fidl::encoding::encode_in_envelope_optional::<
5714                u32,
5715                fidl::encoding::DefaultFuchsiaResourceDialect,
5716            >(
5717                self.buffer_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5718                encoder,
5719                offset + cur_offset,
5720                depth,
5721            )?;
5722
5723            _prev_end_offset = cur_offset + envelope_size;
5724            if 2 > max_ordinal {
5725                return Ok(());
5726            }
5727
5728            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5729            // are envelope_size bytes.
5730            let cur_offset: usize = (2 - 1) * envelope_size;
5731
5732            // Zero reserved fields.
5733            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5734
5735            // Safety:
5736            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5737            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5738            //   envelope_size bytes, there is always sufficient room.
5739            fidl::encoding::encode_in_envelope_optional::<
5740                u64,
5741                fidl::encoding::DefaultFuchsiaResourceDialect,
5742            >(
5743                self.frame_counter.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5744                encoder,
5745                offset + cur_offset,
5746                depth,
5747            )?;
5748
5749            _prev_end_offset = cur_offset + envelope_size;
5750            if 3 > max_ordinal {
5751                return Ok(());
5752            }
5753
5754            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5755            // are envelope_size bytes.
5756            let cur_offset: usize = (3 - 1) * envelope_size;
5757
5758            // Zero reserved fields.
5759            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5760
5761            // Safety:
5762            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5763            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5764            //   envelope_size bytes, there is always sufficient room.
5765            fidl::encoding::encode_in_envelope_optional::<
5766                i64,
5767                fidl::encoding::DefaultFuchsiaResourceDialect,
5768            >(
5769                self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5770                encoder,
5771                offset + cur_offset,
5772                depth,
5773            )?;
5774
5775            _prev_end_offset = cur_offset + envelope_size;
5776            if 4 > max_ordinal {
5777                return Ok(());
5778            }
5779
5780            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5781            // are envelope_size bytes.
5782            let cur_offset: usize = (4 - 1) * envelope_size;
5783
5784            // Zero reserved fields.
5785            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5786
5787            // Safety:
5788            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5789            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5790            //   envelope_size bytes, there is always sufficient room.
5791            fidl::encoding::encode_in_envelope_optional::<
5792                i64,
5793                fidl::encoding::DefaultFuchsiaResourceDialect,
5794            >(
5795                self.capture_timestamp
5796                    .as_ref()
5797                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5798                encoder,
5799                offset + cur_offset,
5800                depth,
5801            )?;
5802
5803            _prev_end_offset = cur_offset + envelope_size;
5804            if 5 > max_ordinal {
5805                return Ok(());
5806            }
5807
5808            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5809            // are envelope_size bytes.
5810            let cur_offset: usize = (5 - 1) * envelope_size;
5811
5812            // Zero reserved fields.
5813            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5814
5815            // Safety:
5816            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5817            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5818            //   envelope_size bytes, there is always sufficient room.
5819            fidl::encoding::encode_in_envelope_optional::<
5820                fidl::encoding::HandleType<
5821                    fidl::EventPair,
5822                    { fidl::ObjectType::EVENTPAIR.into_raw() },
5823                    2147483648,
5824                >,
5825                fidl::encoding::DefaultFuchsiaResourceDialect,
5826            >(
5827                self.release_fence.as_mut().map(
5828                    <fidl::encoding::HandleType<
5829                        fidl::EventPair,
5830                        { fidl::ObjectType::EVENTPAIR.into_raw() },
5831                        2147483648,
5832                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5833                ),
5834                encoder,
5835                offset + cur_offset,
5836                depth,
5837            )?;
5838
5839            _prev_end_offset = cur_offset + envelope_size;
5840
5841            Ok(())
5842        }
5843    }
5844
5845    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo2 {
5846        #[inline(always)]
5847        fn new_empty() -> Self {
5848            Self::default()
5849        }
5850
5851        unsafe fn decode(
5852            &mut self,
5853            decoder: &mut fidl::encoding::Decoder<
5854                '_,
5855                fidl::encoding::DefaultFuchsiaResourceDialect,
5856            >,
5857            offset: usize,
5858            mut depth: fidl::encoding::Depth,
5859        ) -> fidl::Result<()> {
5860            decoder.debug_check_bounds::<Self>(offset);
5861            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5862                None => return Err(fidl::Error::NotNullable),
5863                Some(len) => len,
5864            };
5865            // Calling decoder.out_of_line_offset(0) is not allowed.
5866            if len == 0 {
5867                return Ok(());
5868            };
5869            depth.increment()?;
5870            let envelope_size = 8;
5871            let bytes_len = len * envelope_size;
5872            let offset = decoder.out_of_line_offset(bytes_len)?;
5873            // Decode the envelope for each type.
5874            let mut _next_ordinal_to_read = 0;
5875            let mut next_offset = offset;
5876            let end_offset = offset + bytes_len;
5877            _next_ordinal_to_read += 1;
5878            if next_offset >= end_offset {
5879                return Ok(());
5880            }
5881
5882            // Decode unknown envelopes for gaps in ordinals.
5883            while _next_ordinal_to_read < 1 {
5884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5885                _next_ordinal_to_read += 1;
5886                next_offset += envelope_size;
5887            }
5888
5889            let next_out_of_line = decoder.next_out_of_line();
5890            let handles_before = decoder.remaining_handles();
5891            if let Some((inlined, num_bytes, num_handles)) =
5892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5893            {
5894                let member_inline_size =
5895                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5896                if inlined != (member_inline_size <= 4) {
5897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5898                }
5899                let inner_offset;
5900                let mut inner_depth = depth.clone();
5901                if inlined {
5902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5903                    inner_offset = next_offset;
5904                } else {
5905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5906                    inner_depth.increment()?;
5907                }
5908                let val_ref = self.buffer_index.get_or_insert_with(|| {
5909                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
5910                });
5911                fidl::decode!(
5912                    u32,
5913                    fidl::encoding::DefaultFuchsiaResourceDialect,
5914                    val_ref,
5915                    decoder,
5916                    inner_offset,
5917                    inner_depth
5918                )?;
5919                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5920                {
5921                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5922                }
5923                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5924                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5925                }
5926            }
5927
5928            next_offset += envelope_size;
5929            _next_ordinal_to_read += 1;
5930            if next_offset >= end_offset {
5931                return Ok(());
5932            }
5933
5934            // Decode unknown envelopes for gaps in ordinals.
5935            while _next_ordinal_to_read < 2 {
5936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5937                _next_ordinal_to_read += 1;
5938                next_offset += envelope_size;
5939            }
5940
5941            let next_out_of_line = decoder.next_out_of_line();
5942            let handles_before = decoder.remaining_handles();
5943            if let Some((inlined, num_bytes, num_handles)) =
5944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5945            {
5946                let member_inline_size =
5947                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5948                if inlined != (member_inline_size <= 4) {
5949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5950                }
5951                let inner_offset;
5952                let mut inner_depth = depth.clone();
5953                if inlined {
5954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5955                    inner_offset = next_offset;
5956                } else {
5957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5958                    inner_depth.increment()?;
5959                }
5960                let val_ref = self.frame_counter.get_or_insert_with(|| {
5961                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
5962                });
5963                fidl::decode!(
5964                    u64,
5965                    fidl::encoding::DefaultFuchsiaResourceDialect,
5966                    val_ref,
5967                    decoder,
5968                    inner_offset,
5969                    inner_depth
5970                )?;
5971                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5972                {
5973                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5974                }
5975                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5976                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5977                }
5978            }
5979
5980            next_offset += envelope_size;
5981            _next_ordinal_to_read += 1;
5982            if next_offset >= end_offset {
5983                return Ok(());
5984            }
5985
5986            // Decode unknown envelopes for gaps in ordinals.
5987            while _next_ordinal_to_read < 3 {
5988                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5989                _next_ordinal_to_read += 1;
5990                next_offset += envelope_size;
5991            }
5992
5993            let next_out_of_line = decoder.next_out_of_line();
5994            let handles_before = decoder.remaining_handles();
5995            if let Some((inlined, num_bytes, num_handles)) =
5996                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5997            {
5998                let member_inline_size =
5999                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6000                if inlined != (member_inline_size <= 4) {
6001                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6002                }
6003                let inner_offset;
6004                let mut inner_depth = depth.clone();
6005                if inlined {
6006                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6007                    inner_offset = next_offset;
6008                } else {
6009                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6010                    inner_depth.increment()?;
6011                }
6012                let val_ref = self.timestamp.get_or_insert_with(|| {
6013                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
6014                });
6015                fidl::decode!(
6016                    i64,
6017                    fidl::encoding::DefaultFuchsiaResourceDialect,
6018                    val_ref,
6019                    decoder,
6020                    inner_offset,
6021                    inner_depth
6022                )?;
6023                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6024                {
6025                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6026                }
6027                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6028                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6029                }
6030            }
6031
6032            next_offset += envelope_size;
6033            _next_ordinal_to_read += 1;
6034            if next_offset >= end_offset {
6035                return Ok(());
6036            }
6037
6038            // Decode unknown envelopes for gaps in ordinals.
6039            while _next_ordinal_to_read < 4 {
6040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6041                _next_ordinal_to_read += 1;
6042                next_offset += envelope_size;
6043            }
6044
6045            let next_out_of_line = decoder.next_out_of_line();
6046            let handles_before = decoder.remaining_handles();
6047            if let Some((inlined, num_bytes, num_handles)) =
6048                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6049            {
6050                let member_inline_size =
6051                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6052                if inlined != (member_inline_size <= 4) {
6053                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6054                }
6055                let inner_offset;
6056                let mut inner_depth = depth.clone();
6057                if inlined {
6058                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6059                    inner_offset = next_offset;
6060                } else {
6061                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6062                    inner_depth.increment()?;
6063                }
6064                let val_ref = self.capture_timestamp.get_or_insert_with(|| {
6065                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
6066                });
6067                fidl::decode!(
6068                    i64,
6069                    fidl::encoding::DefaultFuchsiaResourceDialect,
6070                    val_ref,
6071                    decoder,
6072                    inner_offset,
6073                    inner_depth
6074                )?;
6075                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6076                {
6077                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6078                }
6079                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6080                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6081                }
6082            }
6083
6084            next_offset += envelope_size;
6085            _next_ordinal_to_read += 1;
6086            if next_offset >= end_offset {
6087                return Ok(());
6088            }
6089
6090            // Decode unknown envelopes for gaps in ordinals.
6091            while _next_ordinal_to_read < 5 {
6092                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6093                _next_ordinal_to_read += 1;
6094                next_offset += envelope_size;
6095            }
6096
6097            let next_out_of_line = decoder.next_out_of_line();
6098            let handles_before = decoder.remaining_handles();
6099            if let Some((inlined, num_bytes, num_handles)) =
6100                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6101            {
6102                let member_inline_size = <fidl::encoding::HandleType<
6103                    fidl::EventPair,
6104                    { fidl::ObjectType::EVENTPAIR.into_raw() },
6105                    2147483648,
6106                > as fidl::encoding::TypeMarker>::inline_size(
6107                    decoder.context
6108                );
6109                if inlined != (member_inline_size <= 4) {
6110                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6111                }
6112                let inner_offset;
6113                let mut inner_depth = depth.clone();
6114                if inlined {
6115                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6116                    inner_offset = next_offset;
6117                } else {
6118                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6119                    inner_depth.increment()?;
6120                }
6121                let val_ref =
6122                self.release_fence.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6123                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6125                {
6126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6127                }
6128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6130                }
6131            }
6132
6133            next_offset += envelope_size;
6134
6135            // Decode the remaining unknown envelopes.
6136            while next_offset < end_offset {
6137                _next_ordinal_to_read += 1;
6138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6139                next_offset += envelope_size;
6140            }
6141
6142            Ok(())
6143        }
6144    }
6145}