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