fidl_fuchsia_camera3/
fidl_fuchsia_camera3.rs

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