1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_net_interfaces_admin_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct ControlAddAddressRequest {
15 pub address: fdomain_fuchsia_net::Subnet,
16 pub parameters: AddressParameters,
17 pub address_state_provider: fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
18}
19
20impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for ControlAddAddressRequest {}
21
22#[derive(Debug, PartialEq)]
23pub struct ControlGetAuthorizationForInterfaceResponse {
24 pub credential: fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
25}
26
27impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
28 for ControlGetAuthorizationForInterfaceResponse
29{
30}
31
32#[derive(Debug, PartialEq)]
33pub struct DeviceControlCreateInterfaceRequest {
34 pub port: fdomain_fuchsia_hardware_network::PortId,
35 pub control: fdomain_client::fidl::ServerEnd<ControlMarker>,
36 pub options: Options,
37}
38
39impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
40 for DeviceControlCreateInterfaceRequest
41{
42}
43
44#[derive(Debug, PartialEq)]
45pub struct InstallerInstallBlackholeInterfaceRequest {
46 pub interface: fdomain_client::fidl::ServerEnd<ControlMarker>,
47 pub options: Options,
48}
49
50impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
51 for InstallerInstallBlackholeInterfaceRequest
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct InstallerInstallDeviceRequest {
57 pub device: fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
58 pub device_control: fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
59}
60
61impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
62 for InstallerInstallDeviceRequest
63{
64}
65
66#[derive(Debug, Default, PartialEq)]
68pub struct Options {
69 pub name: Option<String>,
73 pub metric: Option<u32>,
77 pub netstack_managed_routes_designation: Option<NetstackManagedRoutesDesignation>,
81 #[doc(hidden)]
82 pub __source_breaking: fidl::marker::SourceBreaking,
83}
84
85impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for Options {}
86
87#[derive(Debug)]
90pub enum NetstackManagedRoutesDesignation {
91 Main(Empty),
93 InterfaceLocal(Empty),
99 #[doc(hidden)]
100 __SourceBreaking { unknown_ordinal: u64 },
101}
102
103#[macro_export]
105macro_rules! NetstackManagedRoutesDesignationUnknown {
106 () => {
107 _
108 };
109}
110
111impl PartialEq for NetstackManagedRoutesDesignation {
113 fn eq(&self, other: &Self) -> bool {
114 match (self, other) {
115 (Self::Main(x), Self::Main(y)) => *x == *y,
116 (Self::InterfaceLocal(x), Self::InterfaceLocal(y)) => *x == *y,
117 _ => false,
118 }
119 }
120}
121
122impl NetstackManagedRoutesDesignation {
123 #[inline]
124 pub fn ordinal(&self) -> u64 {
125 match *self {
126 Self::Main(_) => 1,
127 Self::InterfaceLocal(_) => 2,
128 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
129 }
130 }
131
132 #[inline]
133 pub fn unknown_variant_for_testing() -> Self {
134 Self::__SourceBreaking { unknown_ordinal: 0 }
135 }
136
137 #[inline]
138 pub fn is_unknown(&self) -> bool {
139 match self {
140 Self::__SourceBreaking { .. } => true,
141 _ => false,
142 }
143 }
144}
145
146impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
147 for NetstackManagedRoutesDesignation
148{
149}
150
151#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub struct AddressStateProviderMarker;
153
154impl fdomain_client::fidl::ProtocolMarker for AddressStateProviderMarker {
155 type Proxy = AddressStateProviderProxy;
156 type RequestStream = AddressStateProviderRequestStream;
157
158 const DEBUG_NAME: &'static str = "(anonymous) AddressStateProvider";
159}
160
161pub trait AddressStateProviderProxyInterface: Send + Sync {
162 type UpdateAddressPropertiesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
163 + Send;
164 fn r#update_address_properties(
165 &self,
166 address_properties: &AddressProperties,
167 ) -> Self::UpdateAddressPropertiesResponseFut;
168 type WatchAddressAssignmentStateResponseFut: std::future::Future<
169 Output = Result<fdomain_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error>,
170 > + Send;
171 fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut;
172 fn r#detach(&self) -> Result<(), fidl::Error>;
173 fn r#remove(&self) -> Result<(), fidl::Error>;
174}
175
176#[derive(Debug, Clone)]
177pub struct AddressStateProviderProxy {
178 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
179}
180
181impl fdomain_client::fidl::Proxy for AddressStateProviderProxy {
182 type Protocol = AddressStateProviderMarker;
183
184 fn from_channel(inner: fdomain_client::Channel) -> Self {
185 Self::new(inner)
186 }
187
188 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
189 self.client.into_channel().map_err(|client| Self { client })
190 }
191
192 fn as_channel(&self) -> &fdomain_client::Channel {
193 self.client.as_channel()
194 }
195}
196
197impl AddressStateProviderProxy {
198 pub fn new(channel: fdomain_client::Channel) -> Self {
200 let protocol_name =
201 <AddressStateProviderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
202 Self { client: fidl::client::Client::new(channel, protocol_name) }
203 }
204
205 pub fn take_event_stream(&self) -> AddressStateProviderEventStream {
211 AddressStateProviderEventStream { event_receiver: self.client.take_event_receiver() }
212 }
213
214 pub fn r#update_address_properties(
226 &self,
227 mut address_properties: &AddressProperties,
228 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
229 AddressStateProviderProxyInterface::r#update_address_properties(self, address_properties)
230 }
231
232 pub fn r#watch_address_assignment_state(
246 &self,
247 ) -> fidl::client::QueryResponseFut<
248 fdomain_fuchsia_net_interfaces::AddressAssignmentState,
249 fdomain_client::fidl::FDomainResourceDialect,
250 > {
251 AddressStateProviderProxyInterface::r#watch_address_assignment_state(self)
252 }
253
254 pub fn r#detach(&self) -> Result<(), fidl::Error> {
259 AddressStateProviderProxyInterface::r#detach(self)
260 }
261
262 pub fn r#remove(&self) -> Result<(), fidl::Error> {
267 AddressStateProviderProxyInterface::r#remove(self)
268 }
269}
270
271impl AddressStateProviderProxyInterface for AddressStateProviderProxy {
272 type UpdateAddressPropertiesResponseFut =
273 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
274 fn r#update_address_properties(
275 &self,
276 mut address_properties: &AddressProperties,
277 ) -> Self::UpdateAddressPropertiesResponseFut {
278 fn _decode(
279 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
280 ) -> Result<(), fidl::Error> {
281 let _response = fidl::client::decode_transaction_body::<
282 fidl::encoding::EmptyPayload,
283 fdomain_client::fidl::FDomainResourceDialect,
284 0x52bdf5ed96ef573c,
285 >(_buf?)?;
286 Ok(_response)
287 }
288 self.client.send_query_and_decode::<AddressStateProviderUpdateAddressPropertiesRequest, ()>(
289 (address_properties,),
290 0x52bdf5ed96ef573c,
291 fidl::encoding::DynamicFlags::empty(),
292 _decode,
293 )
294 }
295
296 type WatchAddressAssignmentStateResponseFut = fidl::client::QueryResponseFut<
297 fdomain_fuchsia_net_interfaces::AddressAssignmentState,
298 fdomain_client::fidl::FDomainResourceDialect,
299 >;
300 fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut {
301 fn _decode(
302 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
303 ) -> Result<fdomain_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error> {
304 let _response = fidl::client::decode_transaction_body::<
305 AddressStateProviderWatchAddressAssignmentStateResponse,
306 fdomain_client::fidl::FDomainResourceDialect,
307 0x740bb58c1b2d3188,
308 >(_buf?)?;
309 Ok(_response.assignment_state)
310 }
311 self.client.send_query_and_decode::<
312 fidl::encoding::EmptyPayload,
313 fdomain_fuchsia_net_interfaces::AddressAssignmentState,
314 >(
315 (),
316 0x740bb58c1b2d3188,
317 fidl::encoding::DynamicFlags::empty(),
318 _decode,
319 )
320 }
321
322 fn r#detach(&self) -> Result<(), fidl::Error> {
323 self.client.send::<fidl::encoding::EmptyPayload>(
324 (),
325 0xc752381d739622f,
326 fidl::encoding::DynamicFlags::empty(),
327 )
328 }
329
330 fn r#remove(&self) -> Result<(), fidl::Error> {
331 self.client.send::<fidl::encoding::EmptyPayload>(
332 (),
333 0x554407fe183e78ad,
334 fidl::encoding::DynamicFlags::empty(),
335 )
336 }
337}
338
339pub struct AddressStateProviderEventStream {
340 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
341}
342
343impl std::marker::Unpin for AddressStateProviderEventStream {}
344
345impl futures::stream::FusedStream for AddressStateProviderEventStream {
346 fn is_terminated(&self) -> bool {
347 self.event_receiver.is_terminated()
348 }
349}
350
351impl futures::Stream for AddressStateProviderEventStream {
352 type Item = Result<AddressStateProviderEvent, fidl::Error>;
353
354 fn poll_next(
355 mut self: std::pin::Pin<&mut Self>,
356 cx: &mut std::task::Context<'_>,
357 ) -> std::task::Poll<Option<Self::Item>> {
358 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
359 &mut self.event_receiver,
360 cx
361 )?) {
362 Some(buf) => std::task::Poll::Ready(Some(AddressStateProviderEvent::decode(buf))),
363 None => std::task::Poll::Ready(None),
364 }
365 }
366}
367
368#[derive(Debug)]
369pub enum AddressStateProviderEvent {
370 OnAddressAdded {},
371 OnAddressRemoved { error: AddressRemovalReason },
372}
373
374impl AddressStateProviderEvent {
375 #[allow(irrefutable_let_patterns)]
376 pub fn into_on_address_added(self) -> Option<()> {
377 if let AddressStateProviderEvent::OnAddressAdded {} = self { Some(()) } else { None }
378 }
379 #[allow(irrefutable_let_patterns)]
380 pub fn into_on_address_removed(self) -> Option<AddressRemovalReason> {
381 if let AddressStateProviderEvent::OnAddressRemoved { error } = self {
382 Some((error))
383 } else {
384 None
385 }
386 }
387
388 fn decode(
390 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
391 ) -> Result<AddressStateProviderEvent, fidl::Error> {
392 let (bytes, _handles) = buf.split_mut();
393 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
394 debug_assert_eq!(tx_header.tx_id, 0);
395 match tx_header.ordinal {
396 0x624f6ea62cce189e => {
397 let mut out = fidl::new_empty!(
398 fidl::encoding::EmptyPayload,
399 fdomain_client::fidl::FDomainResourceDialect
400 );
401 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
402 Ok((AddressStateProviderEvent::OnAddressAdded {}))
403 }
404 0x2480eb672ffd5962 => {
405 let mut out = fidl::new_empty!(
406 AddressStateProviderOnAddressRemovedRequest,
407 fdomain_client::fidl::FDomainResourceDialect
408 );
409 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<AddressStateProviderOnAddressRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
410 Ok((AddressStateProviderEvent::OnAddressRemoved { error: out.error }))
411 }
412 _ => Err(fidl::Error::UnknownOrdinal {
413 ordinal: tx_header.ordinal,
414 protocol_name:
415 <AddressStateProviderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
416 }),
417 }
418 }
419}
420
421pub struct AddressStateProviderRequestStream {
423 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
424 is_terminated: bool,
425}
426
427impl std::marker::Unpin for AddressStateProviderRequestStream {}
428
429impl futures::stream::FusedStream for AddressStateProviderRequestStream {
430 fn is_terminated(&self) -> bool {
431 self.is_terminated
432 }
433}
434
435impl fdomain_client::fidl::RequestStream for AddressStateProviderRequestStream {
436 type Protocol = AddressStateProviderMarker;
437 type ControlHandle = AddressStateProviderControlHandle;
438
439 fn from_channel(channel: fdomain_client::Channel) -> Self {
440 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
441 }
442
443 fn control_handle(&self) -> Self::ControlHandle {
444 AddressStateProviderControlHandle { inner: self.inner.clone() }
445 }
446
447 fn into_inner(
448 self,
449 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
450 {
451 (self.inner, self.is_terminated)
452 }
453
454 fn from_inner(
455 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
456 is_terminated: bool,
457 ) -> Self {
458 Self { inner, is_terminated }
459 }
460}
461
462impl futures::Stream for AddressStateProviderRequestStream {
463 type Item = Result<AddressStateProviderRequest, fidl::Error>;
464
465 fn poll_next(
466 mut self: std::pin::Pin<&mut Self>,
467 cx: &mut std::task::Context<'_>,
468 ) -> std::task::Poll<Option<Self::Item>> {
469 let this = &mut *self;
470 if this.inner.check_shutdown(cx) {
471 this.is_terminated = true;
472 return std::task::Poll::Ready(None);
473 }
474 if this.is_terminated {
475 panic!("polled AddressStateProviderRequestStream after completion");
476 }
477 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
478 |bytes, handles| {
479 match this.inner.channel().read_etc(cx, bytes, handles) {
480 std::task::Poll::Ready(Ok(())) => {}
481 std::task::Poll::Pending => return std::task::Poll::Pending,
482 std::task::Poll::Ready(Err(None)) => {
483 this.is_terminated = true;
484 return std::task::Poll::Ready(None);
485 }
486 std::task::Poll::Ready(Err(Some(e))) => {
487 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
488 e.into(),
489 ))));
490 }
491 }
492
493 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
495
496 std::task::Poll::Ready(Some(match header.ordinal {
497 0x52bdf5ed96ef573c => {
498 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
499 let mut req = fidl::new_empty!(AddressStateProviderUpdateAddressPropertiesRequest, fdomain_client::fidl::FDomainResourceDialect);
500 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<AddressStateProviderUpdateAddressPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
501 let control_handle = AddressStateProviderControlHandle {
502 inner: this.inner.clone(),
503 };
504 Ok(AddressStateProviderRequest::UpdateAddressProperties {address_properties: req.address_properties,
505
506 responder: AddressStateProviderUpdateAddressPropertiesResponder {
507 control_handle: std::mem::ManuallyDrop::new(control_handle),
508 tx_id: header.tx_id,
509 },
510 })
511 }
512 0x740bb58c1b2d3188 => {
513 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
514 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
515 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
516 let control_handle = AddressStateProviderControlHandle {
517 inner: this.inner.clone(),
518 };
519 Ok(AddressStateProviderRequest::WatchAddressAssignmentState {
520 responder: AddressStateProviderWatchAddressAssignmentStateResponder {
521 control_handle: std::mem::ManuallyDrop::new(control_handle),
522 tx_id: header.tx_id,
523 },
524 })
525 }
526 0xc752381d739622f => {
527 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
528 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
529 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
530 let control_handle = AddressStateProviderControlHandle {
531 inner: this.inner.clone(),
532 };
533 Ok(AddressStateProviderRequest::Detach {
534 control_handle,
535 })
536 }
537 0x554407fe183e78ad => {
538 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
539 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
540 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
541 let control_handle = AddressStateProviderControlHandle {
542 inner: this.inner.clone(),
543 };
544 Ok(AddressStateProviderRequest::Remove {
545 control_handle,
546 })
547 }
548 _ => Err(fidl::Error::UnknownOrdinal {
549 ordinal: header.ordinal,
550 protocol_name: <AddressStateProviderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
551 }),
552 }))
553 },
554 )
555 }
556}
557
558#[derive(Debug)]
568pub enum AddressStateProviderRequest {
569 UpdateAddressProperties {
581 address_properties: AddressProperties,
582 responder: AddressStateProviderUpdateAddressPropertiesResponder,
583 },
584 WatchAddressAssignmentState {
598 responder: AddressStateProviderWatchAddressAssignmentStateResponder,
599 },
600 Detach { control_handle: AddressStateProviderControlHandle },
605 Remove { control_handle: AddressStateProviderControlHandle },
610}
611
612impl AddressStateProviderRequest {
613 #[allow(irrefutable_let_patterns)]
614 pub fn into_update_address_properties(
615 self,
616 ) -> Option<(AddressProperties, AddressStateProviderUpdateAddressPropertiesResponder)> {
617 if let AddressStateProviderRequest::UpdateAddressProperties {
618 address_properties,
619 responder,
620 } = self
621 {
622 Some((address_properties, responder))
623 } else {
624 None
625 }
626 }
627
628 #[allow(irrefutable_let_patterns)]
629 pub fn into_watch_address_assignment_state(
630 self,
631 ) -> Option<(AddressStateProviderWatchAddressAssignmentStateResponder)> {
632 if let AddressStateProviderRequest::WatchAddressAssignmentState { responder } = self {
633 Some((responder))
634 } else {
635 None
636 }
637 }
638
639 #[allow(irrefutable_let_patterns)]
640 pub fn into_detach(self) -> Option<(AddressStateProviderControlHandle)> {
641 if let AddressStateProviderRequest::Detach { control_handle } = self {
642 Some((control_handle))
643 } else {
644 None
645 }
646 }
647
648 #[allow(irrefutable_let_patterns)]
649 pub fn into_remove(self) -> Option<(AddressStateProviderControlHandle)> {
650 if let AddressStateProviderRequest::Remove { control_handle } = self {
651 Some((control_handle))
652 } else {
653 None
654 }
655 }
656
657 pub fn method_name(&self) -> &'static str {
659 match *self {
660 AddressStateProviderRequest::UpdateAddressProperties { .. } => {
661 "update_address_properties"
662 }
663 AddressStateProviderRequest::WatchAddressAssignmentState { .. } => {
664 "watch_address_assignment_state"
665 }
666 AddressStateProviderRequest::Detach { .. } => "detach",
667 AddressStateProviderRequest::Remove { .. } => "remove",
668 }
669 }
670}
671
672#[derive(Debug, Clone)]
673pub struct AddressStateProviderControlHandle {
674 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
675}
676
677impl fdomain_client::fidl::ControlHandle for AddressStateProviderControlHandle {
678 fn shutdown(&self) {
679 self.inner.shutdown()
680 }
681
682 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
683 self.inner.shutdown_with_epitaph(status)
684 }
685
686 fn is_closed(&self) -> bool {
687 self.inner.channel().is_closed()
688 }
689 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
690 self.inner.channel().on_closed()
691 }
692}
693
694impl AddressStateProviderControlHandle {
695 pub fn send_on_address_added(&self) -> Result<(), fidl::Error> {
696 self.inner.send::<fidl::encoding::EmptyPayload>(
697 (),
698 0,
699 0x624f6ea62cce189e,
700 fidl::encoding::DynamicFlags::empty(),
701 )
702 }
703
704 pub fn send_on_address_removed(
705 &self,
706 mut error: AddressRemovalReason,
707 ) -> Result<(), fidl::Error> {
708 self.inner.send::<AddressStateProviderOnAddressRemovedRequest>(
709 (error,),
710 0,
711 0x2480eb672ffd5962,
712 fidl::encoding::DynamicFlags::empty(),
713 )
714 }
715}
716
717#[must_use = "FIDL methods require a response to be sent"]
718#[derive(Debug)]
719pub struct AddressStateProviderUpdateAddressPropertiesResponder {
720 control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
721 tx_id: u32,
722}
723
724impl std::ops::Drop for AddressStateProviderUpdateAddressPropertiesResponder {
728 fn drop(&mut self) {
729 self.control_handle.shutdown();
730 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
732 }
733}
734
735impl fdomain_client::fidl::Responder for AddressStateProviderUpdateAddressPropertiesResponder {
736 type ControlHandle = AddressStateProviderControlHandle;
737
738 fn control_handle(&self) -> &AddressStateProviderControlHandle {
739 &self.control_handle
740 }
741
742 fn drop_without_shutdown(mut self) {
743 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
745 std::mem::forget(self);
747 }
748}
749
750impl AddressStateProviderUpdateAddressPropertiesResponder {
751 pub fn send(self) -> Result<(), fidl::Error> {
755 let _result = self.send_raw();
756 if _result.is_err() {
757 self.control_handle.shutdown();
758 }
759 self.drop_without_shutdown();
760 _result
761 }
762
763 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
765 let _result = self.send_raw();
766 self.drop_without_shutdown();
767 _result
768 }
769
770 fn send_raw(&self) -> Result<(), fidl::Error> {
771 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
772 (),
773 self.tx_id,
774 0x52bdf5ed96ef573c,
775 fidl::encoding::DynamicFlags::empty(),
776 )
777 }
778}
779
780#[must_use = "FIDL methods require a response to be sent"]
781#[derive(Debug)]
782pub struct AddressStateProviderWatchAddressAssignmentStateResponder {
783 control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
784 tx_id: u32,
785}
786
787impl std::ops::Drop for AddressStateProviderWatchAddressAssignmentStateResponder {
791 fn drop(&mut self) {
792 self.control_handle.shutdown();
793 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
795 }
796}
797
798impl fdomain_client::fidl::Responder for AddressStateProviderWatchAddressAssignmentStateResponder {
799 type ControlHandle = AddressStateProviderControlHandle;
800
801 fn control_handle(&self) -> &AddressStateProviderControlHandle {
802 &self.control_handle
803 }
804
805 fn drop_without_shutdown(mut self) {
806 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
808 std::mem::forget(self);
810 }
811}
812
813impl AddressStateProviderWatchAddressAssignmentStateResponder {
814 pub fn send(
818 self,
819 mut assignment_state: fdomain_fuchsia_net_interfaces::AddressAssignmentState,
820 ) -> Result<(), fidl::Error> {
821 let _result = self.send_raw(assignment_state);
822 if _result.is_err() {
823 self.control_handle.shutdown();
824 }
825 self.drop_without_shutdown();
826 _result
827 }
828
829 pub fn send_no_shutdown_on_err(
831 self,
832 mut assignment_state: fdomain_fuchsia_net_interfaces::AddressAssignmentState,
833 ) -> Result<(), fidl::Error> {
834 let _result = self.send_raw(assignment_state);
835 self.drop_without_shutdown();
836 _result
837 }
838
839 fn send_raw(
840 &self,
841 mut assignment_state: fdomain_fuchsia_net_interfaces::AddressAssignmentState,
842 ) -> Result<(), fidl::Error> {
843 self.control_handle.inner.send::<AddressStateProviderWatchAddressAssignmentStateResponse>(
844 (assignment_state,),
845 self.tx_id,
846 0x740bb58c1b2d3188,
847 fidl::encoding::DynamicFlags::empty(),
848 )
849 }
850}
851
852#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
853pub struct ControlMarker;
854
855impl fdomain_client::fidl::ProtocolMarker for ControlMarker {
856 type Proxy = ControlProxy;
857 type RequestStream = ControlRequestStream;
858
859 const DEBUG_NAME: &'static str = "(anonymous) Control";
860}
861pub type ControlRemoveAddressResult = Result<bool, ControlRemoveAddressError>;
862pub type ControlSetConfigurationResult = Result<Configuration, ControlSetConfigurationError>;
863pub type ControlGetConfigurationResult = Result<Configuration, ControlGetConfigurationError>;
864pub type ControlEnableResult = Result<bool, ControlEnableError>;
865pub type ControlDisableResult = Result<bool, ControlDisableError>;
866pub type ControlRemoveResult = Result<(), ControlRemoveError>;
867
868pub trait ControlProxyInterface: Send + Sync {
869 fn r#add_address(
870 &self,
871 address: &fdomain_fuchsia_net::Subnet,
872 parameters: &AddressParameters,
873 address_state_provider: fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
874 ) -> Result<(), fidl::Error>;
875 type RemoveAddressResponseFut: std::future::Future<Output = Result<ControlRemoveAddressResult, fidl::Error>>
876 + Send;
877 fn r#remove_address(
878 &self,
879 address: &fdomain_fuchsia_net::Subnet,
880 ) -> Self::RemoveAddressResponseFut;
881 type GetIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
882 fn r#get_id(&self) -> Self::GetIdResponseFut;
883 type SetConfigurationResponseFut: std::future::Future<Output = Result<ControlSetConfigurationResult, fidl::Error>>
884 + Send;
885 fn r#set_configuration(&self, config: &Configuration) -> Self::SetConfigurationResponseFut;
886 type GetConfigurationResponseFut: std::future::Future<Output = Result<ControlGetConfigurationResult, fidl::Error>>
887 + Send;
888 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
889 type EnableResponseFut: std::future::Future<Output = Result<ControlEnableResult, fidl::Error>>
890 + Send;
891 fn r#enable(&self) -> Self::EnableResponseFut;
892 type DisableResponseFut: std::future::Future<Output = Result<ControlDisableResult, fidl::Error>>
893 + Send;
894 fn r#disable(&self) -> Self::DisableResponseFut;
895 fn r#detach(&self) -> Result<(), fidl::Error>;
896 type GetAuthorizationForInterfaceResponseFut: std::future::Future<
897 Output = Result<
898 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
899 fidl::Error,
900 >,
901 > + Send;
902 fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut;
903 type RemoveResponseFut: std::future::Future<Output = Result<ControlRemoveResult, fidl::Error>>
904 + Send;
905 fn r#remove(&self) -> Self::RemoveResponseFut;
906}
907
908#[derive(Debug, Clone)]
909pub struct ControlProxy {
910 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
911}
912
913impl fdomain_client::fidl::Proxy for ControlProxy {
914 type Protocol = ControlMarker;
915
916 fn from_channel(inner: fdomain_client::Channel) -> Self {
917 Self::new(inner)
918 }
919
920 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
921 self.client.into_channel().map_err(|client| Self { client })
922 }
923
924 fn as_channel(&self) -> &fdomain_client::Channel {
925 self.client.as_channel()
926 }
927}
928
929impl ControlProxy {
930 pub fn new(channel: fdomain_client::Channel) -> Self {
932 let protocol_name = <ControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
933 Self { client: fidl::client::Client::new(channel, protocol_name) }
934 }
935
936 pub fn take_event_stream(&self) -> ControlEventStream {
942 ControlEventStream { event_receiver: self.client.take_event_receiver() }
943 }
944
945 pub fn r#add_address(
955 &self,
956 mut address: &fdomain_fuchsia_net::Subnet,
957 mut parameters: &AddressParameters,
958 mut address_state_provider: fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
959 ) -> Result<(), fidl::Error> {
960 ControlProxyInterface::r#add_address(self, address, parameters, address_state_provider)
961 }
962
963 pub fn r#remove_address(
969 &self,
970 mut address: &fdomain_fuchsia_net::Subnet,
971 ) -> fidl::client::QueryResponseFut<
972 ControlRemoveAddressResult,
973 fdomain_client::fidl::FDomainResourceDialect,
974 > {
975 ControlProxyInterface::r#remove_address(self, address)
976 }
977
978 pub fn r#get_id(
982 &self,
983 ) -> fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect> {
984 ControlProxyInterface::r#get_id(self)
985 }
986
987 pub fn r#set_configuration(
999 &self,
1000 mut config: &Configuration,
1001 ) -> fidl::client::QueryResponseFut<
1002 ControlSetConfigurationResult,
1003 fdomain_client::fidl::FDomainResourceDialect,
1004 > {
1005 ControlProxyInterface::r#set_configuration(self, config)
1006 }
1007
1008 pub fn r#get_configuration(
1017 &self,
1018 ) -> fidl::client::QueryResponseFut<
1019 ControlGetConfigurationResult,
1020 fdomain_client::fidl::FDomainResourceDialect,
1021 > {
1022 ControlProxyInterface::r#get_configuration(self)
1023 }
1024
1025 pub fn r#enable(
1030 &self,
1031 ) -> fidl::client::QueryResponseFut<
1032 ControlEnableResult,
1033 fdomain_client::fidl::FDomainResourceDialect,
1034 > {
1035 ControlProxyInterface::r#enable(self)
1036 }
1037
1038 pub fn r#disable(
1043 &self,
1044 ) -> fidl::client::QueryResponseFut<
1045 ControlDisableResult,
1046 fdomain_client::fidl::FDomainResourceDialect,
1047 > {
1048 ControlProxyInterface::r#disable(self)
1049 }
1050
1051 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1056 ControlProxyInterface::r#detach(self)
1057 }
1058
1059 pub fn r#get_authorization_for_interface(
1071 &self,
1072 ) -> fidl::client::QueryResponseFut<
1073 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
1074 fdomain_client::fidl::FDomainResourceDialect,
1075 > {
1076 ControlProxyInterface::r#get_authorization_for_interface(self)
1077 }
1078
1079 pub fn r#remove(
1085 &self,
1086 ) -> fidl::client::QueryResponseFut<
1087 ControlRemoveResult,
1088 fdomain_client::fidl::FDomainResourceDialect,
1089 > {
1090 ControlProxyInterface::r#remove(self)
1091 }
1092}
1093
1094impl ControlProxyInterface for ControlProxy {
1095 fn r#add_address(
1096 &self,
1097 mut address: &fdomain_fuchsia_net::Subnet,
1098 mut parameters: &AddressParameters,
1099 mut address_state_provider: fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
1100 ) -> Result<(), fidl::Error> {
1101 self.client.send::<ControlAddAddressRequest>(
1102 (address, parameters, address_state_provider),
1103 0x1349d36da453ce,
1104 fidl::encoding::DynamicFlags::empty(),
1105 )
1106 }
1107
1108 type RemoveAddressResponseFut = fidl::client::QueryResponseFut<
1109 ControlRemoveAddressResult,
1110 fdomain_client::fidl::FDomainResourceDialect,
1111 >;
1112 fn r#remove_address(
1113 &self,
1114 mut address: &fdomain_fuchsia_net::Subnet,
1115 ) -> Self::RemoveAddressResponseFut {
1116 fn _decode(
1117 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1118 ) -> Result<ControlRemoveAddressResult, fidl::Error> {
1119 let _response = fidl::client::decode_transaction_body::<
1120 fidl::encoding::ResultType<ControlRemoveAddressResponse, ControlRemoveAddressError>,
1121 fdomain_client::fidl::FDomainResourceDialect,
1122 0x213ba73da997a620,
1123 >(_buf?)?;
1124 Ok(_response.map(|x| x.did_remove))
1125 }
1126 self.client
1127 .send_query_and_decode::<ControlRemoveAddressRequest, ControlRemoveAddressResult>(
1128 (address,),
1129 0x213ba73da997a620,
1130 fidl::encoding::DynamicFlags::empty(),
1131 _decode,
1132 )
1133 }
1134
1135 type GetIdResponseFut =
1136 fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect>;
1137 fn r#get_id(&self) -> Self::GetIdResponseFut {
1138 fn _decode(
1139 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1140 ) -> Result<u64, fidl::Error> {
1141 let _response = fidl::client::decode_transaction_body::<
1142 ControlGetIdResponse,
1143 fdomain_client::fidl::FDomainResourceDialect,
1144 0x2a2459768d9ecc6f,
1145 >(_buf?)?;
1146 Ok(_response.id)
1147 }
1148 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
1149 (),
1150 0x2a2459768d9ecc6f,
1151 fidl::encoding::DynamicFlags::empty(),
1152 _decode,
1153 )
1154 }
1155
1156 type SetConfigurationResponseFut = fidl::client::QueryResponseFut<
1157 ControlSetConfigurationResult,
1158 fdomain_client::fidl::FDomainResourceDialect,
1159 >;
1160 fn r#set_configuration(&self, mut config: &Configuration) -> Self::SetConfigurationResponseFut {
1161 fn _decode(
1162 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1163 ) -> Result<ControlSetConfigurationResult, fidl::Error> {
1164 let _response = fidl::client::decode_transaction_body::<
1165 fidl::encoding::ResultType<
1166 ControlSetConfigurationResponse,
1167 ControlSetConfigurationError,
1168 >,
1169 fdomain_client::fidl::FDomainResourceDialect,
1170 0x573923b7b4bde27f,
1171 >(_buf?)?;
1172 Ok(_response.map(|x| x.previous_config))
1173 }
1174 self.client
1175 .send_query_and_decode::<ControlSetConfigurationRequest, ControlSetConfigurationResult>(
1176 (config,),
1177 0x573923b7b4bde27f,
1178 fidl::encoding::DynamicFlags::empty(),
1179 _decode,
1180 )
1181 }
1182
1183 type GetConfigurationResponseFut = fidl::client::QueryResponseFut<
1184 ControlGetConfigurationResult,
1185 fdomain_client::fidl::FDomainResourceDialect,
1186 >;
1187 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
1188 fn _decode(
1189 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1190 ) -> Result<ControlGetConfigurationResult, fidl::Error> {
1191 let _response = fidl::client::decode_transaction_body::<
1192 fidl::encoding::ResultType<
1193 ControlGetConfigurationResponse,
1194 ControlGetConfigurationError,
1195 >,
1196 fdomain_client::fidl::FDomainResourceDialect,
1197 0x5f5d239820bdcc65,
1198 >(_buf?)?;
1199 Ok(_response.map(|x| x.config))
1200 }
1201 self.client
1202 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControlGetConfigurationResult>(
1203 (),
1204 0x5f5d239820bdcc65,
1205 fidl::encoding::DynamicFlags::empty(),
1206 _decode,
1207 )
1208 }
1209
1210 type EnableResponseFut = fidl::client::QueryResponseFut<
1211 ControlEnableResult,
1212 fdomain_client::fidl::FDomainResourceDialect,
1213 >;
1214 fn r#enable(&self) -> Self::EnableResponseFut {
1215 fn _decode(
1216 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1217 ) -> Result<ControlEnableResult, fidl::Error> {
1218 let _response = fidl::client::decode_transaction_body::<
1219 fidl::encoding::ResultType<ControlEnableResponse, ControlEnableError>,
1220 fdomain_client::fidl::FDomainResourceDialect,
1221 0x15c983d3a8ac0b98,
1222 >(_buf?)?;
1223 Ok(_response.map(|x| x.did_enable))
1224 }
1225 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlEnableResult>(
1226 (),
1227 0x15c983d3a8ac0b98,
1228 fidl::encoding::DynamicFlags::empty(),
1229 _decode,
1230 )
1231 }
1232
1233 type DisableResponseFut = fidl::client::QueryResponseFut<
1234 ControlDisableResult,
1235 fdomain_client::fidl::FDomainResourceDialect,
1236 >;
1237 fn r#disable(&self) -> Self::DisableResponseFut {
1238 fn _decode(
1239 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1240 ) -> Result<ControlDisableResult, fidl::Error> {
1241 let _response = fidl::client::decode_transaction_body::<
1242 fidl::encoding::ResultType<ControlDisableResponse, ControlDisableError>,
1243 fdomain_client::fidl::FDomainResourceDialect,
1244 0x98d3a585d905473,
1245 >(_buf?)?;
1246 Ok(_response.map(|x| x.did_disable))
1247 }
1248 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlDisableResult>(
1249 (),
1250 0x98d3a585d905473,
1251 fidl::encoding::DynamicFlags::empty(),
1252 _decode,
1253 )
1254 }
1255
1256 fn r#detach(&self) -> Result<(), fidl::Error> {
1257 self.client.send::<fidl::encoding::EmptyPayload>(
1258 (),
1259 0x78ee27518b2dbfa,
1260 fidl::encoding::DynamicFlags::empty(),
1261 )
1262 }
1263
1264 type GetAuthorizationForInterfaceResponseFut = fidl::client::QueryResponseFut<
1265 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
1266 fdomain_client::fidl::FDomainResourceDialect,
1267 >;
1268 fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut {
1269 fn _decode(
1270 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1271 ) -> Result<fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization, fidl::Error>
1272 {
1273 let _response = fidl::client::decode_transaction_body::<
1274 ControlGetAuthorizationForInterfaceResponse,
1275 fdomain_client::fidl::FDomainResourceDialect,
1276 0xc1de2ab60b5cb9e,
1277 >(_buf?)?;
1278 Ok(_response.credential)
1279 }
1280 self.client.send_query_and_decode::<
1281 fidl::encoding::EmptyPayload,
1282 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
1283 >(
1284 (),
1285 0xc1de2ab60b5cb9e,
1286 fidl::encoding::DynamicFlags::empty(),
1287 _decode,
1288 )
1289 }
1290
1291 type RemoveResponseFut = fidl::client::QueryResponseFut<
1292 ControlRemoveResult,
1293 fdomain_client::fidl::FDomainResourceDialect,
1294 >;
1295 fn r#remove(&self) -> Self::RemoveResponseFut {
1296 fn _decode(
1297 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1298 ) -> Result<ControlRemoveResult, fidl::Error> {
1299 let _response = fidl::client::decode_transaction_body::<
1300 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControlRemoveError>,
1301 fdomain_client::fidl::FDomainResourceDialect,
1302 0x13aab8bbecc7ff0b,
1303 >(_buf?)?;
1304 Ok(_response.map(|x| x))
1305 }
1306 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlRemoveResult>(
1307 (),
1308 0x13aab8bbecc7ff0b,
1309 fidl::encoding::DynamicFlags::empty(),
1310 _decode,
1311 )
1312 }
1313}
1314
1315pub struct ControlEventStream {
1316 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1317}
1318
1319impl std::marker::Unpin for ControlEventStream {}
1320
1321impl futures::stream::FusedStream for ControlEventStream {
1322 fn is_terminated(&self) -> bool {
1323 self.event_receiver.is_terminated()
1324 }
1325}
1326
1327impl futures::Stream for ControlEventStream {
1328 type Item = Result<ControlEvent, fidl::Error>;
1329
1330 fn poll_next(
1331 mut self: std::pin::Pin<&mut Self>,
1332 cx: &mut std::task::Context<'_>,
1333 ) -> std::task::Poll<Option<Self::Item>> {
1334 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1335 &mut self.event_receiver,
1336 cx
1337 )?) {
1338 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1339 None => std::task::Poll::Ready(None),
1340 }
1341 }
1342}
1343
1344#[derive(Debug)]
1345pub enum ControlEvent {
1346 OnInterfaceRemoved { reason: InterfaceRemovedReason },
1347}
1348
1349impl ControlEvent {
1350 #[allow(irrefutable_let_patterns)]
1351 pub fn into_on_interface_removed(self) -> Option<InterfaceRemovedReason> {
1352 if let ControlEvent::OnInterfaceRemoved { reason } = self { Some((reason)) } else { None }
1353 }
1354
1355 fn decode(
1357 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1358 ) -> Result<ControlEvent, fidl::Error> {
1359 let (bytes, _handles) = buf.split_mut();
1360 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1361 debug_assert_eq!(tx_header.tx_id, 0);
1362 match tx_header.ordinal {
1363 0x800d39e76c1cddd => {
1364 let mut out = fidl::new_empty!(
1365 ControlOnInterfaceRemovedRequest,
1366 fdomain_client::fidl::FDomainResourceDialect
1367 );
1368 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ControlOnInterfaceRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1369 Ok((ControlEvent::OnInterfaceRemoved { reason: out.reason }))
1370 }
1371 _ => Err(fidl::Error::UnknownOrdinal {
1372 ordinal: tx_header.ordinal,
1373 protocol_name: <ControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1374 }),
1375 }
1376 }
1377}
1378
1379pub struct ControlRequestStream {
1381 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1382 is_terminated: bool,
1383}
1384
1385impl std::marker::Unpin for ControlRequestStream {}
1386
1387impl futures::stream::FusedStream for ControlRequestStream {
1388 fn is_terminated(&self) -> bool {
1389 self.is_terminated
1390 }
1391}
1392
1393impl fdomain_client::fidl::RequestStream for ControlRequestStream {
1394 type Protocol = ControlMarker;
1395 type ControlHandle = ControlControlHandle;
1396
1397 fn from_channel(channel: fdomain_client::Channel) -> Self {
1398 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1399 }
1400
1401 fn control_handle(&self) -> Self::ControlHandle {
1402 ControlControlHandle { inner: self.inner.clone() }
1403 }
1404
1405 fn into_inner(
1406 self,
1407 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1408 {
1409 (self.inner, self.is_terminated)
1410 }
1411
1412 fn from_inner(
1413 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1414 is_terminated: bool,
1415 ) -> Self {
1416 Self { inner, is_terminated }
1417 }
1418}
1419
1420impl futures::Stream for ControlRequestStream {
1421 type Item = Result<ControlRequest, fidl::Error>;
1422
1423 fn poll_next(
1424 mut self: std::pin::Pin<&mut Self>,
1425 cx: &mut std::task::Context<'_>,
1426 ) -> std::task::Poll<Option<Self::Item>> {
1427 let this = &mut *self;
1428 if this.inner.check_shutdown(cx) {
1429 this.is_terminated = true;
1430 return std::task::Poll::Ready(None);
1431 }
1432 if this.is_terminated {
1433 panic!("polled ControlRequestStream after completion");
1434 }
1435 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1436 |bytes, handles| {
1437 match this.inner.channel().read_etc(cx, bytes, handles) {
1438 std::task::Poll::Ready(Ok(())) => {}
1439 std::task::Poll::Pending => return std::task::Poll::Pending,
1440 std::task::Poll::Ready(Err(None)) => {
1441 this.is_terminated = true;
1442 return std::task::Poll::Ready(None);
1443 }
1444 std::task::Poll::Ready(Err(Some(e))) => {
1445 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1446 e.into(),
1447 ))));
1448 }
1449 }
1450
1451 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1453
1454 std::task::Poll::Ready(Some(match header.ordinal {
1455 0x1349d36da453ce => {
1456 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1457 let mut req = fidl::new_empty!(
1458 ControlAddAddressRequest,
1459 fdomain_client::fidl::FDomainResourceDialect
1460 );
1461 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ControlAddAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1462 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1463 Ok(ControlRequest::AddAddress {
1464 address: req.address,
1465 parameters: req.parameters,
1466 address_state_provider: req.address_state_provider,
1467
1468 control_handle,
1469 })
1470 }
1471 0x213ba73da997a620 => {
1472 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1473 let mut req = fidl::new_empty!(
1474 ControlRemoveAddressRequest,
1475 fdomain_client::fidl::FDomainResourceDialect
1476 );
1477 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ControlRemoveAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1478 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1479 Ok(ControlRequest::RemoveAddress {
1480 address: req.address,
1481
1482 responder: ControlRemoveAddressResponder {
1483 control_handle: std::mem::ManuallyDrop::new(control_handle),
1484 tx_id: header.tx_id,
1485 },
1486 })
1487 }
1488 0x2a2459768d9ecc6f => {
1489 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1490 let mut req = fidl::new_empty!(
1491 fidl::encoding::EmptyPayload,
1492 fdomain_client::fidl::FDomainResourceDialect
1493 );
1494 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1495 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1496 Ok(ControlRequest::GetId {
1497 responder: ControlGetIdResponder {
1498 control_handle: std::mem::ManuallyDrop::new(control_handle),
1499 tx_id: header.tx_id,
1500 },
1501 })
1502 }
1503 0x573923b7b4bde27f => {
1504 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1505 let mut req = fidl::new_empty!(
1506 ControlSetConfigurationRequest,
1507 fdomain_client::fidl::FDomainResourceDialect
1508 );
1509 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ControlSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1510 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1511 Ok(ControlRequest::SetConfiguration {
1512 config: req.config,
1513
1514 responder: ControlSetConfigurationResponder {
1515 control_handle: std::mem::ManuallyDrop::new(control_handle),
1516 tx_id: header.tx_id,
1517 },
1518 })
1519 }
1520 0x5f5d239820bdcc65 => {
1521 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1522 let mut req = fidl::new_empty!(
1523 fidl::encoding::EmptyPayload,
1524 fdomain_client::fidl::FDomainResourceDialect
1525 );
1526 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1527 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1528 Ok(ControlRequest::GetConfiguration {
1529 responder: ControlGetConfigurationResponder {
1530 control_handle: std::mem::ManuallyDrop::new(control_handle),
1531 tx_id: header.tx_id,
1532 },
1533 })
1534 }
1535 0x15c983d3a8ac0b98 => {
1536 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1537 let mut req = fidl::new_empty!(
1538 fidl::encoding::EmptyPayload,
1539 fdomain_client::fidl::FDomainResourceDialect
1540 );
1541 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1542 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1543 Ok(ControlRequest::Enable {
1544 responder: ControlEnableResponder {
1545 control_handle: std::mem::ManuallyDrop::new(control_handle),
1546 tx_id: header.tx_id,
1547 },
1548 })
1549 }
1550 0x98d3a585d905473 => {
1551 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1552 let mut req = fidl::new_empty!(
1553 fidl::encoding::EmptyPayload,
1554 fdomain_client::fidl::FDomainResourceDialect
1555 );
1556 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1557 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1558 Ok(ControlRequest::Disable {
1559 responder: ControlDisableResponder {
1560 control_handle: std::mem::ManuallyDrop::new(control_handle),
1561 tx_id: header.tx_id,
1562 },
1563 })
1564 }
1565 0x78ee27518b2dbfa => {
1566 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1567 let mut req = fidl::new_empty!(
1568 fidl::encoding::EmptyPayload,
1569 fdomain_client::fidl::FDomainResourceDialect
1570 );
1571 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1572 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1573 Ok(ControlRequest::Detach { control_handle })
1574 }
1575 0xc1de2ab60b5cb9e => {
1576 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1577 let mut req = fidl::new_empty!(
1578 fidl::encoding::EmptyPayload,
1579 fdomain_client::fidl::FDomainResourceDialect
1580 );
1581 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1582 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1583 Ok(ControlRequest::GetAuthorizationForInterface {
1584 responder: ControlGetAuthorizationForInterfaceResponder {
1585 control_handle: std::mem::ManuallyDrop::new(control_handle),
1586 tx_id: header.tx_id,
1587 },
1588 })
1589 }
1590 0x13aab8bbecc7ff0b => {
1591 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1592 let mut req = fidl::new_empty!(
1593 fidl::encoding::EmptyPayload,
1594 fdomain_client::fidl::FDomainResourceDialect
1595 );
1596 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1597 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1598 Ok(ControlRequest::Remove {
1599 responder: ControlRemoveResponder {
1600 control_handle: std::mem::ManuallyDrop::new(control_handle),
1601 tx_id: header.tx_id,
1602 },
1603 })
1604 }
1605 _ => Err(fidl::Error::UnknownOrdinal {
1606 ordinal: header.ordinal,
1607 protocol_name:
1608 <ControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1609 }),
1610 }))
1611 },
1612 )
1613 }
1614}
1615
1616#[derive(Debug)]
1626pub enum ControlRequest {
1627 AddAddress {
1637 address: fdomain_fuchsia_net::Subnet,
1638 parameters: AddressParameters,
1639 address_state_provider: fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
1640 control_handle: ControlControlHandle,
1641 },
1642 RemoveAddress { address: fdomain_fuchsia_net::Subnet, responder: ControlRemoveAddressResponder },
1648 GetId { responder: ControlGetIdResponder },
1652 SetConfiguration { config: Configuration, responder: ControlSetConfigurationResponder },
1664 GetConfiguration { responder: ControlGetConfigurationResponder },
1673 Enable { responder: ControlEnableResponder },
1678 Disable { responder: ControlDisableResponder },
1683 Detach { control_handle: ControlControlHandle },
1688 GetAuthorizationForInterface { responder: ControlGetAuthorizationForInterfaceResponder },
1700 Remove { responder: ControlRemoveResponder },
1706}
1707
1708impl ControlRequest {
1709 #[allow(irrefutable_let_patterns)]
1710 pub fn into_add_address(
1711 self,
1712 ) -> Option<(
1713 fdomain_fuchsia_net::Subnet,
1714 AddressParameters,
1715 fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
1716 ControlControlHandle,
1717 )> {
1718 if let ControlRequest::AddAddress {
1719 address,
1720 parameters,
1721 address_state_provider,
1722 control_handle,
1723 } = self
1724 {
1725 Some((address, parameters, address_state_provider, control_handle))
1726 } else {
1727 None
1728 }
1729 }
1730
1731 #[allow(irrefutable_let_patterns)]
1732 pub fn into_remove_address(
1733 self,
1734 ) -> Option<(fdomain_fuchsia_net::Subnet, ControlRemoveAddressResponder)> {
1735 if let ControlRequest::RemoveAddress { address, responder } = self {
1736 Some((address, responder))
1737 } else {
1738 None
1739 }
1740 }
1741
1742 #[allow(irrefutable_let_patterns)]
1743 pub fn into_get_id(self) -> Option<(ControlGetIdResponder)> {
1744 if let ControlRequest::GetId { responder } = self { Some((responder)) } else { None }
1745 }
1746
1747 #[allow(irrefutable_let_patterns)]
1748 pub fn into_set_configuration(
1749 self,
1750 ) -> Option<(Configuration, ControlSetConfigurationResponder)> {
1751 if let ControlRequest::SetConfiguration { config, responder } = self {
1752 Some((config, responder))
1753 } else {
1754 None
1755 }
1756 }
1757
1758 #[allow(irrefutable_let_patterns)]
1759 pub fn into_get_configuration(self) -> Option<(ControlGetConfigurationResponder)> {
1760 if let ControlRequest::GetConfiguration { responder } = self {
1761 Some((responder))
1762 } else {
1763 None
1764 }
1765 }
1766
1767 #[allow(irrefutable_let_patterns)]
1768 pub fn into_enable(self) -> Option<(ControlEnableResponder)> {
1769 if let ControlRequest::Enable { responder } = self { Some((responder)) } else { None }
1770 }
1771
1772 #[allow(irrefutable_let_patterns)]
1773 pub fn into_disable(self) -> Option<(ControlDisableResponder)> {
1774 if let ControlRequest::Disable { responder } = self { Some((responder)) } else { None }
1775 }
1776
1777 #[allow(irrefutable_let_patterns)]
1778 pub fn into_detach(self) -> Option<(ControlControlHandle)> {
1779 if let ControlRequest::Detach { control_handle } = self {
1780 Some((control_handle))
1781 } else {
1782 None
1783 }
1784 }
1785
1786 #[allow(irrefutable_let_patterns)]
1787 pub fn into_get_authorization_for_interface(
1788 self,
1789 ) -> Option<(ControlGetAuthorizationForInterfaceResponder)> {
1790 if let ControlRequest::GetAuthorizationForInterface { responder } = self {
1791 Some((responder))
1792 } else {
1793 None
1794 }
1795 }
1796
1797 #[allow(irrefutable_let_patterns)]
1798 pub fn into_remove(self) -> Option<(ControlRemoveResponder)> {
1799 if let ControlRequest::Remove { responder } = self { Some((responder)) } else { None }
1800 }
1801
1802 pub fn method_name(&self) -> &'static str {
1804 match *self {
1805 ControlRequest::AddAddress { .. } => "add_address",
1806 ControlRequest::RemoveAddress { .. } => "remove_address",
1807 ControlRequest::GetId { .. } => "get_id",
1808 ControlRequest::SetConfiguration { .. } => "set_configuration",
1809 ControlRequest::GetConfiguration { .. } => "get_configuration",
1810 ControlRequest::Enable { .. } => "enable",
1811 ControlRequest::Disable { .. } => "disable",
1812 ControlRequest::Detach { .. } => "detach",
1813 ControlRequest::GetAuthorizationForInterface { .. } => {
1814 "get_authorization_for_interface"
1815 }
1816 ControlRequest::Remove { .. } => "remove",
1817 }
1818 }
1819}
1820
1821#[derive(Debug, Clone)]
1822pub struct ControlControlHandle {
1823 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1824}
1825
1826impl fdomain_client::fidl::ControlHandle for ControlControlHandle {
1827 fn shutdown(&self) {
1828 self.inner.shutdown()
1829 }
1830
1831 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1832 self.inner.shutdown_with_epitaph(status)
1833 }
1834
1835 fn is_closed(&self) -> bool {
1836 self.inner.channel().is_closed()
1837 }
1838 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1839 self.inner.channel().on_closed()
1840 }
1841}
1842
1843impl ControlControlHandle {
1844 pub fn send_on_interface_removed(
1845 &self,
1846 mut reason: InterfaceRemovedReason,
1847 ) -> Result<(), fidl::Error> {
1848 self.inner.send::<ControlOnInterfaceRemovedRequest>(
1849 (reason,),
1850 0,
1851 0x800d39e76c1cddd,
1852 fidl::encoding::DynamicFlags::empty(),
1853 )
1854 }
1855}
1856
1857#[must_use = "FIDL methods require a response to be sent"]
1858#[derive(Debug)]
1859pub struct ControlRemoveAddressResponder {
1860 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1861 tx_id: u32,
1862}
1863
1864impl std::ops::Drop for ControlRemoveAddressResponder {
1868 fn drop(&mut self) {
1869 self.control_handle.shutdown();
1870 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1872 }
1873}
1874
1875impl fdomain_client::fidl::Responder for ControlRemoveAddressResponder {
1876 type ControlHandle = ControlControlHandle;
1877
1878 fn control_handle(&self) -> &ControlControlHandle {
1879 &self.control_handle
1880 }
1881
1882 fn drop_without_shutdown(mut self) {
1883 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1885 std::mem::forget(self);
1887 }
1888}
1889
1890impl ControlRemoveAddressResponder {
1891 pub fn send(
1895 self,
1896 mut result: Result<bool, ControlRemoveAddressError>,
1897 ) -> Result<(), fidl::Error> {
1898 let _result = self.send_raw(result);
1899 if _result.is_err() {
1900 self.control_handle.shutdown();
1901 }
1902 self.drop_without_shutdown();
1903 _result
1904 }
1905
1906 pub fn send_no_shutdown_on_err(
1908 self,
1909 mut result: Result<bool, ControlRemoveAddressError>,
1910 ) -> Result<(), fidl::Error> {
1911 let _result = self.send_raw(result);
1912 self.drop_without_shutdown();
1913 _result
1914 }
1915
1916 fn send_raw(
1917 &self,
1918 mut result: Result<bool, ControlRemoveAddressError>,
1919 ) -> Result<(), fidl::Error> {
1920 self.control_handle.inner.send::<fidl::encoding::ResultType<
1921 ControlRemoveAddressResponse,
1922 ControlRemoveAddressError,
1923 >>(
1924 result.map(|did_remove| (did_remove,)),
1925 self.tx_id,
1926 0x213ba73da997a620,
1927 fidl::encoding::DynamicFlags::empty(),
1928 )
1929 }
1930}
1931
1932#[must_use = "FIDL methods require a response to be sent"]
1933#[derive(Debug)]
1934pub struct ControlGetIdResponder {
1935 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1936 tx_id: u32,
1937}
1938
1939impl std::ops::Drop for ControlGetIdResponder {
1943 fn drop(&mut self) {
1944 self.control_handle.shutdown();
1945 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1947 }
1948}
1949
1950impl fdomain_client::fidl::Responder for ControlGetIdResponder {
1951 type ControlHandle = ControlControlHandle;
1952
1953 fn control_handle(&self) -> &ControlControlHandle {
1954 &self.control_handle
1955 }
1956
1957 fn drop_without_shutdown(mut self) {
1958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1960 std::mem::forget(self);
1962 }
1963}
1964
1965impl ControlGetIdResponder {
1966 pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
1970 let _result = self.send_raw(id);
1971 if _result.is_err() {
1972 self.control_handle.shutdown();
1973 }
1974 self.drop_without_shutdown();
1975 _result
1976 }
1977
1978 pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
1980 let _result = self.send_raw(id);
1981 self.drop_without_shutdown();
1982 _result
1983 }
1984
1985 fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
1986 self.control_handle.inner.send::<ControlGetIdResponse>(
1987 (id,),
1988 self.tx_id,
1989 0x2a2459768d9ecc6f,
1990 fidl::encoding::DynamicFlags::empty(),
1991 )
1992 }
1993}
1994
1995#[must_use = "FIDL methods require a response to be sent"]
1996#[derive(Debug)]
1997pub struct ControlSetConfigurationResponder {
1998 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1999 tx_id: u32,
2000}
2001
2002impl std::ops::Drop for ControlSetConfigurationResponder {
2006 fn drop(&mut self) {
2007 self.control_handle.shutdown();
2008 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2010 }
2011}
2012
2013impl fdomain_client::fidl::Responder for ControlSetConfigurationResponder {
2014 type ControlHandle = ControlControlHandle;
2015
2016 fn control_handle(&self) -> &ControlControlHandle {
2017 &self.control_handle
2018 }
2019
2020 fn drop_without_shutdown(mut self) {
2021 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2023 std::mem::forget(self);
2025 }
2026}
2027
2028impl ControlSetConfigurationResponder {
2029 pub fn send(
2033 self,
2034 mut result: Result<&Configuration, ControlSetConfigurationError>,
2035 ) -> Result<(), fidl::Error> {
2036 let _result = self.send_raw(result);
2037 if _result.is_err() {
2038 self.control_handle.shutdown();
2039 }
2040 self.drop_without_shutdown();
2041 _result
2042 }
2043
2044 pub fn send_no_shutdown_on_err(
2046 self,
2047 mut result: Result<&Configuration, ControlSetConfigurationError>,
2048 ) -> Result<(), fidl::Error> {
2049 let _result = self.send_raw(result);
2050 self.drop_without_shutdown();
2051 _result
2052 }
2053
2054 fn send_raw(
2055 &self,
2056 mut result: Result<&Configuration, ControlSetConfigurationError>,
2057 ) -> Result<(), fidl::Error> {
2058 self.control_handle.inner.send::<fidl::encoding::ResultType<
2059 ControlSetConfigurationResponse,
2060 ControlSetConfigurationError,
2061 >>(
2062 result.map(|previous_config| (previous_config,)),
2063 self.tx_id,
2064 0x573923b7b4bde27f,
2065 fidl::encoding::DynamicFlags::empty(),
2066 )
2067 }
2068}
2069
2070#[must_use = "FIDL methods require a response to be sent"]
2071#[derive(Debug)]
2072pub struct ControlGetConfigurationResponder {
2073 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2074 tx_id: u32,
2075}
2076
2077impl std::ops::Drop for ControlGetConfigurationResponder {
2081 fn drop(&mut self) {
2082 self.control_handle.shutdown();
2083 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2085 }
2086}
2087
2088impl fdomain_client::fidl::Responder for ControlGetConfigurationResponder {
2089 type ControlHandle = ControlControlHandle;
2090
2091 fn control_handle(&self) -> &ControlControlHandle {
2092 &self.control_handle
2093 }
2094
2095 fn drop_without_shutdown(mut self) {
2096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2098 std::mem::forget(self);
2100 }
2101}
2102
2103impl ControlGetConfigurationResponder {
2104 pub fn send(
2108 self,
2109 mut result: Result<&Configuration, ControlGetConfigurationError>,
2110 ) -> Result<(), fidl::Error> {
2111 let _result = self.send_raw(result);
2112 if _result.is_err() {
2113 self.control_handle.shutdown();
2114 }
2115 self.drop_without_shutdown();
2116 _result
2117 }
2118
2119 pub fn send_no_shutdown_on_err(
2121 self,
2122 mut result: Result<&Configuration, ControlGetConfigurationError>,
2123 ) -> Result<(), fidl::Error> {
2124 let _result = self.send_raw(result);
2125 self.drop_without_shutdown();
2126 _result
2127 }
2128
2129 fn send_raw(
2130 &self,
2131 mut result: Result<&Configuration, ControlGetConfigurationError>,
2132 ) -> Result<(), fidl::Error> {
2133 self.control_handle.inner.send::<fidl::encoding::ResultType<
2134 ControlGetConfigurationResponse,
2135 ControlGetConfigurationError,
2136 >>(
2137 result.map(|config| (config,)),
2138 self.tx_id,
2139 0x5f5d239820bdcc65,
2140 fidl::encoding::DynamicFlags::empty(),
2141 )
2142 }
2143}
2144
2145#[must_use = "FIDL methods require a response to be sent"]
2146#[derive(Debug)]
2147pub struct ControlEnableResponder {
2148 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2149 tx_id: u32,
2150}
2151
2152impl std::ops::Drop for ControlEnableResponder {
2156 fn drop(&mut self) {
2157 self.control_handle.shutdown();
2158 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2160 }
2161}
2162
2163impl fdomain_client::fidl::Responder for ControlEnableResponder {
2164 type ControlHandle = ControlControlHandle;
2165
2166 fn control_handle(&self) -> &ControlControlHandle {
2167 &self.control_handle
2168 }
2169
2170 fn drop_without_shutdown(mut self) {
2171 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2173 std::mem::forget(self);
2175 }
2176}
2177
2178impl ControlEnableResponder {
2179 pub fn send(self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2183 let _result = self.send_raw(result);
2184 if _result.is_err() {
2185 self.control_handle.shutdown();
2186 }
2187 self.drop_without_shutdown();
2188 _result
2189 }
2190
2191 pub fn send_no_shutdown_on_err(
2193 self,
2194 mut result: Result<bool, ControlEnableError>,
2195 ) -> Result<(), fidl::Error> {
2196 let _result = self.send_raw(result);
2197 self.drop_without_shutdown();
2198 _result
2199 }
2200
2201 fn send_raw(&self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2202 self.control_handle.inner.send::<fidl::encoding::ResultType<
2203 ControlEnableResponse,
2204 ControlEnableError,
2205 >>(
2206 result.map(|did_enable| (did_enable,)),
2207 self.tx_id,
2208 0x15c983d3a8ac0b98,
2209 fidl::encoding::DynamicFlags::empty(),
2210 )
2211 }
2212}
2213
2214#[must_use = "FIDL methods require a response to be sent"]
2215#[derive(Debug)]
2216pub struct ControlDisableResponder {
2217 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2218 tx_id: u32,
2219}
2220
2221impl std::ops::Drop for ControlDisableResponder {
2225 fn drop(&mut self) {
2226 self.control_handle.shutdown();
2227 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2229 }
2230}
2231
2232impl fdomain_client::fidl::Responder for ControlDisableResponder {
2233 type ControlHandle = ControlControlHandle;
2234
2235 fn control_handle(&self) -> &ControlControlHandle {
2236 &self.control_handle
2237 }
2238
2239 fn drop_without_shutdown(mut self) {
2240 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2242 std::mem::forget(self);
2244 }
2245}
2246
2247impl ControlDisableResponder {
2248 pub fn send(self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2252 let _result = self.send_raw(result);
2253 if _result.is_err() {
2254 self.control_handle.shutdown();
2255 }
2256 self.drop_without_shutdown();
2257 _result
2258 }
2259
2260 pub fn send_no_shutdown_on_err(
2262 self,
2263 mut result: Result<bool, ControlDisableError>,
2264 ) -> Result<(), fidl::Error> {
2265 let _result = self.send_raw(result);
2266 self.drop_without_shutdown();
2267 _result
2268 }
2269
2270 fn send_raw(&self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2271 self.control_handle.inner.send::<fidl::encoding::ResultType<
2272 ControlDisableResponse,
2273 ControlDisableError,
2274 >>(
2275 result.map(|did_disable| (did_disable,)),
2276 self.tx_id,
2277 0x98d3a585d905473,
2278 fidl::encoding::DynamicFlags::empty(),
2279 )
2280 }
2281}
2282
2283#[must_use = "FIDL methods require a response to be sent"]
2284#[derive(Debug)]
2285pub struct ControlGetAuthorizationForInterfaceResponder {
2286 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2287 tx_id: u32,
2288}
2289
2290impl std::ops::Drop for ControlGetAuthorizationForInterfaceResponder {
2294 fn drop(&mut self) {
2295 self.control_handle.shutdown();
2296 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2298 }
2299}
2300
2301impl fdomain_client::fidl::Responder for ControlGetAuthorizationForInterfaceResponder {
2302 type ControlHandle = ControlControlHandle;
2303
2304 fn control_handle(&self) -> &ControlControlHandle {
2305 &self.control_handle
2306 }
2307
2308 fn drop_without_shutdown(mut self) {
2309 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2311 std::mem::forget(self);
2313 }
2314}
2315
2316impl ControlGetAuthorizationForInterfaceResponder {
2317 pub fn send(
2321 self,
2322 mut credential: fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
2323 ) -> Result<(), fidl::Error> {
2324 let _result = self.send_raw(credential);
2325 if _result.is_err() {
2326 self.control_handle.shutdown();
2327 }
2328 self.drop_without_shutdown();
2329 _result
2330 }
2331
2332 pub fn send_no_shutdown_on_err(
2334 self,
2335 mut credential: fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
2336 ) -> Result<(), fidl::Error> {
2337 let _result = self.send_raw(credential);
2338 self.drop_without_shutdown();
2339 _result
2340 }
2341
2342 fn send_raw(
2343 &self,
2344 mut credential: fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
2345 ) -> Result<(), fidl::Error> {
2346 self.control_handle.inner.send::<ControlGetAuthorizationForInterfaceResponse>(
2347 (&mut credential,),
2348 self.tx_id,
2349 0xc1de2ab60b5cb9e,
2350 fidl::encoding::DynamicFlags::empty(),
2351 )
2352 }
2353}
2354
2355#[must_use = "FIDL methods require a response to be sent"]
2356#[derive(Debug)]
2357pub struct ControlRemoveResponder {
2358 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2359 tx_id: u32,
2360}
2361
2362impl std::ops::Drop for ControlRemoveResponder {
2366 fn drop(&mut self) {
2367 self.control_handle.shutdown();
2368 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2370 }
2371}
2372
2373impl fdomain_client::fidl::Responder for ControlRemoveResponder {
2374 type ControlHandle = ControlControlHandle;
2375
2376 fn control_handle(&self) -> &ControlControlHandle {
2377 &self.control_handle
2378 }
2379
2380 fn drop_without_shutdown(mut self) {
2381 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2383 std::mem::forget(self);
2385 }
2386}
2387
2388impl ControlRemoveResponder {
2389 pub fn send(self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2393 let _result = self.send_raw(result);
2394 if _result.is_err() {
2395 self.control_handle.shutdown();
2396 }
2397 self.drop_without_shutdown();
2398 _result
2399 }
2400
2401 pub fn send_no_shutdown_on_err(
2403 self,
2404 mut result: Result<(), ControlRemoveError>,
2405 ) -> Result<(), fidl::Error> {
2406 let _result = self.send_raw(result);
2407 self.drop_without_shutdown();
2408 _result
2409 }
2410
2411 fn send_raw(&self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2412 self.control_handle.inner.send::<fidl::encoding::ResultType<
2413 fidl::encoding::EmptyStruct,
2414 ControlRemoveError,
2415 >>(
2416 result,
2417 self.tx_id,
2418 0x13aab8bbecc7ff0b,
2419 fidl::encoding::DynamicFlags::empty(),
2420 )
2421 }
2422}
2423
2424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2425pub struct DeviceControlMarker;
2426
2427impl fdomain_client::fidl::ProtocolMarker for DeviceControlMarker {
2428 type Proxy = DeviceControlProxy;
2429 type RequestStream = DeviceControlRequestStream;
2430
2431 const DEBUG_NAME: &'static str = "(anonymous) DeviceControl";
2432}
2433
2434pub trait DeviceControlProxyInterface: Send + Sync {
2435 fn r#create_interface(
2436 &self,
2437 port: &fdomain_fuchsia_hardware_network::PortId,
2438 control: fdomain_client::fidl::ServerEnd<ControlMarker>,
2439 options: Options,
2440 ) -> Result<(), fidl::Error>;
2441 fn r#detach(&self) -> Result<(), fidl::Error>;
2442}
2443
2444#[derive(Debug, Clone)]
2445pub struct DeviceControlProxy {
2446 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2447}
2448
2449impl fdomain_client::fidl::Proxy for DeviceControlProxy {
2450 type Protocol = DeviceControlMarker;
2451
2452 fn from_channel(inner: fdomain_client::Channel) -> Self {
2453 Self::new(inner)
2454 }
2455
2456 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2457 self.client.into_channel().map_err(|client| Self { client })
2458 }
2459
2460 fn as_channel(&self) -> &fdomain_client::Channel {
2461 self.client.as_channel()
2462 }
2463}
2464
2465impl DeviceControlProxy {
2466 pub fn new(channel: fdomain_client::Channel) -> Self {
2468 let protocol_name =
2469 <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2470 Self { client: fidl::client::Client::new(channel, protocol_name) }
2471 }
2472
2473 pub fn take_event_stream(&self) -> DeviceControlEventStream {
2479 DeviceControlEventStream { event_receiver: self.client.take_event_receiver() }
2480 }
2481
2482 pub fn r#create_interface(
2487 &self,
2488 mut port: &fdomain_fuchsia_hardware_network::PortId,
2489 mut control: fdomain_client::fidl::ServerEnd<ControlMarker>,
2490 mut options: Options,
2491 ) -> Result<(), fidl::Error> {
2492 DeviceControlProxyInterface::r#create_interface(self, port, control, options)
2493 }
2494
2495 pub fn r#detach(&self) -> Result<(), fidl::Error> {
2502 DeviceControlProxyInterface::r#detach(self)
2503 }
2504}
2505
2506impl DeviceControlProxyInterface for DeviceControlProxy {
2507 fn r#create_interface(
2508 &self,
2509 mut port: &fdomain_fuchsia_hardware_network::PortId,
2510 mut control: fdomain_client::fidl::ServerEnd<ControlMarker>,
2511 mut options: Options,
2512 ) -> Result<(), fidl::Error> {
2513 self.client.send::<DeviceControlCreateInterfaceRequest>(
2514 (port, control, &mut options),
2515 0x4ff8be7351d12f86,
2516 fidl::encoding::DynamicFlags::empty(),
2517 )
2518 }
2519
2520 fn r#detach(&self) -> Result<(), fidl::Error> {
2521 self.client.send::<fidl::encoding::EmptyPayload>(
2522 (),
2523 0x57489f1554d489d2,
2524 fidl::encoding::DynamicFlags::empty(),
2525 )
2526 }
2527}
2528
2529pub struct DeviceControlEventStream {
2530 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2531}
2532
2533impl std::marker::Unpin for DeviceControlEventStream {}
2534
2535impl futures::stream::FusedStream for DeviceControlEventStream {
2536 fn is_terminated(&self) -> bool {
2537 self.event_receiver.is_terminated()
2538 }
2539}
2540
2541impl futures::Stream for DeviceControlEventStream {
2542 type Item = Result<DeviceControlEvent, fidl::Error>;
2543
2544 fn poll_next(
2545 mut self: std::pin::Pin<&mut Self>,
2546 cx: &mut std::task::Context<'_>,
2547 ) -> std::task::Poll<Option<Self::Item>> {
2548 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2549 &mut self.event_receiver,
2550 cx
2551 )?) {
2552 Some(buf) => std::task::Poll::Ready(Some(DeviceControlEvent::decode(buf))),
2553 None => std::task::Poll::Ready(None),
2554 }
2555 }
2556}
2557
2558#[derive(Debug)]
2559pub enum DeviceControlEvent {}
2560
2561impl DeviceControlEvent {
2562 fn decode(
2564 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2565 ) -> Result<DeviceControlEvent, fidl::Error> {
2566 let (bytes, _handles) = buf.split_mut();
2567 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2568 debug_assert_eq!(tx_header.tx_id, 0);
2569 match tx_header.ordinal {
2570 _ => Err(fidl::Error::UnknownOrdinal {
2571 ordinal: tx_header.ordinal,
2572 protocol_name:
2573 <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2574 }),
2575 }
2576 }
2577}
2578
2579pub struct DeviceControlRequestStream {
2581 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2582 is_terminated: bool,
2583}
2584
2585impl std::marker::Unpin for DeviceControlRequestStream {}
2586
2587impl futures::stream::FusedStream for DeviceControlRequestStream {
2588 fn is_terminated(&self) -> bool {
2589 self.is_terminated
2590 }
2591}
2592
2593impl fdomain_client::fidl::RequestStream for DeviceControlRequestStream {
2594 type Protocol = DeviceControlMarker;
2595 type ControlHandle = DeviceControlControlHandle;
2596
2597 fn from_channel(channel: fdomain_client::Channel) -> Self {
2598 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2599 }
2600
2601 fn control_handle(&self) -> Self::ControlHandle {
2602 DeviceControlControlHandle { inner: self.inner.clone() }
2603 }
2604
2605 fn into_inner(
2606 self,
2607 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2608 {
2609 (self.inner, self.is_terminated)
2610 }
2611
2612 fn from_inner(
2613 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2614 is_terminated: bool,
2615 ) -> Self {
2616 Self { inner, is_terminated }
2617 }
2618}
2619
2620impl futures::Stream for DeviceControlRequestStream {
2621 type Item = Result<DeviceControlRequest, fidl::Error>;
2622
2623 fn poll_next(
2624 mut self: std::pin::Pin<&mut Self>,
2625 cx: &mut std::task::Context<'_>,
2626 ) -> std::task::Poll<Option<Self::Item>> {
2627 let this = &mut *self;
2628 if this.inner.check_shutdown(cx) {
2629 this.is_terminated = true;
2630 return std::task::Poll::Ready(None);
2631 }
2632 if this.is_terminated {
2633 panic!("polled DeviceControlRequestStream after completion");
2634 }
2635 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2636 |bytes, handles| {
2637 match this.inner.channel().read_etc(cx, bytes, handles) {
2638 std::task::Poll::Ready(Ok(())) => {}
2639 std::task::Poll::Pending => return std::task::Poll::Pending,
2640 std::task::Poll::Ready(Err(None)) => {
2641 this.is_terminated = true;
2642 return std::task::Poll::Ready(None);
2643 }
2644 std::task::Poll::Ready(Err(Some(e))) => {
2645 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2646 e.into(),
2647 ))));
2648 }
2649 }
2650
2651 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2653
2654 std::task::Poll::Ready(Some(match header.ordinal {
2655 0x4ff8be7351d12f86 => {
2656 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2657 let mut req = fidl::new_empty!(DeviceControlCreateInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect);
2658 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DeviceControlCreateInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2659 let control_handle = DeviceControlControlHandle {
2660 inner: this.inner.clone(),
2661 };
2662 Ok(DeviceControlRequest::CreateInterface {port: req.port,
2663control: req.control,
2664options: req.options,
2665
2666 control_handle,
2667 })
2668 }
2669 0x57489f1554d489d2 => {
2670 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2671 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
2672 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2673 let control_handle = DeviceControlControlHandle {
2674 inner: this.inner.clone(),
2675 };
2676 Ok(DeviceControlRequest::Detach {
2677 control_handle,
2678 })
2679 }
2680 _ => Err(fidl::Error::UnknownOrdinal {
2681 ordinal: header.ordinal,
2682 protocol_name: <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2683 }),
2684 }))
2685 },
2686 )
2687 }
2688}
2689
2690#[derive(Debug)]
2713pub enum DeviceControlRequest {
2714 CreateInterface {
2719 port: fdomain_fuchsia_hardware_network::PortId,
2720 control: fdomain_client::fidl::ServerEnd<ControlMarker>,
2721 options: Options,
2722 control_handle: DeviceControlControlHandle,
2723 },
2724 Detach { control_handle: DeviceControlControlHandle },
2731}
2732
2733impl DeviceControlRequest {
2734 #[allow(irrefutable_let_patterns)]
2735 pub fn into_create_interface(
2736 self,
2737 ) -> Option<(
2738 fdomain_fuchsia_hardware_network::PortId,
2739 fdomain_client::fidl::ServerEnd<ControlMarker>,
2740 Options,
2741 DeviceControlControlHandle,
2742 )> {
2743 if let DeviceControlRequest::CreateInterface { port, control, options, control_handle } =
2744 self
2745 {
2746 Some((port, control, options, control_handle))
2747 } else {
2748 None
2749 }
2750 }
2751
2752 #[allow(irrefutable_let_patterns)]
2753 pub fn into_detach(self) -> Option<(DeviceControlControlHandle)> {
2754 if let DeviceControlRequest::Detach { control_handle } = self {
2755 Some((control_handle))
2756 } else {
2757 None
2758 }
2759 }
2760
2761 pub fn method_name(&self) -> &'static str {
2763 match *self {
2764 DeviceControlRequest::CreateInterface { .. } => "create_interface",
2765 DeviceControlRequest::Detach { .. } => "detach",
2766 }
2767 }
2768}
2769
2770#[derive(Debug, Clone)]
2771pub struct DeviceControlControlHandle {
2772 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2773}
2774
2775impl fdomain_client::fidl::ControlHandle for DeviceControlControlHandle {
2776 fn shutdown(&self) {
2777 self.inner.shutdown()
2778 }
2779
2780 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2781 self.inner.shutdown_with_epitaph(status)
2782 }
2783
2784 fn is_closed(&self) -> bool {
2785 self.inner.channel().is_closed()
2786 }
2787 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2788 self.inner.channel().on_closed()
2789 }
2790}
2791
2792impl DeviceControlControlHandle {}
2793
2794#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2795pub struct InstallerMarker;
2796
2797impl fdomain_client::fidl::ProtocolMarker for InstallerMarker {
2798 type Proxy = InstallerProxy;
2799 type RequestStream = InstallerRequestStream;
2800
2801 const DEBUG_NAME: &'static str = "fuchsia.net.interfaces.admin.Installer";
2802}
2803impl fdomain_client::fidl::DiscoverableProtocolMarker for InstallerMarker {}
2804
2805pub trait InstallerProxyInterface: Send + Sync {
2806 fn r#install_device(
2807 &self,
2808 device: fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
2809 device_control: fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
2810 ) -> Result<(), fidl::Error>;
2811 fn r#install_blackhole_interface(
2812 &self,
2813 interface: fdomain_client::fidl::ServerEnd<ControlMarker>,
2814 options: Options,
2815 ) -> Result<(), fidl::Error>;
2816}
2817
2818#[derive(Debug, Clone)]
2819pub struct InstallerProxy {
2820 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2821}
2822
2823impl fdomain_client::fidl::Proxy for InstallerProxy {
2824 type Protocol = InstallerMarker;
2825
2826 fn from_channel(inner: fdomain_client::Channel) -> Self {
2827 Self::new(inner)
2828 }
2829
2830 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2831 self.client.into_channel().map_err(|client| Self { client })
2832 }
2833
2834 fn as_channel(&self) -> &fdomain_client::Channel {
2835 self.client.as_channel()
2836 }
2837}
2838
2839impl InstallerProxy {
2840 pub fn new(channel: fdomain_client::Channel) -> Self {
2842 let protocol_name = <InstallerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2843 Self { client: fidl::client::Client::new(channel, protocol_name) }
2844 }
2845
2846 pub fn take_event_stream(&self) -> InstallerEventStream {
2852 InstallerEventStream { event_receiver: self.client.take_event_receiver() }
2853 }
2854
2855 pub fn r#install_device(
2860 &self,
2861 mut device: fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
2862 mut device_control: fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
2863 ) -> Result<(), fidl::Error> {
2864 InstallerProxyInterface::r#install_device(self, device, device_control)
2865 }
2866
2867 pub fn r#install_blackhole_interface(
2874 &self,
2875 mut interface: fdomain_client::fidl::ServerEnd<ControlMarker>,
2876 mut options: Options,
2877 ) -> Result<(), fidl::Error> {
2878 InstallerProxyInterface::r#install_blackhole_interface(self, interface, options)
2879 }
2880}
2881
2882impl InstallerProxyInterface for InstallerProxy {
2883 fn r#install_device(
2884 &self,
2885 mut device: fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
2886 mut device_control: fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
2887 ) -> Result<(), fidl::Error> {
2888 self.client.send::<InstallerInstallDeviceRequest>(
2889 (device, device_control),
2890 0x3e84524dcecab23a,
2891 fidl::encoding::DynamicFlags::empty(),
2892 )
2893 }
2894
2895 fn r#install_blackhole_interface(
2896 &self,
2897 mut interface: fdomain_client::fidl::ServerEnd<ControlMarker>,
2898 mut options: Options,
2899 ) -> Result<(), fidl::Error> {
2900 self.client.send::<InstallerInstallBlackholeInterfaceRequest>(
2901 (interface, &mut options),
2902 0x2ce57e87cdbcb809,
2903 fidl::encoding::DynamicFlags::empty(),
2904 )
2905 }
2906}
2907
2908pub struct InstallerEventStream {
2909 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2910}
2911
2912impl std::marker::Unpin for InstallerEventStream {}
2913
2914impl futures::stream::FusedStream for InstallerEventStream {
2915 fn is_terminated(&self) -> bool {
2916 self.event_receiver.is_terminated()
2917 }
2918}
2919
2920impl futures::Stream for InstallerEventStream {
2921 type Item = Result<InstallerEvent, fidl::Error>;
2922
2923 fn poll_next(
2924 mut self: std::pin::Pin<&mut Self>,
2925 cx: &mut std::task::Context<'_>,
2926 ) -> std::task::Poll<Option<Self::Item>> {
2927 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2928 &mut self.event_receiver,
2929 cx
2930 )?) {
2931 Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
2932 None => std::task::Poll::Ready(None),
2933 }
2934 }
2935}
2936
2937#[derive(Debug)]
2938pub enum InstallerEvent {}
2939
2940impl InstallerEvent {
2941 fn decode(
2943 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2944 ) -> Result<InstallerEvent, fidl::Error> {
2945 let (bytes, _handles) = buf.split_mut();
2946 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2947 debug_assert_eq!(tx_header.tx_id, 0);
2948 match tx_header.ordinal {
2949 _ => Err(fidl::Error::UnknownOrdinal {
2950 ordinal: tx_header.ordinal,
2951 protocol_name:
2952 <InstallerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2953 }),
2954 }
2955 }
2956}
2957
2958pub struct InstallerRequestStream {
2960 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2961 is_terminated: bool,
2962}
2963
2964impl std::marker::Unpin for InstallerRequestStream {}
2965
2966impl futures::stream::FusedStream for InstallerRequestStream {
2967 fn is_terminated(&self) -> bool {
2968 self.is_terminated
2969 }
2970}
2971
2972impl fdomain_client::fidl::RequestStream for InstallerRequestStream {
2973 type Protocol = InstallerMarker;
2974 type ControlHandle = InstallerControlHandle;
2975
2976 fn from_channel(channel: fdomain_client::Channel) -> Self {
2977 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2978 }
2979
2980 fn control_handle(&self) -> Self::ControlHandle {
2981 InstallerControlHandle { inner: self.inner.clone() }
2982 }
2983
2984 fn into_inner(
2985 self,
2986 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2987 {
2988 (self.inner, self.is_terminated)
2989 }
2990
2991 fn from_inner(
2992 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2993 is_terminated: bool,
2994 ) -> Self {
2995 Self { inner, is_terminated }
2996 }
2997}
2998
2999impl futures::Stream for InstallerRequestStream {
3000 type Item = Result<InstallerRequest, fidl::Error>;
3001
3002 fn poll_next(
3003 mut self: std::pin::Pin<&mut Self>,
3004 cx: &mut std::task::Context<'_>,
3005 ) -> std::task::Poll<Option<Self::Item>> {
3006 let this = &mut *self;
3007 if this.inner.check_shutdown(cx) {
3008 this.is_terminated = true;
3009 return std::task::Poll::Ready(None);
3010 }
3011 if this.is_terminated {
3012 panic!("polled InstallerRequestStream after completion");
3013 }
3014 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3015 |bytes, handles| {
3016 match this.inner.channel().read_etc(cx, bytes, handles) {
3017 std::task::Poll::Ready(Ok(())) => {}
3018 std::task::Poll::Pending => return std::task::Poll::Pending,
3019 std::task::Poll::Ready(Err(None)) => {
3020 this.is_terminated = true;
3021 return std::task::Poll::Ready(None);
3022 }
3023 std::task::Poll::Ready(Err(Some(e))) => {
3024 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3025 e.into(),
3026 ))));
3027 }
3028 }
3029
3030 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3032
3033 std::task::Poll::Ready(Some(match header.ordinal {
3034 0x3e84524dcecab23a => {
3035 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3036 let mut req = fidl::new_empty!(
3037 InstallerInstallDeviceRequest,
3038 fdomain_client::fidl::FDomainResourceDialect
3039 );
3040 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerInstallDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3041 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3042 Ok(InstallerRequest::InstallDevice {
3043 device: req.device,
3044 device_control: req.device_control,
3045
3046 control_handle,
3047 })
3048 }
3049 0x2ce57e87cdbcb809 => {
3050 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3051 let mut req = fidl::new_empty!(
3052 InstallerInstallBlackholeInterfaceRequest,
3053 fdomain_client::fidl::FDomainResourceDialect
3054 );
3055 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerInstallBlackholeInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3056 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3057 Ok(InstallerRequest::InstallBlackholeInterface {
3058 interface: req.interface,
3059 options: req.options,
3060
3061 control_handle,
3062 })
3063 }
3064 _ => Err(fidl::Error::UnknownOrdinal {
3065 ordinal: header.ordinal,
3066 protocol_name:
3067 <InstallerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3068 }),
3069 }))
3070 },
3071 )
3072 }
3073}
3074
3075#[derive(Debug)]
3077pub enum InstallerRequest {
3078 InstallDevice {
3083 device: fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
3084 device_control: fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
3085 control_handle: InstallerControlHandle,
3086 },
3087 InstallBlackholeInterface {
3094 interface: fdomain_client::fidl::ServerEnd<ControlMarker>,
3095 options: Options,
3096 control_handle: InstallerControlHandle,
3097 },
3098}
3099
3100impl InstallerRequest {
3101 #[allow(irrefutable_let_patterns)]
3102 pub fn into_install_device(
3103 self,
3104 ) -> Option<(
3105 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
3106 fdomain_client::fidl::ServerEnd<DeviceControlMarker>,
3107 InstallerControlHandle,
3108 )> {
3109 if let InstallerRequest::InstallDevice { device, device_control, control_handle } = self {
3110 Some((device, device_control, control_handle))
3111 } else {
3112 None
3113 }
3114 }
3115
3116 #[allow(irrefutable_let_patterns)]
3117 pub fn into_install_blackhole_interface(
3118 self,
3119 ) -> Option<(fdomain_client::fidl::ServerEnd<ControlMarker>, Options, InstallerControlHandle)>
3120 {
3121 if let InstallerRequest::InstallBlackholeInterface { interface, options, control_handle } =
3122 self
3123 {
3124 Some((interface, options, control_handle))
3125 } else {
3126 None
3127 }
3128 }
3129
3130 pub fn method_name(&self) -> &'static str {
3132 match *self {
3133 InstallerRequest::InstallDevice { .. } => "install_device",
3134 InstallerRequest::InstallBlackholeInterface { .. } => "install_blackhole_interface",
3135 }
3136 }
3137}
3138
3139#[derive(Debug, Clone)]
3140pub struct InstallerControlHandle {
3141 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3142}
3143
3144impl fdomain_client::fidl::ControlHandle for InstallerControlHandle {
3145 fn shutdown(&self) {
3146 self.inner.shutdown()
3147 }
3148
3149 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3150 self.inner.shutdown_with_epitaph(status)
3151 }
3152
3153 fn is_closed(&self) -> bool {
3154 self.inner.channel().is_closed()
3155 }
3156 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3157 self.inner.channel().on_closed()
3158 }
3159}
3160
3161impl InstallerControlHandle {}
3162
3163mod internal {
3164 use super::*;
3165
3166 impl fidl::encoding::ResourceTypeMarker for ControlAddAddressRequest {
3167 type Borrowed<'a> = &'a mut Self;
3168 fn take_or_borrow<'a>(
3169 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3170 ) -> Self::Borrowed<'a> {
3171 value
3172 }
3173 }
3174
3175 unsafe impl fidl::encoding::TypeMarker for ControlAddAddressRequest {
3176 type Owned = Self;
3177
3178 #[inline(always)]
3179 fn inline_align(_context: fidl::encoding::Context) -> usize {
3180 8
3181 }
3182
3183 #[inline(always)]
3184 fn inline_size(_context: fidl::encoding::Context) -> usize {
3185 48
3186 }
3187 }
3188
3189 unsafe impl
3190 fidl::encoding::Encode<
3191 ControlAddAddressRequest,
3192 fdomain_client::fidl::FDomainResourceDialect,
3193 > for &mut ControlAddAddressRequest
3194 {
3195 #[inline]
3196 unsafe fn encode(
3197 self,
3198 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3199 offset: usize,
3200 _depth: fidl::encoding::Depth,
3201 ) -> fidl::Result<()> {
3202 encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3203 fidl::encoding::Encode::<
3205 ControlAddAddressRequest,
3206 fdomain_client::fidl::FDomainResourceDialect,
3207 >::encode(
3208 (
3209 <fdomain_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
3210 &self.address,
3211 ),
3212 <AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(
3213 &self.parameters,
3214 ),
3215 <fidl::encoding::Endpoint<
3216 fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
3217 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3218 &mut self.address_state_provider,
3219 ),
3220 ),
3221 encoder,
3222 offset,
3223 _depth,
3224 )
3225 }
3226 }
3227 unsafe impl<
3228 T0: fidl::encoding::Encode<
3229 fdomain_fuchsia_net::Subnet,
3230 fdomain_client::fidl::FDomainResourceDialect,
3231 >,
3232 T1: fidl::encoding::Encode<AddressParameters, fdomain_client::fidl::FDomainResourceDialect>,
3233 T2: fidl::encoding::Encode<
3234 fidl::encoding::Endpoint<
3235 fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
3236 >,
3237 fdomain_client::fidl::FDomainResourceDialect,
3238 >,
3239 >
3240 fidl::encoding::Encode<
3241 ControlAddAddressRequest,
3242 fdomain_client::fidl::FDomainResourceDialect,
3243 > for (T0, T1, T2)
3244 {
3245 #[inline]
3246 unsafe fn encode(
3247 self,
3248 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3249 offset: usize,
3250 depth: fidl::encoding::Depth,
3251 ) -> fidl::Result<()> {
3252 encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3253 unsafe {
3256 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
3257 (ptr as *mut u64).write_unaligned(0);
3258 }
3259 self.0.encode(encoder, offset + 0, depth)?;
3261 self.1.encode(encoder, offset + 24, depth)?;
3262 self.2.encode(encoder, offset + 40, depth)?;
3263 Ok(())
3264 }
3265 }
3266
3267 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3268 for ControlAddAddressRequest
3269 {
3270 #[inline(always)]
3271 fn new_empty() -> Self {
3272 Self {
3273 address: fidl::new_empty!(
3274 fdomain_fuchsia_net::Subnet,
3275 fdomain_client::fidl::FDomainResourceDialect
3276 ),
3277 parameters: fidl::new_empty!(
3278 AddressParameters,
3279 fdomain_client::fidl::FDomainResourceDialect
3280 ),
3281 address_state_provider: fidl::new_empty!(
3282 fidl::encoding::Endpoint<
3283 fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
3284 >,
3285 fdomain_client::fidl::FDomainResourceDialect
3286 ),
3287 }
3288 }
3289
3290 #[inline]
3291 unsafe fn decode(
3292 &mut self,
3293 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3294 offset: usize,
3295 _depth: fidl::encoding::Depth,
3296 ) -> fidl::Result<()> {
3297 decoder.debug_check_bounds::<Self>(offset);
3298 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
3300 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3301 let mask = 0xffffffff00000000u64;
3302 let maskedval = padval & mask;
3303 if maskedval != 0 {
3304 return Err(fidl::Error::NonZeroPadding {
3305 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
3306 });
3307 }
3308 fidl::decode!(
3309 fdomain_fuchsia_net::Subnet,
3310 fdomain_client::fidl::FDomainResourceDialect,
3311 &mut self.address,
3312 decoder,
3313 offset + 0,
3314 _depth
3315 )?;
3316 fidl::decode!(
3317 AddressParameters,
3318 fdomain_client::fidl::FDomainResourceDialect,
3319 &mut self.parameters,
3320 decoder,
3321 offset + 24,
3322 _depth
3323 )?;
3324 fidl::decode!(
3325 fidl::encoding::Endpoint<
3326 fdomain_client::fidl::ServerEnd<AddressStateProviderMarker>,
3327 >,
3328 fdomain_client::fidl::FDomainResourceDialect,
3329 &mut self.address_state_provider,
3330 decoder,
3331 offset + 40,
3332 _depth
3333 )?;
3334 Ok(())
3335 }
3336 }
3337
3338 impl fidl::encoding::ResourceTypeMarker for ControlGetAuthorizationForInterfaceResponse {
3339 type Borrowed<'a> = &'a mut Self;
3340 fn take_or_borrow<'a>(
3341 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3342 ) -> Self::Borrowed<'a> {
3343 value
3344 }
3345 }
3346
3347 unsafe impl fidl::encoding::TypeMarker for ControlGetAuthorizationForInterfaceResponse {
3348 type Owned = Self;
3349
3350 #[inline(always)]
3351 fn inline_align(_context: fidl::encoding::Context) -> usize {
3352 8
3353 }
3354
3355 #[inline(always)]
3356 fn inline_size(_context: fidl::encoding::Context) -> usize {
3357 16
3358 }
3359 }
3360
3361 unsafe impl
3362 fidl::encoding::Encode<
3363 ControlGetAuthorizationForInterfaceResponse,
3364 fdomain_client::fidl::FDomainResourceDialect,
3365 > for &mut ControlGetAuthorizationForInterfaceResponse
3366 {
3367 #[inline]
3368 unsafe fn encode(
3369 self,
3370 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3371 offset: usize,
3372 _depth: fidl::encoding::Depth,
3373 ) -> fidl::Result<()> {
3374 encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
3375 fidl::encoding::Encode::<ControlGetAuthorizationForInterfaceResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
3377 (
3378 <fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
3379 ),
3380 encoder, offset, _depth
3381 )
3382 }
3383 }
3384 unsafe impl<
3385 T0: fidl::encoding::Encode<
3386 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
3387 fdomain_client::fidl::FDomainResourceDialect,
3388 >,
3389 >
3390 fidl::encoding::Encode<
3391 ControlGetAuthorizationForInterfaceResponse,
3392 fdomain_client::fidl::FDomainResourceDialect,
3393 > for (T0,)
3394 {
3395 #[inline]
3396 unsafe fn encode(
3397 self,
3398 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3399 offset: usize,
3400 depth: fidl::encoding::Depth,
3401 ) -> fidl::Result<()> {
3402 encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
3403 self.0.encode(encoder, offset + 0, depth)?;
3407 Ok(())
3408 }
3409 }
3410
3411 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3412 for ControlGetAuthorizationForInterfaceResponse
3413 {
3414 #[inline(always)]
3415 fn new_empty() -> Self {
3416 Self {
3417 credential: fidl::new_empty!(
3418 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
3419 fdomain_client::fidl::FDomainResourceDialect
3420 ),
3421 }
3422 }
3423
3424 #[inline]
3425 unsafe fn decode(
3426 &mut self,
3427 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3428 offset: usize,
3429 _depth: fidl::encoding::Depth,
3430 ) -> fidl::Result<()> {
3431 decoder.debug_check_bounds::<Self>(offset);
3432 fidl::decode!(
3434 fdomain_fuchsia_net_resources::GrantForInterfaceAuthorization,
3435 fdomain_client::fidl::FDomainResourceDialect,
3436 &mut self.credential,
3437 decoder,
3438 offset + 0,
3439 _depth
3440 )?;
3441 Ok(())
3442 }
3443 }
3444
3445 impl fidl::encoding::ResourceTypeMarker for DeviceControlCreateInterfaceRequest {
3446 type Borrowed<'a> = &'a mut Self;
3447 fn take_or_borrow<'a>(
3448 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3449 ) -> Self::Borrowed<'a> {
3450 value
3451 }
3452 }
3453
3454 unsafe impl fidl::encoding::TypeMarker for DeviceControlCreateInterfaceRequest {
3455 type Owned = Self;
3456
3457 #[inline(always)]
3458 fn inline_align(_context: fidl::encoding::Context) -> usize {
3459 8
3460 }
3461
3462 #[inline(always)]
3463 fn inline_size(_context: fidl::encoding::Context) -> usize {
3464 24
3465 }
3466 }
3467
3468 unsafe impl
3469 fidl::encoding::Encode<
3470 DeviceControlCreateInterfaceRequest,
3471 fdomain_client::fidl::FDomainResourceDialect,
3472 > for &mut DeviceControlCreateInterfaceRequest
3473 {
3474 #[inline]
3475 unsafe fn encode(
3476 self,
3477 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3478 offset: usize,
3479 _depth: fidl::encoding::Depth,
3480 ) -> fidl::Result<()> {
3481 encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
3482 fidl::encoding::Encode::<DeviceControlCreateInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
3484 (
3485 <fdomain_fuchsia_hardware_network::PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3486 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
3487 <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
3488 ),
3489 encoder, offset, _depth
3490 )
3491 }
3492 }
3493 unsafe impl<
3494 T0: fidl::encoding::Encode<
3495 fdomain_fuchsia_hardware_network::PortId,
3496 fdomain_client::fidl::FDomainResourceDialect,
3497 >,
3498 T1: fidl::encoding::Encode<
3499 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3500 fdomain_client::fidl::FDomainResourceDialect,
3501 >,
3502 T2: fidl::encoding::Encode<Options, fdomain_client::fidl::FDomainResourceDialect>,
3503 >
3504 fidl::encoding::Encode<
3505 DeviceControlCreateInterfaceRequest,
3506 fdomain_client::fidl::FDomainResourceDialect,
3507 > for (T0, T1, T2)
3508 {
3509 #[inline]
3510 unsafe fn encode(
3511 self,
3512 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3513 offset: usize,
3514 depth: fidl::encoding::Depth,
3515 ) -> fidl::Result<()> {
3516 encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
3517 unsafe {
3520 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3521 (ptr as *mut u64).write_unaligned(0);
3522 }
3523 self.0.encode(encoder, offset + 0, depth)?;
3525 self.1.encode(encoder, offset + 4, depth)?;
3526 self.2.encode(encoder, offset + 8, depth)?;
3527 Ok(())
3528 }
3529 }
3530
3531 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3532 for DeviceControlCreateInterfaceRequest
3533 {
3534 #[inline(always)]
3535 fn new_empty() -> Self {
3536 Self {
3537 port: fidl::new_empty!(
3538 fdomain_fuchsia_hardware_network::PortId,
3539 fdomain_client::fidl::FDomainResourceDialect
3540 ),
3541 control: fidl::new_empty!(
3542 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3543 fdomain_client::fidl::FDomainResourceDialect
3544 ),
3545 options: fidl::new_empty!(Options, fdomain_client::fidl::FDomainResourceDialect),
3546 }
3547 }
3548
3549 #[inline]
3550 unsafe fn decode(
3551 &mut self,
3552 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3553 offset: usize,
3554 _depth: fidl::encoding::Depth,
3555 ) -> fidl::Result<()> {
3556 decoder.debug_check_bounds::<Self>(offset);
3557 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3559 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3560 let mask = 0xffff0000u64;
3561 let maskedval = padval & mask;
3562 if maskedval != 0 {
3563 return Err(fidl::Error::NonZeroPadding {
3564 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3565 });
3566 }
3567 fidl::decode!(
3568 fdomain_fuchsia_hardware_network::PortId,
3569 fdomain_client::fidl::FDomainResourceDialect,
3570 &mut self.port,
3571 decoder,
3572 offset + 0,
3573 _depth
3574 )?;
3575 fidl::decode!(
3576 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3577 fdomain_client::fidl::FDomainResourceDialect,
3578 &mut self.control,
3579 decoder,
3580 offset + 4,
3581 _depth
3582 )?;
3583 fidl::decode!(
3584 Options,
3585 fdomain_client::fidl::FDomainResourceDialect,
3586 &mut self.options,
3587 decoder,
3588 offset + 8,
3589 _depth
3590 )?;
3591 Ok(())
3592 }
3593 }
3594
3595 impl fidl::encoding::ResourceTypeMarker for InstallerInstallBlackholeInterfaceRequest {
3596 type Borrowed<'a> = &'a mut Self;
3597 fn take_or_borrow<'a>(
3598 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3599 ) -> Self::Borrowed<'a> {
3600 value
3601 }
3602 }
3603
3604 unsafe impl fidl::encoding::TypeMarker for InstallerInstallBlackholeInterfaceRequest {
3605 type Owned = Self;
3606
3607 #[inline(always)]
3608 fn inline_align(_context: fidl::encoding::Context) -> usize {
3609 8
3610 }
3611
3612 #[inline(always)]
3613 fn inline_size(_context: fidl::encoding::Context) -> usize {
3614 24
3615 }
3616 }
3617
3618 unsafe impl
3619 fidl::encoding::Encode<
3620 InstallerInstallBlackholeInterfaceRequest,
3621 fdomain_client::fidl::FDomainResourceDialect,
3622 > for &mut InstallerInstallBlackholeInterfaceRequest
3623 {
3624 #[inline]
3625 unsafe fn encode(
3626 self,
3627 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3628 offset: usize,
3629 _depth: fidl::encoding::Depth,
3630 ) -> fidl::Result<()> {
3631 encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
3632 fidl::encoding::Encode::<InstallerInstallBlackholeInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
3634 (
3635 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
3636 <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
3637 ),
3638 encoder, offset, _depth
3639 )
3640 }
3641 }
3642 unsafe impl<
3643 T0: fidl::encoding::Encode<
3644 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3645 fdomain_client::fidl::FDomainResourceDialect,
3646 >,
3647 T1: fidl::encoding::Encode<Options, fdomain_client::fidl::FDomainResourceDialect>,
3648 >
3649 fidl::encoding::Encode<
3650 InstallerInstallBlackholeInterfaceRequest,
3651 fdomain_client::fidl::FDomainResourceDialect,
3652 > for (T0, T1)
3653 {
3654 #[inline]
3655 unsafe fn encode(
3656 self,
3657 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3658 offset: usize,
3659 depth: fidl::encoding::Depth,
3660 ) -> fidl::Result<()> {
3661 encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
3662 unsafe {
3665 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3666 (ptr as *mut u64).write_unaligned(0);
3667 }
3668 self.0.encode(encoder, offset + 0, depth)?;
3670 self.1.encode(encoder, offset + 8, depth)?;
3671 Ok(())
3672 }
3673 }
3674
3675 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3676 for InstallerInstallBlackholeInterfaceRequest
3677 {
3678 #[inline(always)]
3679 fn new_empty() -> Self {
3680 Self {
3681 interface: fidl::new_empty!(
3682 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3683 fdomain_client::fidl::FDomainResourceDialect
3684 ),
3685 options: fidl::new_empty!(Options, fdomain_client::fidl::FDomainResourceDialect),
3686 }
3687 }
3688
3689 #[inline]
3690 unsafe fn decode(
3691 &mut self,
3692 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3693 offset: usize,
3694 _depth: fidl::encoding::Depth,
3695 ) -> fidl::Result<()> {
3696 decoder.debug_check_bounds::<Self>(offset);
3697 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3699 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3700 let mask = 0xffffffff00000000u64;
3701 let maskedval = padval & mask;
3702 if maskedval != 0 {
3703 return Err(fidl::Error::NonZeroPadding {
3704 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3705 });
3706 }
3707 fidl::decode!(
3708 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<ControlMarker>>,
3709 fdomain_client::fidl::FDomainResourceDialect,
3710 &mut self.interface,
3711 decoder,
3712 offset + 0,
3713 _depth
3714 )?;
3715 fidl::decode!(
3716 Options,
3717 fdomain_client::fidl::FDomainResourceDialect,
3718 &mut self.options,
3719 decoder,
3720 offset + 8,
3721 _depth
3722 )?;
3723 Ok(())
3724 }
3725 }
3726
3727 impl fidl::encoding::ResourceTypeMarker for InstallerInstallDeviceRequest {
3728 type Borrowed<'a> = &'a mut Self;
3729 fn take_or_borrow<'a>(
3730 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3731 ) -> Self::Borrowed<'a> {
3732 value
3733 }
3734 }
3735
3736 unsafe impl fidl::encoding::TypeMarker for InstallerInstallDeviceRequest {
3737 type Owned = Self;
3738
3739 #[inline(always)]
3740 fn inline_align(_context: fidl::encoding::Context) -> usize {
3741 4
3742 }
3743
3744 #[inline(always)]
3745 fn inline_size(_context: fidl::encoding::Context) -> usize {
3746 8
3747 }
3748 }
3749
3750 unsafe impl
3751 fidl::encoding::Encode<
3752 InstallerInstallDeviceRequest,
3753 fdomain_client::fidl::FDomainResourceDialect,
3754 > for &mut InstallerInstallDeviceRequest
3755 {
3756 #[inline]
3757 unsafe fn encode(
3758 self,
3759 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3760 offset: usize,
3761 _depth: fidl::encoding::Depth,
3762 ) -> fidl::Result<()> {
3763 encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
3764 fidl::encoding::Encode::<InstallerInstallDeviceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
3766 (
3767 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
3768 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DeviceControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_control),
3769 ),
3770 encoder, offset, _depth
3771 )
3772 }
3773 }
3774 unsafe impl<
3775 T0: fidl::encoding::Encode<
3776 fidl::encoding::Endpoint<
3777 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
3778 >,
3779 fdomain_client::fidl::FDomainResourceDialect,
3780 >,
3781 T1: fidl::encoding::Encode<
3782 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DeviceControlMarker>>,
3783 fdomain_client::fidl::FDomainResourceDialect,
3784 >,
3785 >
3786 fidl::encoding::Encode<
3787 InstallerInstallDeviceRequest,
3788 fdomain_client::fidl::FDomainResourceDialect,
3789 > for (T0, T1)
3790 {
3791 #[inline]
3792 unsafe fn encode(
3793 self,
3794 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3795 offset: usize,
3796 depth: fidl::encoding::Depth,
3797 ) -> fidl::Result<()> {
3798 encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
3799 self.0.encode(encoder, offset + 0, depth)?;
3803 self.1.encode(encoder, offset + 4, depth)?;
3804 Ok(())
3805 }
3806 }
3807
3808 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3809 for InstallerInstallDeviceRequest
3810 {
3811 #[inline(always)]
3812 fn new_empty() -> Self {
3813 Self {
3814 device: fidl::new_empty!(
3815 fidl::encoding::Endpoint<
3816 fdomain_client::fidl::ClientEnd<
3817 fdomain_fuchsia_hardware_network::DeviceMarker,
3818 >,
3819 >,
3820 fdomain_client::fidl::FDomainResourceDialect
3821 ),
3822 device_control: fidl::new_empty!(
3823 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DeviceControlMarker>>,
3824 fdomain_client::fidl::FDomainResourceDialect
3825 ),
3826 }
3827 }
3828
3829 #[inline]
3830 unsafe fn decode(
3831 &mut self,
3832 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3833 offset: usize,
3834 _depth: fidl::encoding::Depth,
3835 ) -> fidl::Result<()> {
3836 decoder.debug_check_bounds::<Self>(offset);
3837 fidl::decode!(
3839 fidl::encoding::Endpoint<
3840 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_hardware_network::DeviceMarker>,
3841 >,
3842 fdomain_client::fidl::FDomainResourceDialect,
3843 &mut self.device,
3844 decoder,
3845 offset + 0,
3846 _depth
3847 )?;
3848 fidl::decode!(
3849 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DeviceControlMarker>>,
3850 fdomain_client::fidl::FDomainResourceDialect,
3851 &mut self.device_control,
3852 decoder,
3853 offset + 4,
3854 _depth
3855 )?;
3856 Ok(())
3857 }
3858 }
3859
3860 impl Options {
3861 #[inline(always)]
3862 fn max_ordinal_present(&self) -> u64 {
3863 if let Some(_) = self.netstack_managed_routes_designation {
3864 return 3;
3865 }
3866 if let Some(_) = self.metric {
3867 return 2;
3868 }
3869 if let Some(_) = self.name {
3870 return 1;
3871 }
3872 0
3873 }
3874 }
3875
3876 impl fidl::encoding::ResourceTypeMarker for Options {
3877 type Borrowed<'a> = &'a mut Self;
3878 fn take_or_borrow<'a>(
3879 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3880 ) -> Self::Borrowed<'a> {
3881 value
3882 }
3883 }
3884
3885 unsafe impl fidl::encoding::TypeMarker for Options {
3886 type Owned = Self;
3887
3888 #[inline(always)]
3889 fn inline_align(_context: fidl::encoding::Context) -> usize {
3890 8
3891 }
3892
3893 #[inline(always)]
3894 fn inline_size(_context: fidl::encoding::Context) -> usize {
3895 16
3896 }
3897 }
3898
3899 unsafe impl fidl::encoding::Encode<Options, fdomain_client::fidl::FDomainResourceDialect>
3900 for &mut Options
3901 {
3902 unsafe fn encode(
3903 self,
3904 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3905 offset: usize,
3906 mut depth: fidl::encoding::Depth,
3907 ) -> fidl::Result<()> {
3908 encoder.debug_check_bounds::<Options>(offset);
3909 let max_ordinal: u64 = self.max_ordinal_present();
3911 encoder.write_num(max_ordinal, offset);
3912 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3913 if max_ordinal == 0 {
3915 return Ok(());
3916 }
3917 depth.increment()?;
3918 let envelope_size = 8;
3919 let bytes_len = max_ordinal as usize * envelope_size;
3920 #[allow(unused_variables)]
3921 let offset = encoder.out_of_line_offset(bytes_len);
3922 let mut _prev_end_offset: usize = 0;
3923 if 1 > max_ordinal {
3924 return Ok(());
3925 }
3926
3927 let cur_offset: usize = (1 - 1) * envelope_size;
3930
3931 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3933
3934 fidl::encoding::encode_in_envelope_optional::<
3939 fidl::encoding::BoundedString<15>,
3940 fdomain_client::fidl::FDomainResourceDialect,
3941 >(
3942 self.name.as_ref().map(
3943 <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow,
3944 ),
3945 encoder,
3946 offset + cur_offset,
3947 depth,
3948 )?;
3949
3950 _prev_end_offset = cur_offset + envelope_size;
3951 if 2 > max_ordinal {
3952 return Ok(());
3953 }
3954
3955 let cur_offset: usize = (2 - 1) * envelope_size;
3958
3959 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3961
3962 fidl::encoding::encode_in_envelope_optional::<
3967 u32,
3968 fdomain_client::fidl::FDomainResourceDialect,
3969 >(
3970 self.metric.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3971 encoder,
3972 offset + cur_offset,
3973 depth,
3974 )?;
3975
3976 _prev_end_offset = cur_offset + envelope_size;
3977 if 3 > max_ordinal {
3978 return Ok(());
3979 }
3980
3981 let cur_offset: usize = (3 - 1) * envelope_size;
3984
3985 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3987
3988 fidl::encoding::encode_in_envelope_optional::<NetstackManagedRoutesDesignation, fdomain_client::fidl::FDomainResourceDialect>(
3993 self.netstack_managed_routes_designation.as_mut().map(<NetstackManagedRoutesDesignation as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3994 encoder, offset + cur_offset, depth
3995 )?;
3996
3997 _prev_end_offset = cur_offset + envelope_size;
3998
3999 Ok(())
4000 }
4001 }
4002
4003 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for Options {
4004 #[inline(always)]
4005 fn new_empty() -> Self {
4006 Self::default()
4007 }
4008
4009 unsafe fn decode(
4010 &mut self,
4011 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4012 offset: usize,
4013 mut depth: fidl::encoding::Depth,
4014 ) -> fidl::Result<()> {
4015 decoder.debug_check_bounds::<Self>(offset);
4016 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4017 None => return Err(fidl::Error::NotNullable),
4018 Some(len) => len,
4019 };
4020 if len == 0 {
4022 return Ok(());
4023 };
4024 depth.increment()?;
4025 let envelope_size = 8;
4026 let bytes_len = len * envelope_size;
4027 let offset = decoder.out_of_line_offset(bytes_len)?;
4028 let mut _next_ordinal_to_read = 0;
4030 let mut next_offset = offset;
4031 let end_offset = offset + bytes_len;
4032 _next_ordinal_to_read += 1;
4033 if next_offset >= end_offset {
4034 return Ok(());
4035 }
4036
4037 while _next_ordinal_to_read < 1 {
4039 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4040 _next_ordinal_to_read += 1;
4041 next_offset += envelope_size;
4042 }
4043
4044 let next_out_of_line = decoder.next_out_of_line();
4045 let handles_before = decoder.remaining_handles();
4046 if let Some((inlined, num_bytes, num_handles)) =
4047 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4048 {
4049 let member_inline_size =
4050 <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(
4051 decoder.context,
4052 );
4053 if inlined != (member_inline_size <= 4) {
4054 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4055 }
4056 let inner_offset;
4057 let mut inner_depth = depth.clone();
4058 if inlined {
4059 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4060 inner_offset = next_offset;
4061 } else {
4062 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4063 inner_depth.increment()?;
4064 }
4065 let val_ref = self.name.get_or_insert_with(|| {
4066 fidl::new_empty!(
4067 fidl::encoding::BoundedString<15>,
4068 fdomain_client::fidl::FDomainResourceDialect
4069 )
4070 });
4071 fidl::decode!(
4072 fidl::encoding::BoundedString<15>,
4073 fdomain_client::fidl::FDomainResourceDialect,
4074 val_ref,
4075 decoder,
4076 inner_offset,
4077 inner_depth
4078 )?;
4079 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4080 {
4081 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4082 }
4083 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4084 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4085 }
4086 }
4087
4088 next_offset += envelope_size;
4089 _next_ordinal_to_read += 1;
4090 if next_offset >= end_offset {
4091 return Ok(());
4092 }
4093
4094 while _next_ordinal_to_read < 2 {
4096 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4097 _next_ordinal_to_read += 1;
4098 next_offset += envelope_size;
4099 }
4100
4101 let next_out_of_line = decoder.next_out_of_line();
4102 let handles_before = decoder.remaining_handles();
4103 if let Some((inlined, num_bytes, num_handles)) =
4104 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4105 {
4106 let member_inline_size =
4107 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4108 if inlined != (member_inline_size <= 4) {
4109 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4110 }
4111 let inner_offset;
4112 let mut inner_depth = depth.clone();
4113 if inlined {
4114 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4115 inner_offset = next_offset;
4116 } else {
4117 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4118 inner_depth.increment()?;
4119 }
4120 let val_ref = self.metric.get_or_insert_with(|| {
4121 fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect)
4122 });
4123 fidl::decode!(
4124 u32,
4125 fdomain_client::fidl::FDomainResourceDialect,
4126 val_ref,
4127 decoder,
4128 inner_offset,
4129 inner_depth
4130 )?;
4131 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4132 {
4133 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4134 }
4135 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4136 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4137 }
4138 }
4139
4140 next_offset += envelope_size;
4141 _next_ordinal_to_read += 1;
4142 if next_offset >= end_offset {
4143 return Ok(());
4144 }
4145
4146 while _next_ordinal_to_read < 3 {
4148 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4149 _next_ordinal_to_read += 1;
4150 next_offset += envelope_size;
4151 }
4152
4153 let next_out_of_line = decoder.next_out_of_line();
4154 let handles_before = decoder.remaining_handles();
4155 if let Some((inlined, num_bytes, num_handles)) =
4156 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4157 {
4158 let member_inline_size =
4159 <NetstackManagedRoutesDesignation as fidl::encoding::TypeMarker>::inline_size(
4160 decoder.context,
4161 );
4162 if inlined != (member_inline_size <= 4) {
4163 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4164 }
4165 let inner_offset;
4166 let mut inner_depth = depth.clone();
4167 if inlined {
4168 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4169 inner_offset = next_offset;
4170 } else {
4171 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4172 inner_depth.increment()?;
4173 }
4174 let val_ref = self.netstack_managed_routes_designation.get_or_insert_with(|| {
4175 fidl::new_empty!(
4176 NetstackManagedRoutesDesignation,
4177 fdomain_client::fidl::FDomainResourceDialect
4178 )
4179 });
4180 fidl::decode!(
4181 NetstackManagedRoutesDesignation,
4182 fdomain_client::fidl::FDomainResourceDialect,
4183 val_ref,
4184 decoder,
4185 inner_offset,
4186 inner_depth
4187 )?;
4188 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4189 {
4190 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4191 }
4192 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4193 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4194 }
4195 }
4196
4197 next_offset += envelope_size;
4198
4199 while next_offset < end_offset {
4201 _next_ordinal_to_read += 1;
4202 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4203 next_offset += envelope_size;
4204 }
4205
4206 Ok(())
4207 }
4208 }
4209
4210 impl fidl::encoding::ResourceTypeMarker for NetstackManagedRoutesDesignation {
4211 type Borrowed<'a> = &'a mut Self;
4212 fn take_or_borrow<'a>(
4213 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4214 ) -> Self::Borrowed<'a> {
4215 value
4216 }
4217 }
4218
4219 unsafe impl fidl::encoding::TypeMarker for NetstackManagedRoutesDesignation {
4220 type Owned = Self;
4221
4222 #[inline(always)]
4223 fn inline_align(_context: fidl::encoding::Context) -> usize {
4224 8
4225 }
4226
4227 #[inline(always)]
4228 fn inline_size(_context: fidl::encoding::Context) -> usize {
4229 16
4230 }
4231 }
4232
4233 unsafe impl
4234 fidl::encoding::Encode<
4235 NetstackManagedRoutesDesignation,
4236 fdomain_client::fidl::FDomainResourceDialect,
4237 > for &mut NetstackManagedRoutesDesignation
4238 {
4239 #[inline]
4240 unsafe fn encode(
4241 self,
4242 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4243 offset: usize,
4244 _depth: fidl::encoding::Depth,
4245 ) -> fidl::Result<()> {
4246 encoder.debug_check_bounds::<NetstackManagedRoutesDesignation>(offset);
4247 encoder.write_num::<u64>(self.ordinal(), offset);
4248 match self {
4249 NetstackManagedRoutesDesignation::Main(ref val) => {
4250 fidl::encoding::encode_in_envelope::<
4251 Empty,
4252 fdomain_client::fidl::FDomainResourceDialect,
4253 >(
4254 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4255 encoder,
4256 offset + 8,
4257 _depth,
4258 )
4259 }
4260 NetstackManagedRoutesDesignation::InterfaceLocal(ref val) => {
4261 fidl::encoding::encode_in_envelope::<
4262 Empty,
4263 fdomain_client::fidl::FDomainResourceDialect,
4264 >(
4265 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4266 encoder,
4267 offset + 8,
4268 _depth,
4269 )
4270 }
4271 NetstackManagedRoutesDesignation::__SourceBreaking { .. } => {
4272 Err(fidl::Error::UnknownUnionTag)
4273 }
4274 }
4275 }
4276 }
4277
4278 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4279 for NetstackManagedRoutesDesignation
4280 {
4281 #[inline(always)]
4282 fn new_empty() -> Self {
4283 Self::__SourceBreaking { unknown_ordinal: 0 }
4284 }
4285
4286 #[inline]
4287 unsafe fn decode(
4288 &mut self,
4289 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4290 offset: usize,
4291 mut depth: fidl::encoding::Depth,
4292 ) -> fidl::Result<()> {
4293 decoder.debug_check_bounds::<Self>(offset);
4294 #[allow(unused_variables)]
4295 let next_out_of_line = decoder.next_out_of_line();
4296 let handles_before = decoder.remaining_handles();
4297 let (ordinal, inlined, num_bytes, num_handles) =
4298 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4299
4300 let member_inline_size = match ordinal {
4301 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4302 2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4303 0 => return Err(fidl::Error::UnknownUnionTag),
4304 _ => num_bytes as usize,
4305 };
4306
4307 if inlined != (member_inline_size <= 4) {
4308 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4309 }
4310 let _inner_offset;
4311 if inlined {
4312 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4313 _inner_offset = offset + 8;
4314 } else {
4315 depth.increment()?;
4316 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4317 }
4318 match ordinal {
4319 1 => {
4320 #[allow(irrefutable_let_patterns)]
4321 if let NetstackManagedRoutesDesignation::Main(_) = self {
4322 } else {
4324 *self = NetstackManagedRoutesDesignation::Main(fidl::new_empty!(
4326 Empty,
4327 fdomain_client::fidl::FDomainResourceDialect
4328 ));
4329 }
4330 #[allow(irrefutable_let_patterns)]
4331 if let NetstackManagedRoutesDesignation::Main(ref mut val) = self {
4332 fidl::decode!(
4333 Empty,
4334 fdomain_client::fidl::FDomainResourceDialect,
4335 val,
4336 decoder,
4337 _inner_offset,
4338 depth
4339 )?;
4340 } else {
4341 unreachable!()
4342 }
4343 }
4344 2 => {
4345 #[allow(irrefutable_let_patterns)]
4346 if let NetstackManagedRoutesDesignation::InterfaceLocal(_) = self {
4347 } else {
4349 *self = NetstackManagedRoutesDesignation::InterfaceLocal(fidl::new_empty!(
4351 Empty,
4352 fdomain_client::fidl::FDomainResourceDialect
4353 ));
4354 }
4355 #[allow(irrefutable_let_patterns)]
4356 if let NetstackManagedRoutesDesignation::InterfaceLocal(ref mut val) = self {
4357 fidl::decode!(
4358 Empty,
4359 fdomain_client::fidl::FDomainResourceDialect,
4360 val,
4361 decoder,
4362 _inner_offset,
4363 depth
4364 )?;
4365 } else {
4366 unreachable!()
4367 }
4368 }
4369 #[allow(deprecated)]
4370 ordinal => {
4371 for _ in 0..num_handles {
4372 decoder.drop_next_handle()?;
4373 }
4374 *self = NetstackManagedRoutesDesignation::__SourceBreaking {
4375 unknown_ordinal: ordinal,
4376 };
4377 }
4378 }
4379 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4380 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4381 }
4382 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4383 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4384 }
4385 Ok(())
4386 }
4387 }
4388}