Skip to main content

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