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