fidl_fuchsia_driver_registrar/
fidl_fuchsia_driver_registrar.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct DriverRegistrarRegisterRequest {
15    pub driver_url: String,
16}
17
18impl fidl::Persistable for DriverRegistrarRegisterRequest {}
19
20#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
21pub struct DriverRegistrarMarker;
22
23impl fidl::endpoints::ProtocolMarker for DriverRegistrarMarker {
24    type Proxy = DriverRegistrarProxy;
25    type RequestStream = DriverRegistrarRequestStream;
26    #[cfg(target_os = "fuchsia")]
27    type SynchronousProxy = DriverRegistrarSynchronousProxy;
28
29    const DEBUG_NAME: &'static str = "fuchsia.driver.registrar.DriverRegistrar";
30}
31impl fidl::endpoints::DiscoverableProtocolMarker for DriverRegistrarMarker {}
32pub type DriverRegistrarRegisterResult = Result<(), i32>;
33
34pub trait DriverRegistrarProxyInterface: Send + Sync {
35    type RegisterResponseFut: std::future::Future<Output = Result<DriverRegistrarRegisterResult, fidl::Error>>
36        + Send;
37    fn r#register(&self, driver_url: &str) -> Self::RegisterResponseFut;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct DriverRegistrarSynchronousProxy {
42    client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for DriverRegistrarSynchronousProxy {
47    type Proxy = DriverRegistrarProxy;
48    type Protocol = DriverRegistrarMarker;
49
50    fn from_channel(inner: fidl::Channel) -> Self {
51        Self::new(inner)
52    }
53
54    fn into_channel(self) -> fidl::Channel {
55        self.client.into_channel()
56    }
57
58    fn as_channel(&self) -> &fidl::Channel {
59        self.client.as_channel()
60    }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl DriverRegistrarSynchronousProxy {
65    pub fn new(channel: fidl::Channel) -> Self {
66        let protocol_name = <DriverRegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
67        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
68    }
69
70    pub fn into_channel(self) -> fidl::Channel {
71        self.client.into_channel()
72    }
73
74    /// Waits until an event arrives and returns it. It is safe for other
75    /// threads to make concurrent requests while waiting for an event.
76    pub fn wait_for_event(
77        &self,
78        deadline: zx::MonotonicInstant,
79    ) -> Result<DriverRegistrarEvent, fidl::Error> {
80        DriverRegistrarEvent::decode(self.client.wait_for_event(deadline)?)
81    }
82
83    /// Informs the driver framework of an ephemeral driver. The metadata will
84    /// be cached by the driver index to be used in future matching operations.
85    /// * error a zx_status value indicating failure. One of the following:
86    ///     * `ZX_ERR_PROTOCOL_NOT_SUPPORTED` if the ephermeral driver config
87    ///       `enable_ephemeral_drivers` is not enabled.
88    ///     * `ZX_ERR_ACCESS_DENIED` if the device does not have permissions
89    ///       to fetch the package.
90    ///     * `ZX_ERR_ALREADY_EXISTS` if the driver component being registered
91    ///       already exists in the boot or base drivers list.
92    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist or it is missing
93    ///        a manifest or /pkg directory.
94    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
95    ///     * `ZX_ERR_ADDRESS_UNREACHABLE` if the package resolver does not
96    ///       know about the repo or the url cannot be parsed.
97    ///     * `ZX_ERR_INVALID_ARGS` if the component decl cannot be parsed.
98    ///     * `ZX_ERR_NO_SPACE` if the device is out of space.
99    ///     * `ZX_ERR_UNAVAILABLE` if the package resolver could not be reached.
100    ///     * `ZX_ERR_INTERNAL` if an unspecified error was encountered.
101    pub fn r#register(
102        &self,
103        mut driver_url: &str,
104        ___deadline: zx::MonotonicInstant,
105    ) -> Result<DriverRegistrarRegisterResult, fidl::Error> {
106        let _response = self.client.send_query::<
107            DriverRegistrarRegisterRequest,
108            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
109        >(
110            (driver_url,),
111            0x5c5f637b5f7c6a6,
112            fidl::encoding::DynamicFlags::FLEXIBLE,
113            ___deadline,
114        )?
115        .into_result::<DriverRegistrarMarker>("register")?;
116        Ok(_response.map(|x| x))
117    }
118}
119
120#[derive(Debug, Clone)]
121pub struct DriverRegistrarProxy {
122    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
123}
124
125impl fidl::endpoints::Proxy for DriverRegistrarProxy {
126    type Protocol = DriverRegistrarMarker;
127
128    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
129        Self::new(inner)
130    }
131
132    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
133        self.client.into_channel().map_err(|client| Self { client })
134    }
135
136    fn as_channel(&self) -> &::fidl::AsyncChannel {
137        self.client.as_channel()
138    }
139}
140
141impl DriverRegistrarProxy {
142    /// Create a new Proxy for fuchsia.driver.registrar/DriverRegistrar.
143    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
144        let protocol_name = <DriverRegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
145        Self { client: fidl::client::Client::new(channel, protocol_name) }
146    }
147
148    /// Get a Stream of events from the remote end of the protocol.
149    ///
150    /// # Panics
151    ///
152    /// Panics if the event stream was already taken.
153    pub fn take_event_stream(&self) -> DriverRegistrarEventStream {
154        DriverRegistrarEventStream { event_receiver: self.client.take_event_receiver() }
155    }
156
157    /// Informs the driver framework of an ephemeral driver. The metadata will
158    /// be cached by the driver index to be used in future matching operations.
159    /// * error a zx_status value indicating failure. One of the following:
160    ///     * `ZX_ERR_PROTOCOL_NOT_SUPPORTED` if the ephermeral driver config
161    ///       `enable_ephemeral_drivers` is not enabled.
162    ///     * `ZX_ERR_ACCESS_DENIED` if the device does not have permissions
163    ///       to fetch the package.
164    ///     * `ZX_ERR_ALREADY_EXISTS` if the driver component being registered
165    ///       already exists in the boot or base drivers list.
166    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist or it is missing
167    ///        a manifest or /pkg directory.
168    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
169    ///     * `ZX_ERR_ADDRESS_UNREACHABLE` if the package resolver does not
170    ///       know about the repo or the url cannot be parsed.
171    ///     * `ZX_ERR_INVALID_ARGS` if the component decl cannot be parsed.
172    ///     * `ZX_ERR_NO_SPACE` if the device is out of space.
173    ///     * `ZX_ERR_UNAVAILABLE` if the package resolver could not be reached.
174    ///     * `ZX_ERR_INTERNAL` if an unspecified error was encountered.
175    pub fn r#register(
176        &self,
177        mut driver_url: &str,
178    ) -> fidl::client::QueryResponseFut<
179        DriverRegistrarRegisterResult,
180        fidl::encoding::DefaultFuchsiaResourceDialect,
181    > {
182        DriverRegistrarProxyInterface::r#register(self, driver_url)
183    }
184}
185
186impl DriverRegistrarProxyInterface for DriverRegistrarProxy {
187    type RegisterResponseFut = fidl::client::QueryResponseFut<
188        DriverRegistrarRegisterResult,
189        fidl::encoding::DefaultFuchsiaResourceDialect,
190    >;
191    fn r#register(&self, mut driver_url: &str) -> Self::RegisterResponseFut {
192        fn _decode(
193            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
194        ) -> Result<DriverRegistrarRegisterResult, fidl::Error> {
195            let _response = fidl::client::decode_transaction_body::<
196                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
197                fidl::encoding::DefaultFuchsiaResourceDialect,
198                0x5c5f637b5f7c6a6,
199            >(_buf?)?
200            .into_result::<DriverRegistrarMarker>("register")?;
201            Ok(_response.map(|x| x))
202        }
203        self.client
204            .send_query_and_decode::<DriverRegistrarRegisterRequest, DriverRegistrarRegisterResult>(
205                (driver_url,),
206                0x5c5f637b5f7c6a6,
207                fidl::encoding::DynamicFlags::FLEXIBLE,
208                _decode,
209            )
210    }
211}
212
213pub struct DriverRegistrarEventStream {
214    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
215}
216
217impl std::marker::Unpin for DriverRegistrarEventStream {}
218
219impl futures::stream::FusedStream for DriverRegistrarEventStream {
220    fn is_terminated(&self) -> bool {
221        self.event_receiver.is_terminated()
222    }
223}
224
225impl futures::Stream for DriverRegistrarEventStream {
226    type Item = Result<DriverRegistrarEvent, fidl::Error>;
227
228    fn poll_next(
229        mut self: std::pin::Pin<&mut Self>,
230        cx: &mut std::task::Context<'_>,
231    ) -> std::task::Poll<Option<Self::Item>> {
232        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
233            &mut self.event_receiver,
234            cx
235        )?) {
236            Some(buf) => std::task::Poll::Ready(Some(DriverRegistrarEvent::decode(buf))),
237            None => std::task::Poll::Ready(None),
238        }
239    }
240}
241
242#[derive(Debug)]
243pub enum DriverRegistrarEvent {
244    #[non_exhaustive]
245    _UnknownEvent {
246        /// Ordinal of the event that was sent.
247        ordinal: u64,
248    },
249}
250
251impl DriverRegistrarEvent {
252    /// Decodes a message buffer as a [`DriverRegistrarEvent`].
253    fn decode(
254        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
255    ) -> Result<DriverRegistrarEvent, fidl::Error> {
256        let (bytes, _handles) = buf.split_mut();
257        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
258        debug_assert_eq!(tx_header.tx_id, 0);
259        match tx_header.ordinal {
260            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
261                Ok(DriverRegistrarEvent::_UnknownEvent { ordinal: tx_header.ordinal })
262            }
263            _ => Err(fidl::Error::UnknownOrdinal {
264                ordinal: tx_header.ordinal,
265                protocol_name:
266                    <DriverRegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
267            }),
268        }
269    }
270}
271
272/// A Stream of incoming requests for fuchsia.driver.registrar/DriverRegistrar.
273pub struct DriverRegistrarRequestStream {
274    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
275    is_terminated: bool,
276}
277
278impl std::marker::Unpin for DriverRegistrarRequestStream {}
279
280impl futures::stream::FusedStream for DriverRegistrarRequestStream {
281    fn is_terminated(&self) -> bool {
282        self.is_terminated
283    }
284}
285
286impl fidl::endpoints::RequestStream for DriverRegistrarRequestStream {
287    type Protocol = DriverRegistrarMarker;
288    type ControlHandle = DriverRegistrarControlHandle;
289
290    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
291        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
292    }
293
294    fn control_handle(&self) -> Self::ControlHandle {
295        DriverRegistrarControlHandle { inner: self.inner.clone() }
296    }
297
298    fn into_inner(
299        self,
300    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
301    {
302        (self.inner, self.is_terminated)
303    }
304
305    fn from_inner(
306        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
307        is_terminated: bool,
308    ) -> Self {
309        Self { inner, is_terminated }
310    }
311}
312
313impl futures::Stream for DriverRegistrarRequestStream {
314    type Item = Result<DriverRegistrarRequest, fidl::Error>;
315
316    fn poll_next(
317        mut self: std::pin::Pin<&mut Self>,
318        cx: &mut std::task::Context<'_>,
319    ) -> std::task::Poll<Option<Self::Item>> {
320        let this = &mut *self;
321        if this.inner.check_shutdown(cx) {
322            this.is_terminated = true;
323            return std::task::Poll::Ready(None);
324        }
325        if this.is_terminated {
326            panic!("polled DriverRegistrarRequestStream after completion");
327        }
328        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
329            |bytes, handles| {
330                match this.inner.channel().read_etc(cx, bytes, handles) {
331                    std::task::Poll::Ready(Ok(())) => {}
332                    std::task::Poll::Pending => return std::task::Poll::Pending,
333                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
334                        this.is_terminated = true;
335                        return std::task::Poll::Ready(None);
336                    }
337                    std::task::Poll::Ready(Err(e)) => {
338                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
339                            e.into(),
340                        ))))
341                    }
342                }
343
344                // A message has been received from the channel
345                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
346
347                std::task::Poll::Ready(Some(match header.ordinal {
348                    0x5c5f637b5f7c6a6 => {
349                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
350                        let mut req = fidl::new_empty!(
351                            DriverRegistrarRegisterRequest,
352                            fidl::encoding::DefaultFuchsiaResourceDialect
353                        );
354                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverRegistrarRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
355                        let control_handle =
356                            DriverRegistrarControlHandle { inner: this.inner.clone() };
357                        Ok(DriverRegistrarRequest::Register {
358                            driver_url: req.driver_url,
359
360                            responder: DriverRegistrarRegisterResponder {
361                                control_handle: std::mem::ManuallyDrop::new(control_handle),
362                                tx_id: header.tx_id,
363                            },
364                        })
365                    }
366                    _ if header.tx_id == 0
367                        && header
368                            .dynamic_flags()
369                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
370                    {
371                        Ok(DriverRegistrarRequest::_UnknownMethod {
372                            ordinal: header.ordinal,
373                            control_handle: DriverRegistrarControlHandle {
374                                inner: this.inner.clone(),
375                            },
376                            method_type: fidl::MethodType::OneWay,
377                        })
378                    }
379                    _ if header
380                        .dynamic_flags()
381                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
382                    {
383                        this.inner.send_framework_err(
384                            fidl::encoding::FrameworkErr::UnknownMethod,
385                            header.tx_id,
386                            header.ordinal,
387                            header.dynamic_flags(),
388                            (bytes, handles),
389                        )?;
390                        Ok(DriverRegistrarRequest::_UnknownMethod {
391                            ordinal: header.ordinal,
392                            control_handle: DriverRegistrarControlHandle {
393                                inner: this.inner.clone(),
394                            },
395                            method_type: fidl::MethodType::TwoWay,
396                        })
397                    }
398                    _ => Err(fidl::Error::UnknownOrdinal {
399                        ordinal: header.ordinal,
400                        protocol_name:
401                            <DriverRegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
402                    }),
403                }))
404            },
405        )
406    }
407}
408
409/// Protocol for registering ephemeral driver packages.
410#[derive(Debug)]
411pub enum DriverRegistrarRequest {
412    /// Informs the driver framework of an ephemeral driver. The metadata will
413    /// be cached by the driver index to be used in future matching operations.
414    /// * error a zx_status value indicating failure. One of the following:
415    ///     * `ZX_ERR_PROTOCOL_NOT_SUPPORTED` if the ephermeral driver config
416    ///       `enable_ephemeral_drivers` is not enabled.
417    ///     * `ZX_ERR_ACCESS_DENIED` if the device does not have permissions
418    ///       to fetch the package.
419    ///     * `ZX_ERR_ALREADY_EXISTS` if the driver component being registered
420    ///       already exists in the boot or base drivers list.
421    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist or it is missing
422    ///        a manifest or /pkg directory.
423    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
424    ///     * `ZX_ERR_ADDRESS_UNREACHABLE` if the package resolver does not
425    ///       know about the repo or the url cannot be parsed.
426    ///     * `ZX_ERR_INVALID_ARGS` if the component decl cannot be parsed.
427    ///     * `ZX_ERR_NO_SPACE` if the device is out of space.
428    ///     * `ZX_ERR_UNAVAILABLE` if the package resolver could not be reached.
429    ///     * `ZX_ERR_INTERNAL` if an unspecified error was encountered.
430    Register { driver_url: String, responder: DriverRegistrarRegisterResponder },
431    /// An interaction was received which does not match any known method.
432    #[non_exhaustive]
433    _UnknownMethod {
434        /// Ordinal of the method that was called.
435        ordinal: u64,
436        control_handle: DriverRegistrarControlHandle,
437        method_type: fidl::MethodType,
438    },
439}
440
441impl DriverRegistrarRequest {
442    #[allow(irrefutable_let_patterns)]
443    pub fn into_register(self) -> Option<(String, DriverRegistrarRegisterResponder)> {
444        if let DriverRegistrarRequest::Register { driver_url, responder } = self {
445            Some((driver_url, responder))
446        } else {
447            None
448        }
449    }
450
451    /// Name of the method defined in FIDL
452    pub fn method_name(&self) -> &'static str {
453        match *self {
454            DriverRegistrarRequest::Register { .. } => "register",
455            DriverRegistrarRequest::_UnknownMethod {
456                method_type: fidl::MethodType::OneWay,
457                ..
458            } => "unknown one-way method",
459            DriverRegistrarRequest::_UnknownMethod {
460                method_type: fidl::MethodType::TwoWay,
461                ..
462            } => "unknown two-way method",
463        }
464    }
465}
466
467#[derive(Debug, Clone)]
468pub struct DriverRegistrarControlHandle {
469    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
470}
471
472impl fidl::endpoints::ControlHandle for DriverRegistrarControlHandle {
473    fn shutdown(&self) {
474        self.inner.shutdown()
475    }
476    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
477        self.inner.shutdown_with_epitaph(status)
478    }
479
480    fn is_closed(&self) -> bool {
481        self.inner.channel().is_closed()
482    }
483    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
484        self.inner.channel().on_closed()
485    }
486
487    #[cfg(target_os = "fuchsia")]
488    fn signal_peer(
489        &self,
490        clear_mask: zx::Signals,
491        set_mask: zx::Signals,
492    ) -> Result<(), zx_status::Status> {
493        use fidl::Peered;
494        self.inner.channel().signal_peer(clear_mask, set_mask)
495    }
496}
497
498impl DriverRegistrarControlHandle {}
499
500#[must_use = "FIDL methods require a response to be sent"]
501#[derive(Debug)]
502pub struct DriverRegistrarRegisterResponder {
503    control_handle: std::mem::ManuallyDrop<DriverRegistrarControlHandle>,
504    tx_id: u32,
505}
506
507/// Set the the channel to be shutdown (see [`DriverRegistrarControlHandle::shutdown`])
508/// if the responder is dropped without sending a response, so that the client
509/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
510impl std::ops::Drop for DriverRegistrarRegisterResponder {
511    fn drop(&mut self) {
512        self.control_handle.shutdown();
513        // Safety: drops once, never accessed again
514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
515    }
516}
517
518impl fidl::endpoints::Responder for DriverRegistrarRegisterResponder {
519    type ControlHandle = DriverRegistrarControlHandle;
520
521    fn control_handle(&self) -> &DriverRegistrarControlHandle {
522        &self.control_handle
523    }
524
525    fn drop_without_shutdown(mut self) {
526        // Safety: drops once, never accessed again due to mem::forget
527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
528        // Prevent Drop from running (which would shut down the channel)
529        std::mem::forget(self);
530    }
531}
532
533impl DriverRegistrarRegisterResponder {
534    /// Sends a response to the FIDL transaction.
535    ///
536    /// Sets the channel to shutdown if an error occurs.
537    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
538        let _result = self.send_raw(result);
539        if _result.is_err() {
540            self.control_handle.shutdown();
541        }
542        self.drop_without_shutdown();
543        _result
544    }
545
546    /// Similar to "send" but does not shutdown the channel if an error occurs.
547    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
548        let _result = self.send_raw(result);
549        self.drop_without_shutdown();
550        _result
551    }
552
553    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
554        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
555            fidl::encoding::EmptyStruct,
556            i32,
557        >>(
558            fidl::encoding::FlexibleResult::new(result),
559            self.tx_id,
560            0x5c5f637b5f7c6a6,
561            fidl::encoding::DynamicFlags::FLEXIBLE,
562        )
563    }
564}
565
566mod internal {
567    use super::*;
568
569    impl fidl::encoding::ValueTypeMarker for DriverRegistrarRegisterRequest {
570        type Borrowed<'a> = &'a Self;
571        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
572            value
573        }
574    }
575
576    unsafe impl fidl::encoding::TypeMarker for DriverRegistrarRegisterRequest {
577        type Owned = Self;
578
579        #[inline(always)]
580        fn inline_align(_context: fidl::encoding::Context) -> usize {
581            8
582        }
583
584        #[inline(always)]
585        fn inline_size(_context: fidl::encoding::Context) -> usize {
586            16
587        }
588    }
589
590    unsafe impl<D: fidl::encoding::ResourceDialect>
591        fidl::encoding::Encode<DriverRegistrarRegisterRequest, D>
592        for &DriverRegistrarRegisterRequest
593    {
594        #[inline]
595        unsafe fn encode(
596            self,
597            encoder: &mut fidl::encoding::Encoder<'_, D>,
598            offset: usize,
599            _depth: fidl::encoding::Depth,
600        ) -> fidl::Result<()> {
601            encoder.debug_check_bounds::<DriverRegistrarRegisterRequest>(offset);
602            // Delegate to tuple encoding.
603            fidl::encoding::Encode::<DriverRegistrarRegisterRequest, D>::encode(
604                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
605                    &self.driver_url,
606                ),),
607                encoder,
608                offset,
609                _depth,
610            )
611        }
612    }
613    unsafe impl<
614            D: fidl::encoding::ResourceDialect,
615            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
616        > fidl::encoding::Encode<DriverRegistrarRegisterRequest, D> for (T0,)
617    {
618        #[inline]
619        unsafe fn encode(
620            self,
621            encoder: &mut fidl::encoding::Encoder<'_, D>,
622            offset: usize,
623            depth: fidl::encoding::Depth,
624        ) -> fidl::Result<()> {
625            encoder.debug_check_bounds::<DriverRegistrarRegisterRequest>(offset);
626            // Zero out padding regions. There's no need to apply masks
627            // because the unmasked parts will be overwritten by fields.
628            // Write the fields.
629            self.0.encode(encoder, offset + 0, depth)?;
630            Ok(())
631        }
632    }
633
634    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
635        for DriverRegistrarRegisterRequest
636    {
637        #[inline(always)]
638        fn new_empty() -> Self {
639            Self { driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
640        }
641
642        #[inline]
643        unsafe fn decode(
644            &mut self,
645            decoder: &mut fidl::encoding::Decoder<'_, D>,
646            offset: usize,
647            _depth: fidl::encoding::Depth,
648        ) -> fidl::Result<()> {
649            decoder.debug_check_bounds::<Self>(offset);
650            // Verify that padding bytes are zero.
651            fidl::decode!(
652                fidl::encoding::BoundedString<4096>,
653                D,
654                &mut self.driver_url,
655                decoder,
656                offset + 0,
657                _depth
658            )?;
659            Ok(())
660        }
661    }
662}