#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_NAME_LENGTH: u32 = 256;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceProxyServeControllerRequest {
pub req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceProxyServeControllerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceProxyServeDeviceRequest {
pub req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceProxyServeDeviceRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct EndpointConfig {
pub mtu: u16,
pub mac: Option<Box<fidl_fuchsia_net::MacAddress>>,
pub port_class: fidl_fuchsia_hardware_network::PortClass,
}
impl fidl::Persistable for EndpointConfig {}
#[derive(Clone, Debug, PartialEq)]
pub struct EndpointGetConfigResponse {
pub config: EndpointConfig,
}
impl fidl::Persistable for EndpointGetConfigResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointGetNameResponse {
pub name: String,
}
impl fidl::Persistable for EndpointGetNameResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointGetPortRequest {
pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EndpointGetPortRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointGetProxyRequest {
pub proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EndpointGetProxyRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct EndpointManagerCreateEndpointRequest {
pub name: String,
pub config: EndpointConfig,
}
impl fidl::Persistable for EndpointManagerCreateEndpointRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointManagerCreateEndpointResponse {
pub status: i32,
pub endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointManagerCreateEndpointResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointManagerGetEndpointRequest {
pub name: String,
}
impl fidl::Persistable for EndpointManagerGetEndpointRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointManagerGetEndpointResponse {
pub endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointManagerGetEndpointResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointManagerListEndpointsResponse {
pub endp: Vec<String>,
}
impl fidl::Persistable for EndpointManagerListEndpointsResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EndpointSetLinkUpRequest {
pub up: bool,
}
impl fidl::Persistable for EndpointSetLinkUpRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct EndpointSetup {
pub name: String,
pub config: Option<Box<EndpointConfig>>,
pub link_up: bool,
}
impl fidl::Persistable for EndpointSetup {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeEndpointReadResponse {
pub data: Vec<u8>,
pub dropped_frames: u64,
}
impl fidl::Persistable for FakeEndpointReadResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeEndpointWriteRequest {
pub data: Vec<u8>,
}
impl fidl::Persistable for FakeEndpointWriteRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LatencyConfig {
pub average: u64,
pub std_dev: u64,
}
impl fidl::Persistable for LatencyConfig {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkAttachEndpointRequest {
pub name: String,
}
impl fidl::Persistable for NetworkAttachEndpointRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NetworkAttachEndpointResponse {
pub status: i32,
}
impl fidl::Persistable for NetworkAttachEndpointResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkContextCloneRequest {
pub network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextCloneRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkContextGetEndpointManagerRequest {
pub endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextGetEndpointManagerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkContextGetNetworkManagerRequest {
pub net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextGetNetworkManagerRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkContextSetupRequest {
pub networks: Vec<NetworkSetup>,
}
impl fidl::Persistable for NetworkContextSetupRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkContextSetupResponse {
pub status: i32,
pub setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextSetupResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkCreateFakeEndpointRequest {
pub ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkCreateFakeEndpointRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkGetConfigResponse {
pub config: NetworkConfig,
}
impl fidl::Persistable for NetworkGetConfigResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkGetNameResponse {
pub name: String,
}
impl fidl::Persistable for NetworkGetNameResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkManagerCreateNetworkRequest {
pub name: String,
pub config: NetworkConfig,
}
impl fidl::Persistable for NetworkManagerCreateNetworkRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkManagerCreateNetworkResponse {
pub status: i32,
pub net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkManagerCreateNetworkResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkManagerGetNetworkRequest {
pub name: String,
}
impl fidl::Persistable for NetworkManagerGetNetworkRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkManagerGetNetworkResponse {
pub net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkManagerGetNetworkResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkManagerListNetworksResponse {
pub nets: Vec<String>,
}
impl fidl::Persistable for NetworkManagerListNetworksResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkRemoveEndpointRequest {
pub name: String,
}
impl fidl::Persistable for NetworkRemoveEndpointRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NetworkRemoveEndpointResponse {
pub status: i32,
}
impl fidl::Persistable for NetworkRemoveEndpointResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkSetConfigRequest {
pub config: NetworkConfig,
}
impl fidl::Persistable for NetworkSetConfigRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NetworkSetConfigResponse {
pub status: i32,
}
impl fidl::Persistable for NetworkSetConfigResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkSetup {
pub name: String,
pub config: NetworkConfig,
pub endpoints: Vec<EndpointSetup>,
}
impl fidl::Persistable for NetworkSetup {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NetworkStartCaptureRequest {
pub name: String,
}
impl fidl::Persistable for NetworkStartCaptureRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NetworkStartCaptureResponse {
pub status: i32,
}
impl fidl::Persistable for NetworkStartCaptureResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ReorderConfig {
pub store_buff: u32,
pub tick: u64,
}
impl fidl::Persistable for ReorderConfig {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NetworkConfig {
pub latency: Option<LatencyConfig>,
pub packet_loss: Option<LossConfig>,
pub reorder: Option<ReorderConfig>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for NetworkConfig {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum LossConfig {
RandomRate(u8),
}
impl LossConfig {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::RandomRate(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for LossConfig {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceProxy_Marker;
impl fidl::endpoints::ProtocolMarker for DeviceProxy_Marker {
type Proxy = DeviceProxy_Proxy;
type RequestStream = DeviceProxy_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceProxy_SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DeviceProxy_";
}
pub trait DeviceProxy_ProxyInterface: Send + Sync {
fn r#serve_controller(
&self,
req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
) -> Result<(), fidl::Error>;
fn r#serve_device(
&self,
req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceProxy_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceProxy_SynchronousProxy {
type Proxy = DeviceProxy_Proxy;
type Protocol = DeviceProxy_Marker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl DeviceProxy_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DeviceProxy_Event, fidl::Error> {
DeviceProxy_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#serve_controller(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceProxyServeControllerRequest>(
(req,),
0x326c17ad2d3879ee,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#serve_device(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceProxyServeDeviceRequest>(
(req,),
0x645dae2573613288,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeviceProxy_Proxy {
type Protocol = DeviceProxy_Marker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl DeviceProxy_Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceProxy_EventStream {
DeviceProxy_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#serve_controller(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
) -> Result<(), fidl::Error> {
DeviceProxy_ProxyInterface::r#serve_controller(self, req)
}
pub fn r#serve_device(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
) -> Result<(), fidl::Error> {
DeviceProxy_ProxyInterface::r#serve_device(self, req)
}
}
impl DeviceProxy_ProxyInterface for DeviceProxy_Proxy {
fn r#serve_controller(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceProxyServeControllerRequest>(
(req,),
0x326c17ad2d3879ee,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#serve_device(
&self,
mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceProxyServeDeviceRequest>(
(req,),
0x645dae2573613288,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DeviceProxy_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeviceProxy_EventStream {}
impl futures::stream::FusedStream for DeviceProxy_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceProxy_EventStream {
type Item = Result<DeviceProxy_Event, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(DeviceProxy_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceProxy_Event {}
impl DeviceProxy_Event {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeviceProxy_Event, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceProxy_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceProxy_RequestStream {}
impl futures::stream::FusedStream for DeviceProxy_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceProxy_RequestStream {
type Protocol = DeviceProxy_Marker;
type ControlHandle = DeviceProxy_ControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
DeviceProxy_ControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DeviceProxy_RequestStream {
type Item = Result<DeviceProxy_Request, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled DeviceProxy_RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x326c17ad2d3879ee => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DeviceProxyServeControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyServeControllerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
DeviceProxy_ControlHandle { inner: this.inner.clone() };
Ok(DeviceProxy_Request::ServeController { req: req.req, control_handle })
}
0x645dae2573613288 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DeviceProxyServeDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyServeDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
DeviceProxy_ControlHandle { inner: this.inner.clone() };
Ok(DeviceProxy_Request::ServeDevice { req: req.req, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeviceProxy_Request {
ServeController {
req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
control_handle: DeviceProxy_ControlHandle,
},
ServeDevice {
req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
control_handle: DeviceProxy_ControlHandle,
},
}
impl DeviceProxy_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_serve_controller(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
DeviceProxy_ControlHandle,
)> {
if let DeviceProxy_Request::ServeController { req, control_handle } = self {
Some((req, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_serve_device(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
DeviceProxy_ControlHandle,
)> {
if let DeviceProxy_Request::ServeDevice { req, control_handle } = self {
Some((req, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceProxy_Request::ServeController { .. } => "serve_controller",
DeviceProxy_Request::ServeDevice { .. } => "serve_device",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeviceProxy_ControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DeviceProxy_ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EndpointMarker;
impl fidl::endpoints::ProtocolMarker for EndpointMarker {
type Proxy = EndpointProxy;
type RequestStream = EndpointRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EndpointSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Endpoint";
}
pub trait EndpointProxyInterface: Send + Sync {
type GetConfigResponseFut: std::future::Future<Output = Result<EndpointConfig, fidl::Error>>
+ Send;
fn r#get_config(&self) -> Self::GetConfigResponseFut;
type GetNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_name(&self) -> Self::GetNameResponseFut;
type SetLinkUpResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#set_link_up(&self, up: bool) -> Self::SetLinkUpResponseFut;
fn r#get_port(
&self,
port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
) -> Result<(), fidl::Error>;
fn r#get_proxy_(
&self,
proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EndpointSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EndpointSynchronousProxy {
type Proxy = EndpointProxy;
type Protocol = EndpointMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl EndpointSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<EndpointEvent, fidl::Error> {
EndpointEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_config(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<EndpointConfig, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, EndpointGetConfigResponse>(
(),
0x3589f54aa3748539,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.config)
}
pub fn r#get_name(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, EndpointGetNameResponse>(
(),
0x7d69650823557aab,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.name)
}
pub fn r#set_link_up(
&self,
mut up: bool,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<EndpointSetLinkUpRequest, fidl::encoding::EmptyPayload>(
(up,),
0x4dde77de68d02e11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#get_port(
&self,
mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EndpointGetPortRequest>(
(port,),
0x68151e034eccc958,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_proxy_(
&self,
mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<EndpointGetProxyRequest>(
(proxy,),
0x476e5a57c4288ee9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct EndpointProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EndpointProxy {
type Protocol = EndpointMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl EndpointProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EndpointEventStream {
EndpointEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_config(
&self,
) -> fidl::client::QueryResponseFut<EndpointConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
{
EndpointProxyInterface::r#get_config(self)
}
pub fn r#get_name(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
EndpointProxyInterface::r#get_name(self)
}
pub fn r#set_link_up(
&self,
mut up: bool,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
EndpointProxyInterface::r#set_link_up(self, up)
}
pub fn r#get_port(
&self,
mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
) -> Result<(), fidl::Error> {
EndpointProxyInterface::r#get_port(self, port)
}
pub fn r#get_proxy_(
&self,
mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
) -> Result<(), fidl::Error> {
EndpointProxyInterface::r#get_proxy_(self, proxy)
}
}
impl EndpointProxyInterface for EndpointProxy {
type GetConfigResponseFut = fidl::client::QueryResponseFut<
EndpointConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_config(&self) -> Self::GetConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EndpointConfig, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
EndpointGetConfigResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3589f54aa3748539,
>(_buf?)?;
Ok(_response.config)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, EndpointConfig>(
(),
0x3589f54aa3748539,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetNameResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_name(&self) -> Self::GetNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
EndpointGetNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7d69650823557aab,
>(_buf?)?;
Ok(_response.name)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0x7d69650823557aab,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetLinkUpResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_link_up(&self, mut up: bool) -> Self::SetLinkUpResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4dde77de68d02e11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<EndpointSetLinkUpRequest, ()>(
(up,),
0x4dde77de68d02e11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#get_port(
&self,
mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EndpointGetPortRequest>(
(port,),
0x68151e034eccc958,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_proxy_(
&self,
mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<EndpointGetProxyRequest>(
(proxy,),
0x476e5a57c4288ee9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct EndpointEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EndpointEventStream {}
impl futures::stream::FusedStream for EndpointEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EndpointEventStream {
type Item = Result<EndpointEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(EndpointEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EndpointEvent {}
impl EndpointEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EndpointEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EndpointRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EndpointRequestStream {}
impl futures::stream::FusedStream for EndpointRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EndpointRequestStream {
type Protocol = EndpointMarker;
type ControlHandle = EndpointControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
EndpointControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for EndpointRequestStream {
type Item = Result<EndpointRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled EndpointRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3589f54aa3748539 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EndpointControlHandle { inner: this.inner.clone() };
Ok(EndpointRequest::GetConfig {
responder: EndpointGetConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7d69650823557aab => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EndpointControlHandle { inner: this.inner.clone() };
Ok(EndpointRequest::GetName {
responder: EndpointGetNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4dde77de68d02e11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EndpointSetLinkUpRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointSetLinkUpRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EndpointControlHandle { inner: this.inner.clone() };
Ok(EndpointRequest::SetLinkUp {
up: req.up,
responder: EndpointSetLinkUpResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x68151e034eccc958 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EndpointGetPortRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EndpointControlHandle { inner: this.inner.clone() };
Ok(EndpointRequest::GetPort { port: req.port, control_handle })
}
0x476e5a57c4288ee9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
EndpointGetProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointGetProxyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EndpointControlHandle { inner: this.inner.clone() };
Ok(EndpointRequest::GetProxy_ { proxy: req.proxy, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EndpointRequest {
GetConfig {
responder: EndpointGetConfigResponder,
},
GetName {
responder: EndpointGetNameResponder,
},
SetLinkUp {
up: bool,
responder: EndpointSetLinkUpResponder,
},
GetPort {
port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
control_handle: EndpointControlHandle,
},
GetProxy_ {
proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
control_handle: EndpointControlHandle,
},
}
impl EndpointRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_config(self) -> Option<(EndpointGetConfigResponder)> {
if let EndpointRequest::GetConfig { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_name(self) -> Option<(EndpointGetNameResponder)> {
if let EndpointRequest::GetName { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_link_up(self) -> Option<(bool, EndpointSetLinkUpResponder)> {
if let EndpointRequest::SetLinkUp { up, responder } = self {
Some((up, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_port(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
EndpointControlHandle,
)> {
if let EndpointRequest::GetPort { port, control_handle } = self {
Some((port, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_proxy_(
self,
) -> Option<(fidl::endpoints::ServerEnd<DeviceProxy_Marker>, EndpointControlHandle)> {
if let EndpointRequest::GetProxy_ { proxy, control_handle } = self {
Some((proxy, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EndpointRequest::GetConfig { .. } => "get_config",
EndpointRequest::GetName { .. } => "get_name",
EndpointRequest::SetLinkUp { .. } => "set_link_up",
EndpointRequest::GetPort { .. } => "get_port",
EndpointRequest::GetProxy_ { .. } => "get_proxy_",
}
}
}
#[derive(Debug, Clone)]
pub struct EndpointControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EndpointControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl EndpointControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointGetConfigResponder {
control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointGetConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointGetConfigResponder {
type ControlHandle = EndpointControlHandle;
fn control_handle(&self) -> &EndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointGetConfigResponder {
pub fn send(self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<EndpointGetConfigResponse>(
(config,),
self.tx_id,
0x3589f54aa3748539,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointGetNameResponder {
control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointGetNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointGetNameResponder {
type ControlHandle = EndpointControlHandle;
fn control_handle(&self) -> &EndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointGetNameResponder {
pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(name);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(name);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<EndpointGetNameResponse>(
(name,),
self.tx_id,
0x7d69650823557aab,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointSetLinkUpResponder {
control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointSetLinkUpResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointSetLinkUpResponder {
type ControlHandle = EndpointControlHandle;
fn control_handle(&self) -> &EndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointSetLinkUpResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x4dde77de68d02e11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EndpointManagerMarker;
impl fidl::endpoints::ProtocolMarker for EndpointManagerMarker {
type Proxy = EndpointManagerProxy;
type RequestStream = EndpointManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EndpointManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) EndpointManager";
}
pub trait EndpointManagerProxyInterface: Send + Sync {
type ListEndpointsResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
+ Send;
fn r#list_endpoints(&self) -> Self::ListEndpointsResponseFut;
type CreateEndpointResponseFut: std::future::Future<
Output = Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error>,
> + Send;
fn r#create_endpoint(
&self,
name: &str,
config: &EndpointConfig,
) -> Self::CreateEndpointResponseFut;
type GetEndpointResponseFut: std::future::Future<
Output = Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error>,
> + Send;
fn r#get_endpoint(&self, name: &str) -> Self::GetEndpointResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EndpointManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EndpointManagerSynchronousProxy {
type Proxy = EndpointManagerProxy;
type Protocol = EndpointManagerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl EndpointManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<EndpointManagerEvent, fidl::Error> {
EndpointManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#list_endpoints(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<String>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, EndpointManagerListEndpointsResponse>(
(),
0x78c83d9454e3d228,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.endp)
}
pub fn r#create_endpoint(
&self,
mut name: &str,
mut config: &EndpointConfig,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error> {
let _response = self.client.send_query::<
EndpointManagerCreateEndpointRequest,
EndpointManagerCreateEndpointResponse,
>(
(name, config,),
0x7defe4cd5e4e7d7c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.endpoint))
}
pub fn r#get_endpoint(
&self,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error> {
let _response = self
.client
.send_query::<EndpointManagerGetEndpointRequest, EndpointManagerGetEndpointResponse>(
(name,),
0x437e956b7b860751,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.endpoint)
}
}
#[derive(Debug, Clone)]
pub struct EndpointManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EndpointManagerProxy {
type Protocol = EndpointManagerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl EndpointManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EndpointManagerEventStream {
EndpointManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#list_endpoints(
&self,
) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
EndpointManagerProxyInterface::r#list_endpoints(self)
}
pub fn r#create_endpoint(
&self,
mut name: &str,
mut config: &EndpointConfig,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EndpointManagerProxyInterface::r#create_endpoint(self, name, config)
}
pub fn r#get_endpoint(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EndpointManagerProxyInterface::r#get_endpoint(self, name)
}
}
impl EndpointManagerProxyInterface for EndpointManagerProxy {
type ListEndpointsResponseFut =
fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#list_endpoints(&self) -> Self::ListEndpointsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<String>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
EndpointManagerListEndpointsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x78c83d9454e3d228,
>(_buf?)?;
Ok(_response.endp)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
(),
0x78c83d9454e3d228,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateEndpointResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_endpoint(
&self,
mut name: &str,
mut config: &EndpointConfig,
) -> Self::CreateEndpointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
EndpointManagerCreateEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7defe4cd5e4e7d7c,
>(_buf?)?;
Ok((_response.status, _response.endpoint))
}
self.client.send_query_and_decode::<
EndpointManagerCreateEndpointRequest,
(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
>(
(name, config,),
0x7defe4cd5e4e7d7c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetEndpointResponseFut = fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_endpoint(&self, mut name: &str) -> Self::GetEndpointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
EndpointManagerGetEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x437e956b7b860751,
>(_buf?)?;
Ok(_response.endpoint)
}
self.client.send_query_and_decode::<
EndpointManagerGetEndpointRequest,
Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
>(
(name,),
0x437e956b7b860751,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct EndpointManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EndpointManagerEventStream {}
impl futures::stream::FusedStream for EndpointManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EndpointManagerEventStream {
type Item = Result<EndpointManagerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(EndpointManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EndpointManagerEvent {}
impl EndpointManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EndpointManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EndpointManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EndpointManagerRequestStream {}
impl futures::stream::FusedStream for EndpointManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EndpointManagerRequestStream {
type Protocol = EndpointManagerMarker;
type ControlHandle = EndpointManagerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
EndpointManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for EndpointManagerRequestStream {
type Item = Result<EndpointManagerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled EndpointManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x78c83d9454e3d228 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EndpointManagerControlHandle { inner: this.inner.clone() };
Ok(EndpointManagerRequest::ListEndpoints {
responder: EndpointManagerListEndpointsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7defe4cd5e4e7d7c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EndpointManagerCreateEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointManagerCreateEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EndpointManagerControlHandle { inner: this.inner.clone() };
Ok(EndpointManagerRequest::CreateEndpoint {
name: req.name,
config: req.config,
responder: EndpointManagerCreateEndpointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x437e956b7b860751 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EndpointManagerGetEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointManagerGetEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
EndpointManagerControlHandle { inner: this.inner.clone() };
Ok(EndpointManagerRequest::GetEndpoint {
name: req.name,
responder: EndpointManagerGetEndpointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EndpointManagerRequest {
ListEndpoints { responder: EndpointManagerListEndpointsResponder },
CreateEndpoint {
name: String,
config: EndpointConfig,
responder: EndpointManagerCreateEndpointResponder,
},
GetEndpoint { name: String, responder: EndpointManagerGetEndpointResponder },
}
impl EndpointManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_list_endpoints(self) -> Option<(EndpointManagerListEndpointsResponder)> {
if let EndpointManagerRequest::ListEndpoints { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_endpoint(
self,
) -> Option<(String, EndpointConfig, EndpointManagerCreateEndpointResponder)> {
if let EndpointManagerRequest::CreateEndpoint { name, config, responder } = self {
Some((name, config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_endpoint(self) -> Option<(String, EndpointManagerGetEndpointResponder)> {
if let EndpointManagerRequest::GetEndpoint { name, responder } = self {
Some((name, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EndpointManagerRequest::ListEndpoints { .. } => "list_endpoints",
EndpointManagerRequest::CreateEndpoint { .. } => "create_endpoint",
EndpointManagerRequest::GetEndpoint { .. } => "get_endpoint",
}
}
}
#[derive(Debug, Clone)]
pub struct EndpointManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EndpointManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl EndpointManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointManagerListEndpointsResponder {
control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointManagerListEndpointsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointManagerListEndpointsResponder {
type ControlHandle = EndpointManagerControlHandle;
fn control_handle(&self) -> &EndpointManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointManagerListEndpointsResponder {
pub fn send(self, mut endp: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(endp);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut endp: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(endp);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut endp: &[String]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<EndpointManagerListEndpointsResponse>(
(endp,),
self.tx_id,
0x78c83d9454e3d228,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointManagerCreateEndpointResponder {
control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointManagerCreateEndpointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointManagerCreateEndpointResponder {
type ControlHandle = EndpointManagerControlHandle;
fn control_handle(&self) -> &EndpointManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointManagerCreateEndpointResponder {
pub fn send(
self,
mut status: i32,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, endpoint);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, endpoint);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<EndpointManagerCreateEndpointResponse>(
(status, endpoint),
self.tx_id,
0x7defe4cd5e4e7d7c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EndpointManagerGetEndpointResponder {
control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EndpointManagerGetEndpointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EndpointManagerGetEndpointResponder {
type ControlHandle = EndpointManagerControlHandle;
fn control_handle(&self) -> &EndpointManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EndpointManagerGetEndpointResponder {
pub fn send(
self,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(endpoint);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(endpoint);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<EndpointManagerGetEndpointResponse>(
(endpoint,),
self.tx_id,
0x437e956b7b860751,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FakeEndpointMarker;
impl fidl::endpoints::ProtocolMarker for FakeEndpointMarker {
type Proxy = FakeEndpointProxy;
type RequestStream = FakeEndpointRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FakeEndpointSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) FakeEndpoint";
}
pub trait FakeEndpointProxyInterface: Send + Sync {
type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#write(&self, data: &[u8]) -> Self::WriteResponseFut;
type ReadResponseFut: std::future::Future<Output = Result<(Vec<u8>, u64), fidl::Error>> + Send;
fn r#read(&self) -> Self::ReadResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FakeEndpointSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FakeEndpointSynchronousProxy {
type Proxy = FakeEndpointProxy;
type Protocol = FakeEndpointMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl FakeEndpointSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<FakeEndpointEvent, fidl::Error> {
FakeEndpointEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#write(
&self,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<FakeEndpointWriteRequest, fidl::encoding::EmptyPayload>(
(data,),
0x2c54af94338c523b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#read(&self, ___deadline: zx::MonotonicInstant) -> Result<(Vec<u8>, u64), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, FakeEndpointReadResponse>(
(),
0x58e2d032a8f36234,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.data, _response.dropped_frames))
}
}
#[derive(Debug, Clone)]
pub struct FakeEndpointProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for FakeEndpointProxy {
type Protocol = FakeEndpointMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl FakeEndpointProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FakeEndpointEventStream {
FakeEndpointEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#write(
&self,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeEndpointProxyInterface::r#write(self, data)
}
pub fn r#read(
&self,
) -> fidl::client::QueryResponseFut<(Vec<u8>, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
{
FakeEndpointProxyInterface::r#read(self)
}
}
impl FakeEndpointProxyInterface for FakeEndpointProxy {
type WriteResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2c54af94338c523b,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<FakeEndpointWriteRequest, ()>(
(data,),
0x2c54af94338c523b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadResponseFut = fidl::client::QueryResponseFut<
(Vec<u8>, u64),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read(&self) -> Self::ReadResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(Vec<u8>, u64), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
FakeEndpointReadResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x58e2d032a8f36234,
>(_buf?)?;
Ok((_response.data, _response.dropped_frames))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<u8>, u64)>(
(),
0x58e2d032a8f36234,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct FakeEndpointEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for FakeEndpointEventStream {}
impl futures::stream::FusedStream for FakeEndpointEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FakeEndpointEventStream {
type Item = Result<FakeEndpointEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(FakeEndpointEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FakeEndpointEvent {}
impl FakeEndpointEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<FakeEndpointEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FakeEndpointRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for FakeEndpointRequestStream {}
impl futures::stream::FusedStream for FakeEndpointRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FakeEndpointRequestStream {
type Protocol = FakeEndpointMarker;
type ControlHandle = FakeEndpointControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
FakeEndpointControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for FakeEndpointRequestStream {
type Item = Result<FakeEndpointRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled FakeEndpointRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2c54af94338c523b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeEndpointWriteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeEndpointWriteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeEndpointControlHandle { inner: this.inner.clone() };
Ok(FakeEndpointRequest::Write {
data: req.data,
responder: FakeEndpointWriteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x58e2d032a8f36234 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeEndpointControlHandle { inner: this.inner.clone() };
Ok(FakeEndpointRequest::Read {
responder: FakeEndpointReadResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum FakeEndpointRequest {
Write { data: Vec<u8>, responder: FakeEndpointWriteResponder },
Read { responder: FakeEndpointReadResponder },
}
impl FakeEndpointRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_write(self) -> Option<(Vec<u8>, FakeEndpointWriteResponder)> {
if let FakeEndpointRequest::Write { data, responder } = self {
Some((data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read(self) -> Option<(FakeEndpointReadResponder)> {
if let FakeEndpointRequest::Read { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FakeEndpointRequest::Write { .. } => "write",
FakeEndpointRequest::Read { .. } => "read",
}
}
}
#[derive(Debug, Clone)]
pub struct FakeEndpointControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for FakeEndpointControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl FakeEndpointControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeEndpointWriteResponder {
control_handle: std::mem::ManuallyDrop<FakeEndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeEndpointWriteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeEndpointWriteResponder {
type ControlHandle = FakeEndpointControlHandle;
fn control_handle(&self) -> &FakeEndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeEndpointWriteResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x2c54af94338c523b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeEndpointReadResponder {
control_handle: std::mem::ManuallyDrop<FakeEndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeEndpointReadResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeEndpointReadResponder {
type ControlHandle = FakeEndpointControlHandle;
fn control_handle(&self) -> &FakeEndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeEndpointReadResponder {
pub fn send(self, mut data: &[u8], mut dropped_frames: u64) -> Result<(), fidl::Error> {
let _result = self.send_raw(data, dropped_frames);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut data: &[u8],
mut dropped_frames: u64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(data, dropped_frames);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut data: &[u8], mut dropped_frames: u64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<FakeEndpointReadResponse>(
(data, dropped_frames),
self.tx_id,
0x58e2d032a8f36234,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NetworkMarker;
impl fidl::endpoints::ProtocolMarker for NetworkMarker {
type Proxy = NetworkProxy;
type RequestStream = NetworkRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NetworkSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Network";
}
pub trait NetworkProxyInterface: Send + Sync {
fn r#add_port(
&self,
port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
) -> Result<(), fidl::Error>;
type GetConfigResponseFut: std::future::Future<Output = Result<NetworkConfig, fidl::Error>>
+ Send;
fn r#get_config(&self) -> Self::GetConfigResponseFut;
type GetNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_name(&self) -> Self::GetNameResponseFut;
type SetConfigResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#set_config(&self, config: &NetworkConfig) -> Self::SetConfigResponseFut;
type AttachEndpointResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#attach_endpoint(&self, name: &str) -> Self::AttachEndpointResponseFut;
type RemoveEndpointResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#remove_endpoint(&self, name: &str) -> Self::RemoveEndpointResponseFut;
fn r#create_fake_endpoint(
&self,
ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
) -> Result<(), fidl::Error>;
type StartCaptureResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#start_capture(&self, name: &str) -> Self::StartCaptureResponseFut;
type StopCaptureResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#stop_capture(&self) -> Self::StopCaptureResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NetworkSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NetworkSynchronousProxy {
type Proxy = NetworkProxy;
type Protocol = NetworkMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl NetworkSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<NetworkEvent, fidl::Error> {
NetworkEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_port(
&self,
mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(
(port, interface),
0x7ad6a60c931a3f4e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_config(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkConfig, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, NetworkGetConfigResponse>(
(),
0x8dc04557e2ab069,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.config)
}
pub fn r#get_name(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, NetworkGetNameResponse>(
(),
0x57b7701d1ffeedb1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.name)
}
pub fn r#set_config(
&self,
mut config: &NetworkConfig,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<NetworkSetConfigRequest, NetworkSetConfigResponse>(
(config,),
0x18a490ee9d4bfa16,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#attach_endpoint(
&self,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<NetworkAttachEndpointRequest, NetworkAttachEndpointResponse>(
(name,),
0x6e8ff8e9ea1b9a98,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#remove_endpoint(
&self,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<NetworkRemoveEndpointRequest, NetworkRemoveEndpointResponse>(
(name,),
0x298eaac56bfcdd25,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#create_fake_endpoint(
&self,
mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkCreateFakeEndpointRequest>(
(ep,),
0x3eb8f71b45e1e1f3,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#start_capture(
&self,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<NetworkStartCaptureRequest, NetworkStartCaptureResponse>(
(name,),
0x3ca44940622932c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#stop_capture(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x1d7827adad109468,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct NetworkProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for NetworkProxy {
type Protocol = NetworkMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl NetworkProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NetworkEventStream {
NetworkEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_port(
&self,
mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
) -> Result<(), fidl::Error> {
NetworkProxyInterface::r#add_port(self, port, interface)
}
pub fn r#get_config(
&self,
) -> fidl::client::QueryResponseFut<NetworkConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
{
NetworkProxyInterface::r#get_config(self)
}
pub fn r#get_name(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#get_name(self)
}
pub fn r#set_config(
&self,
mut config: &NetworkConfig,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#set_config(self, config)
}
pub fn r#attach_endpoint(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#attach_endpoint(self, name)
}
pub fn r#remove_endpoint(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#remove_endpoint(self, name)
}
pub fn r#create_fake_endpoint(
&self,
mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
) -> Result<(), fidl::Error> {
NetworkProxyInterface::r#create_fake_endpoint(self, ep)
}
pub fn r#start_capture(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#start_capture(self, name)
}
pub fn r#stop_capture(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
NetworkProxyInterface::r#stop_capture(self)
}
}
impl NetworkProxyInterface for NetworkProxy {
fn r#add_port(
&self,
mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(
(port, interface),
0x7ad6a60c931a3f4e,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetConfigResponseFut = fidl::client::QueryResponseFut<
NetworkConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_config(&self) -> Self::GetConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkConfig, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkGetConfigResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x8dc04557e2ab069,
>(_buf?)?;
Ok(_response.config)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NetworkConfig>(
(),
0x8dc04557e2ab069,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetNameResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_name(&self) -> Self::GetNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkGetNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x57b7701d1ffeedb1,
>(_buf?)?;
Ok(_response.name)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0x57b7701d1ffeedb1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetConfigResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_config(&self, mut config: &NetworkConfig) -> Self::SetConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkSetConfigResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x18a490ee9d4bfa16,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<NetworkSetConfigRequest, i32>(
(config,),
0x18a490ee9d4bfa16,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AttachEndpointResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#attach_endpoint(&self, mut name: &str) -> Self::AttachEndpointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkAttachEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6e8ff8e9ea1b9a98,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<NetworkAttachEndpointRequest, i32>(
(name,),
0x6e8ff8e9ea1b9a98,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveEndpointResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#remove_endpoint(&self, mut name: &str) -> Self::RemoveEndpointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkRemoveEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x298eaac56bfcdd25,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<NetworkRemoveEndpointRequest, i32>(
(name,),
0x298eaac56bfcdd25,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#create_fake_endpoint(
&self,
mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkCreateFakeEndpointRequest>(
(ep,),
0x3eb8f71b45e1e1f3,
fidl::encoding::DynamicFlags::empty(),
)
}
type StartCaptureResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start_capture(&self, mut name: &str) -> Self::StartCaptureResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkStartCaptureResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ca44940622932c,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<NetworkStartCaptureRequest, i32>(
(name,),
0x3ca44940622932c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopCaptureResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#stop_capture(&self) -> Self::StopCaptureResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1d7827adad109468,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x1d7827adad109468,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NetworkEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for NetworkEventStream {}
impl futures::stream::FusedStream for NetworkEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NetworkEventStream {
type Item = Result<NetworkEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(NetworkEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NetworkEvent {
OnRemoved { reason: fidl_fuchsia_net_virtualization::NetworkRemovalReason },
}
impl NetworkEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_removed(self) -> Option<fidl_fuchsia_net_virtualization::NetworkRemovalReason> {
if let NetworkEvent::OnRemoved { reason } = self {
Some((reason))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<NetworkEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
0xfe80656d1e5ec4a => {
let mut out = fidl::new_empty!(
fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((NetworkEvent::OnRemoved { reason: out.reason }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NetworkRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for NetworkRequestStream {}
impl futures::stream::FusedStream for NetworkRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NetworkRequestStream {
type Protocol = NetworkMarker;
type ControlHandle = NetworkControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
NetworkControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for NetworkRequestStream {
type Item = Result<NetworkRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled NetworkRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7ad6a60c931a3f4e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl_fuchsia_net_virtualization::NetworkAddPortRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::AddPort {
port: req.port,
interface: req.interface,
control_handle,
})
}
0x8dc04557e2ab069 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::GetConfig {
responder: NetworkGetConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x57b7701d1ffeedb1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::GetName {
responder: NetworkGetNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x18a490ee9d4bfa16 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkSetConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkSetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::SetConfig {
config: req.config,
responder: NetworkSetConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e8ff8e9ea1b9a98 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkAttachEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkAttachEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::AttachEndpoint {
name: req.name,
responder: NetworkAttachEndpointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x298eaac56bfcdd25 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRemoveEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRemoveEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::RemoveEndpoint {
name: req.name,
responder: NetworkRemoveEndpointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3eb8f71b45e1e1f3 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
NetworkCreateFakeEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkCreateFakeEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::CreateFakeEndpoint { ep: req.ep, control_handle })
}
0x3ca44940622932c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkStartCaptureRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkStartCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::StartCapture {
name: req.name,
responder: NetworkStartCaptureResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1d7827adad109468 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = NetworkControlHandle { inner: this.inner.clone() };
Ok(NetworkRequest::StopCapture {
responder: NetworkStopCaptureResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum NetworkRequest {
AddPort {
port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
control_handle: NetworkControlHandle,
},
GetConfig { responder: NetworkGetConfigResponder },
GetName { responder: NetworkGetNameResponder },
SetConfig { config: NetworkConfig, responder: NetworkSetConfigResponder },
AttachEndpoint { name: String, responder: NetworkAttachEndpointResponder },
RemoveEndpoint { name: String, responder: NetworkRemoveEndpointResponder },
CreateFakeEndpoint {
ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
control_handle: NetworkControlHandle,
},
StartCapture { name: String, responder: NetworkStartCaptureResponder },
StopCapture { responder: NetworkStopCaptureResponder },
}
impl NetworkRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_port(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
NetworkControlHandle,
)> {
if let NetworkRequest::AddPort { port, interface, control_handle } = self {
Some((port, interface, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_config(self) -> Option<(NetworkGetConfigResponder)> {
if let NetworkRequest::GetConfig { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_name(self) -> Option<(NetworkGetNameResponder)> {
if let NetworkRequest::GetName { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_config(self) -> Option<(NetworkConfig, NetworkSetConfigResponder)> {
if let NetworkRequest::SetConfig { config, responder } = self {
Some((config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_attach_endpoint(self) -> Option<(String, NetworkAttachEndpointResponder)> {
if let NetworkRequest::AttachEndpoint { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_endpoint(self) -> Option<(String, NetworkRemoveEndpointResponder)> {
if let NetworkRequest::RemoveEndpoint { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_fake_endpoint(
self,
) -> Option<(fidl::endpoints::ServerEnd<FakeEndpointMarker>, NetworkControlHandle)> {
if let NetworkRequest::CreateFakeEndpoint { ep, control_handle } = self {
Some((ep, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_capture(self) -> Option<(String, NetworkStartCaptureResponder)> {
if let NetworkRequest::StartCapture { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_capture(self) -> Option<(NetworkStopCaptureResponder)> {
if let NetworkRequest::StopCapture { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NetworkRequest::AddPort { .. } => "add_port",
NetworkRequest::GetConfig { .. } => "get_config",
NetworkRequest::GetName { .. } => "get_name",
NetworkRequest::SetConfig { .. } => "set_config",
NetworkRequest::AttachEndpoint { .. } => "attach_endpoint",
NetworkRequest::RemoveEndpoint { .. } => "remove_endpoint",
NetworkRequest::CreateFakeEndpoint { .. } => "create_fake_endpoint",
NetworkRequest::StartCapture { .. } => "start_capture",
NetworkRequest::StopCapture { .. } => "stop_capture",
}
}
}
#[derive(Debug, Clone)]
pub struct NetworkControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for NetworkControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl NetworkControlHandle {
pub fn send_on_removed(
&self,
mut reason: fidl_fuchsia_net_virtualization::NetworkRemovalReason,
) -> Result<(), fidl::Error> {
self.inner.send::<fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest>(
(reason,),
0,
0xfe80656d1e5ec4a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkGetConfigResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkGetConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkGetConfigResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkGetConfigResponder {
pub fn send(self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkGetConfigResponse>(
(config,),
self.tx_id,
0x8dc04557e2ab069,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkGetNameResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkGetNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkGetNameResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkGetNameResponder {
pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(name);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(name);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkGetNameResponse>(
(name,),
self.tx_id,
0x57b7701d1ffeedb1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkSetConfigResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkSetConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkSetConfigResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkSetConfigResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkSetConfigResponse>(
(status,),
self.tx_id,
0x18a490ee9d4bfa16,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkAttachEndpointResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkAttachEndpointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkAttachEndpointResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkAttachEndpointResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkAttachEndpointResponse>(
(status,),
self.tx_id,
0x6e8ff8e9ea1b9a98,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkRemoveEndpointResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkRemoveEndpointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkRemoveEndpointResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkRemoveEndpointResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkRemoveEndpointResponse>(
(status,),
self.tx_id,
0x298eaac56bfcdd25,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkStartCaptureResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkStartCaptureResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkStartCaptureResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkStartCaptureResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkStartCaptureResponse>(
(status,),
self.tx_id,
0x3ca44940622932c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkStopCaptureResponder {
control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkStopCaptureResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkStopCaptureResponder {
type ControlHandle = NetworkControlHandle;
fn control_handle(&self) -> &NetworkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkStopCaptureResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x1d7827adad109468,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NetworkContextMarker;
impl fidl::endpoints::ProtocolMarker for NetworkContextMarker {
type Proxy = NetworkContextProxy;
type RequestStream = NetworkContextRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NetworkContextSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netemul.network.NetworkContext";
}
impl fidl::endpoints::DiscoverableProtocolMarker for NetworkContextMarker {}
pub trait NetworkContextProxyInterface: Send + Sync {
fn r#clone(
&self,
network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
) -> Result<(), fidl::Error>;
fn r#get_network_manager(
&self,
net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
) -> Result<(), fidl::Error>;
fn r#get_endpoint_manager(
&self,
endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
) -> Result<(), fidl::Error>;
type SetupResponseFut: std::future::Future<
Output = Result<
(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
fidl::Error,
>,
> + Send;
fn r#setup(&self, networks: &[NetworkSetup]) -> Self::SetupResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NetworkContextSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NetworkContextSynchronousProxy {
type Proxy = NetworkContextProxy;
type Protocol = NetworkContextMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl NetworkContextSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<NetworkContextEvent, fidl::Error> {
NetworkContextEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#clone(
&self,
mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextCloneRequest>(
(network_context,),
0x1f7eb1b78a2ad2b0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_network_manager(
&self,
mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextGetNetworkManagerRequest>(
(net_manager,),
0x379899a30766afd4,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_endpoint_manager(
&self,
mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextGetEndpointManagerRequest>(
(endp_manager,),
0x5e64360363b9bd81,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#setup(
&self,
mut networks: &[NetworkSetup],
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>), fidl::Error> {
let _response =
self.client.send_query::<NetworkContextSetupRequest, NetworkContextSetupResponse>(
(networks,),
0x1680e0b13823fc8c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.setup_handle))
}
}
#[derive(Debug, Clone)]
pub struct NetworkContextProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for NetworkContextProxy {
type Protocol = NetworkContextMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl NetworkContextProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NetworkContextEventStream {
NetworkContextEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#clone(
&self,
mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
) -> Result<(), fidl::Error> {
NetworkContextProxyInterface::r#clone(self, network_context)
}
pub fn r#get_network_manager(
&self,
mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
) -> Result<(), fidl::Error> {
NetworkContextProxyInterface::r#get_network_manager(self, net_manager)
}
pub fn r#get_endpoint_manager(
&self,
mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
) -> Result<(), fidl::Error> {
NetworkContextProxyInterface::r#get_endpoint_manager(self, endp_manager)
}
pub fn r#setup(
&self,
mut networks: &[NetworkSetup],
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkContextProxyInterface::r#setup(self, networks)
}
}
impl NetworkContextProxyInterface for NetworkContextProxy {
fn r#clone(
&self,
mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextCloneRequest>(
(network_context,),
0x1f7eb1b78a2ad2b0,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_network_manager(
&self,
mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextGetNetworkManagerRequest>(
(net_manager,),
0x379899a30766afd4,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_endpoint_manager(
&self,
mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<NetworkContextGetEndpointManagerRequest>(
(endp_manager,),
0x5e64360363b9bd81,
fidl::encoding::DynamicFlags::empty(),
)
}
type SetupResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#setup(&self, mut networks: &[NetworkSetup]) -> Self::SetupResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>), fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
NetworkContextSetupResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1680e0b13823fc8c,
>(_buf?)?;
Ok((_response.status, _response.setup_handle))
}
self.client.send_query_and_decode::<
NetworkContextSetupRequest,
(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
>(
(networks,),
0x1680e0b13823fc8c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NetworkContextEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for NetworkContextEventStream {}
impl futures::stream::FusedStream for NetworkContextEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NetworkContextEventStream {
type Item = Result<NetworkContextEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(NetworkContextEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NetworkContextEvent {}
impl NetworkContextEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<NetworkContextEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NetworkContextRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for NetworkContextRequestStream {}
impl futures::stream::FusedStream for NetworkContextRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NetworkContextRequestStream {
type Protocol = NetworkContextMarker;
type ControlHandle = NetworkContextControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
NetworkContextControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for NetworkContextRequestStream {
type Item = Result<NetworkContextRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled NetworkContextRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x1f7eb1b78a2ad2b0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
NetworkContextCloneRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextCloneRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkContextControlHandle { inner: this.inner.clone() };
Ok(NetworkContextRequest::Clone {
network_context: req.network_context,
control_handle,
})
}
0x379899a30766afd4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
NetworkContextGetNetworkManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextGetNetworkManagerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkContextControlHandle { inner: this.inner.clone() };
Ok(NetworkContextRequest::GetNetworkManager {
net_manager: req.net_manager,
control_handle,
})
}
0x5e64360363b9bd81 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
NetworkContextGetEndpointManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextGetEndpointManagerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkContextControlHandle { inner: this.inner.clone() };
Ok(NetworkContextRequest::GetEndpointManager {
endp_manager: req.endp_manager,
control_handle,
})
}
0x1680e0b13823fc8c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkContextSetupRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextSetupRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkContextControlHandle { inner: this.inner.clone() };
Ok(NetworkContextRequest::Setup {
networks: req.networks,
responder: NetworkContextSetupResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum NetworkContextRequest {
Clone {
network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
control_handle: NetworkContextControlHandle,
},
GetNetworkManager {
net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
control_handle: NetworkContextControlHandle,
},
GetEndpointManager {
endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
control_handle: NetworkContextControlHandle,
},
Setup { networks: Vec<NetworkSetup>, responder: NetworkContextSetupResponder },
}
impl NetworkContextRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_clone(
self,
) -> Option<(fidl::endpoints::ServerEnd<NetworkContextMarker>, NetworkContextControlHandle)>
{
if let NetworkContextRequest::Clone { network_context, control_handle } = self {
Some((network_context, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_network_manager(
self,
) -> Option<(fidl::endpoints::ServerEnd<NetworkManagerMarker>, NetworkContextControlHandle)>
{
if let NetworkContextRequest::GetNetworkManager { net_manager, control_handle } = self {
Some((net_manager, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_endpoint_manager(
self,
) -> Option<(fidl::endpoints::ServerEnd<EndpointManagerMarker>, NetworkContextControlHandle)>
{
if let NetworkContextRequest::GetEndpointManager { endp_manager, control_handle } = self {
Some((endp_manager, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_setup(self) -> Option<(Vec<NetworkSetup>, NetworkContextSetupResponder)> {
if let NetworkContextRequest::Setup { networks, responder } = self {
Some((networks, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NetworkContextRequest::Clone { .. } => "clone",
NetworkContextRequest::GetNetworkManager { .. } => "get_network_manager",
NetworkContextRequest::GetEndpointManager { .. } => "get_endpoint_manager",
NetworkContextRequest::Setup { .. } => "setup",
}
}
}
#[derive(Debug, Clone)]
pub struct NetworkContextControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for NetworkContextControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl NetworkContextControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkContextSetupResponder {
control_handle: std::mem::ManuallyDrop<NetworkContextControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkContextSetupResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkContextSetupResponder {
type ControlHandle = NetworkContextControlHandle;
fn control_handle(&self) -> &NetworkContextControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkContextSetupResponder {
pub fn send(
self,
mut status: i32,
mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, setup_handle);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, setup_handle);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkContextSetupResponse>(
(status, setup_handle),
self.tx_id,
0x1680e0b13823fc8c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NetworkManagerMarker;
impl fidl::endpoints::ProtocolMarker for NetworkManagerMarker {
type Proxy = NetworkManagerProxy;
type RequestStream = NetworkManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NetworkManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) NetworkManager";
}
pub trait NetworkManagerProxyInterface: Send + Sync {
type ListNetworksResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
+ Send;
fn r#list_networks(&self) -> Self::ListNetworksResponseFut;
type CreateNetworkResponseFut: std::future::Future<
Output = Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error>,
> + Send;
fn r#create_network(
&self,
name: &str,
config: &NetworkConfig,
) -> Self::CreateNetworkResponseFut;
type GetNetworkResponseFut: std::future::Future<
Output = Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error>,
> + Send;
fn r#get_network(&self, name: &str) -> Self::GetNetworkResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NetworkManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NetworkManagerSynchronousProxy {
type Proxy = NetworkManagerProxy;
type Protocol = NetworkManagerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl NetworkManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<NetworkManagerEvent, fidl::Error> {
NetworkManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#list_networks(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<String>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, NetworkManagerListNetworksResponse>(
(),
0x2488653e0974cc62,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.nets)
}
pub fn r#create_network(
&self,
mut name: &str,
mut config: &NetworkConfig,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error> {
let _response = self
.client
.send_query::<NetworkManagerCreateNetworkRequest, NetworkManagerCreateNetworkResponse>(
(name, config),
0x6052eb5ac709af,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.net))
}
pub fn r#get_network(
&self,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error> {
let _response = self
.client
.send_query::<NetworkManagerGetNetworkRequest, NetworkManagerGetNetworkResponse>(
(name,),
0x59930bf23acc7d9a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.net)
}
}
#[derive(Debug, Clone)]
pub struct NetworkManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for NetworkManagerProxy {
type Protocol = NetworkManagerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl NetworkManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NetworkManagerEventStream {
NetworkManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#list_networks(
&self,
) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
NetworkManagerProxyInterface::r#list_networks(self)
}
pub fn r#create_network(
&self,
mut name: &str,
mut config: &NetworkConfig,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkManagerProxyInterface::r#create_network(self, name, config)
}
pub fn r#get_network(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkManagerProxyInterface::r#get_network(self, name)
}
}
impl NetworkManagerProxyInterface for NetworkManagerProxy {
type ListNetworksResponseFut =
fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#list_networks(&self) -> Self::ListNetworksResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<String>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkManagerListNetworksResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2488653e0974cc62,
>(_buf?)?;
Ok(_response.nets)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
(),
0x2488653e0974cc62,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateNetworkResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_network(
&self,
mut name: &str,
mut config: &NetworkConfig,
) -> Self::CreateNetworkResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkManagerCreateNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6052eb5ac709af,
>(_buf?)?;
Ok((_response.status, _response.net))
}
self.client.send_query_and_decode::<
NetworkManagerCreateNetworkRequest,
(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
>(
(name, config,),
0x6052eb5ac709af,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetNetworkResponseFut = fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_network(&self, mut name: &str) -> Self::GetNetworkResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
NetworkManagerGetNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x59930bf23acc7d9a,
>(_buf?)?;
Ok(_response.net)
}
self.client.send_query_and_decode::<
NetworkManagerGetNetworkRequest,
Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
>(
(name,),
0x59930bf23acc7d9a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NetworkManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for NetworkManagerEventStream {}
impl futures::stream::FusedStream for NetworkManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NetworkManagerEventStream {
type Item = Result<NetworkManagerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(NetworkManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NetworkManagerEvent {}
impl NetworkManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<NetworkManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NetworkManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for NetworkManagerRequestStream {}
impl futures::stream::FusedStream for NetworkManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NetworkManagerRequestStream {
type Protocol = NetworkManagerMarker;
type ControlHandle = NetworkManagerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
NetworkManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for NetworkManagerRequestStream {
type Item = Result<NetworkManagerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled NetworkManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2488653e0974cc62 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkManagerControlHandle { inner: this.inner.clone() };
Ok(NetworkManagerRequest::ListNetworks {
responder: NetworkManagerListNetworksResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6052eb5ac709af => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkManagerCreateNetworkRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkManagerCreateNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkManagerControlHandle { inner: this.inner.clone() };
Ok(NetworkManagerRequest::CreateNetwork {
name: req.name,
config: req.config,
responder: NetworkManagerCreateNetworkResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x59930bf23acc7d9a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkManagerGetNetworkRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkManagerGetNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkManagerControlHandle { inner: this.inner.clone() };
Ok(NetworkManagerRequest::GetNetwork {
name: req.name,
responder: NetworkManagerGetNetworkResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum NetworkManagerRequest {
ListNetworks { responder: NetworkManagerListNetworksResponder },
CreateNetwork {
name: String,
config: NetworkConfig,
responder: NetworkManagerCreateNetworkResponder,
},
GetNetwork { name: String, responder: NetworkManagerGetNetworkResponder },
}
impl NetworkManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_list_networks(self) -> Option<(NetworkManagerListNetworksResponder)> {
if let NetworkManagerRequest::ListNetworks { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_network(
self,
) -> Option<(String, NetworkConfig, NetworkManagerCreateNetworkResponder)> {
if let NetworkManagerRequest::CreateNetwork { name, config, responder } = self {
Some((name, config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_network(self) -> Option<(String, NetworkManagerGetNetworkResponder)> {
if let NetworkManagerRequest::GetNetwork { name, responder } = self {
Some((name, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NetworkManagerRequest::ListNetworks { .. } => "list_networks",
NetworkManagerRequest::CreateNetwork { .. } => "create_network",
NetworkManagerRequest::GetNetwork { .. } => "get_network",
}
}
}
#[derive(Debug, Clone)]
pub struct NetworkManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for NetworkManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl NetworkManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkManagerListNetworksResponder {
control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkManagerListNetworksResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkManagerListNetworksResponder {
type ControlHandle = NetworkManagerControlHandle;
fn control_handle(&self) -> &NetworkManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkManagerListNetworksResponder {
pub fn send(self, mut nets: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(nets);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut nets: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(nets);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut nets: &[String]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkManagerListNetworksResponse>(
(nets,),
self.tx_id,
0x2488653e0974cc62,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkManagerCreateNetworkResponder {
control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkManagerCreateNetworkResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkManagerCreateNetworkResponder {
type ControlHandle = NetworkManagerControlHandle;
fn control_handle(&self) -> &NetworkManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkManagerCreateNetworkResponder {
pub fn send(
self,
mut status: i32,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, net);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, net);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkManagerCreateNetworkResponse>(
(status, net),
self.tx_id,
0x6052eb5ac709af,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkManagerGetNetworkResponder {
control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkManagerGetNetworkResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkManagerGetNetworkResponder {
type ControlHandle = NetworkManagerControlHandle;
fn control_handle(&self) -> &NetworkManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkManagerGetNetworkResponder {
pub fn send(
self,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(net);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(net);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<NetworkManagerGetNetworkResponse>(
(net,),
self.tx_id,
0x59930bf23acc7d9a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SetupHandleMarker;
impl fidl::endpoints::ProtocolMarker for SetupHandleMarker {
type Proxy = SetupHandleProxy;
type RequestStream = SetupHandleRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SetupHandleSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SetupHandle";
}
pub trait SetupHandleProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SetupHandleSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SetupHandleSynchronousProxy {
type Proxy = SetupHandleProxy;
type Protocol = SetupHandleMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl SetupHandleSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<SetupHandleEvent, fidl::Error> {
SetupHandleEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct SetupHandleProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SetupHandleProxy {
type Protocol = SetupHandleMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl SetupHandleProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SetupHandleEventStream {
SetupHandleEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl SetupHandleProxyInterface for SetupHandleProxy {}
pub struct SetupHandleEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SetupHandleEventStream {}
impl futures::stream::FusedStream for SetupHandleEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SetupHandleEventStream {
type Item = Result<SetupHandleEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(SetupHandleEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SetupHandleEvent {}
impl SetupHandleEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SetupHandleEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SetupHandleRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SetupHandleRequestStream {}
impl futures::stream::FusedStream for SetupHandleRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SetupHandleRequestStream {
type Protocol = SetupHandleMarker;
type ControlHandle = SetupHandleControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
SetupHandleControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for SetupHandleRequestStream {
type Item = Result<SetupHandleRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled SetupHandleRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SetupHandleRequest {}
impl SetupHandleRequest {
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct SetupHandleControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SetupHandleControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl SetupHandleControlHandle {}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for DeviceProxyServeControllerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceProxyServeControllerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
DeviceProxyServeControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DeviceProxyServeControllerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceProxyServeControllerRequest>(offset);
fidl::encoding::Encode::<
DeviceProxyServeControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.req
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DeviceProxyServeControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceProxyServeControllerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceProxyServeControllerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
req: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.req,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceProxyServeDeviceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceProxyServeDeviceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
DeviceProxyServeDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DeviceProxyServeDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceProxyServeDeviceRequest>(offset);
fidl::encoding::Encode::<
DeviceProxyServeDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.req
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DeviceProxyServeDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceProxyServeDeviceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceProxyServeDeviceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
req: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_hardware_network::DeviceInstanceMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.req,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointConfig, D>
for &EndpointConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointConfig>(offset);
fidl::encoding::Encode::<EndpointConfig, D>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.mtu),
<fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
<fidl_fuchsia_hardware_network::PortClass as fidl::encoding::ValueTypeMarker>::borrow(&self.port_class),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D>,
T2: fidl::encoding::Encode<fidl_fuchsia_hardware_network::PortClass, D>,
> fidl::encoding::Encode<EndpointConfig, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointConfig>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointConfig {
#[inline(always)]
fn new_empty() -> Self {
Self {
mtu: fidl::new_empty!(u16, D),
mac: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D),
port_class: fidl::new_empty!(fidl_fuchsia_hardware_network::PortClass, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, D, &mut self.mtu, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
D,
&mut self.mac,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl_fuchsia_hardware_network::PortClass,
D,
&mut self.port_class,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointGetConfigResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointGetConfigResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointGetConfigResponse, D> for &EndpointGetConfigResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
fidl::encoding::Encode::<EndpointGetConfigResponse, D>::encode(
(<EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<EndpointConfig, D>>
fidl::encoding::Encode<EndpointGetConfigResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointGetConfigResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(EndpointConfig, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointGetNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointGetNameResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointGetNameResponse, D> for &EndpointGetNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
fidl::encoding::Encode::<EndpointGetNameResponse, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<EndpointGetNameResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointGetNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EndpointGetPortRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointGetPortRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
EndpointGetPortRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EndpointGetPortRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetPortRequest>(offset);
fidl::encoding::Encode::<
EndpointGetPortRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.port
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EndpointGetPortRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetPortRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointGetPortRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
port: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.port,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EndpointGetProxyRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointGetProxyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
EndpointGetProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EndpointGetProxyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetProxyRequest>(offset);
fidl::encoding::Encode::<EndpointGetProxyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EndpointGetProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointGetProxyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointGetProxyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
proxy: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.proxy,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointManagerCreateEndpointRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointManagerCreateEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D>
for &EndpointManagerCreateEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
fidl::encoding::Encode::<EndpointManagerCreateEndpointRequest, D>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T1: fidl::encoding::Encode<EndpointConfig, D>,
> fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointManagerCreateEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
config: fidl::new_empty!(EndpointConfig, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EndpointManagerCreateEndpointResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointManagerCreateEndpointResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
EndpointManagerCreateEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EndpointManagerCreateEndpointResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerCreateEndpointResponse>(offset);
fidl::encoding::Encode::<
EndpointManagerCreateEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.endpoint
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EndpointManagerCreateEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerCreateEndpointResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointManagerCreateEndpointResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
endpoint: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.endpoint,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointManagerGetEndpointRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointManagerGetEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D>
for &EndpointManagerGetEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
fidl::encoding::Encode::<EndpointManagerGetEndpointRequest, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointManagerGetEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for EndpointManagerGetEndpointResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointManagerGetEndpointResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
EndpointManagerGetEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut EndpointManagerGetEndpointResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerGetEndpointResponse>(offset);
fidl::encoding::Encode::<
EndpointManagerGetEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.endpoint
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
EndpointManagerGetEndpointResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerGetEndpointResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for EndpointManagerGetEndpointResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
endpoint: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.endpoint,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointManagerListEndpointsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointManagerListEndpointsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D>
for &EndpointManagerListEndpointsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
fidl::encoding::Encode::<EndpointManagerListEndpointsResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.endp),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D,
>,
> fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointManagerListEndpointsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
endp: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D,
&mut self.endp,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointSetLinkUpRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointSetLinkUpRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for &EndpointSetLinkUpRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
fidl::encoding::Encode::<EndpointSetLinkUpRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.up),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EndpointSetLinkUpRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { up: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.up, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EndpointSetup {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EndpointSetup {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointSetup, D>
for &EndpointSetup
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointSetup>(offset);
fidl::encoding::Encode::<EndpointSetup, D>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::Boxed<EndpointConfig> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.link_up),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<EndpointConfig>, D>,
T2: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<EndpointSetup, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EndpointSetup>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointSetup {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
config: fidl::new_empty!(fidl::encoding::Boxed<EndpointConfig>, D),
link_up: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<EndpointConfig>,
D,
&mut self.config,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(bool, D, &mut self.link_up, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeEndpointReadResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeEndpointReadResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<FakeEndpointReadResponse, D> for &FakeEndpointReadResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
fidl::encoding::Encode::<FakeEndpointReadResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_frames),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<FakeEndpointReadResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeEndpointReadResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
dropped_frames: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u64, D, &mut self.dropped_frames, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeEndpointWriteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeEndpointWriteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<FakeEndpointWriteRequest, D> for &FakeEndpointWriteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
fidl::encoding::Encode::<FakeEndpointWriteRequest, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<FakeEndpointWriteRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeEndpointWriteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LatencyConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LatencyConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LatencyConfig, D>
for &LatencyConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LatencyConfig>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LatencyConfig)
.write_unaligned((self as *const LatencyConfig).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<LatencyConfig, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LatencyConfig>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LatencyConfig {
#[inline(always)]
fn new_empty() -> Self {
Self { average: fidl::new_empty!(u64, D), std_dev: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for &NetworkAttachEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
fidl::encoding::Encode::<NetworkAttachEndpointRequest, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkAttachEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkAttachEndpointResponse, D>
for &NetworkAttachEndpointResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NetworkAttachEndpointResponse)
.write_unaligned((self as *const NetworkAttachEndpointResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<NetworkAttachEndpointResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkAttachEndpointResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkContextCloneRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkContextCloneRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
NetworkContextCloneRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkContextCloneRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextCloneRequest>(offset);
fidl::encoding::Encode::<NetworkContextCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.network_context),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkContextCloneRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextCloneRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextCloneRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
network_context: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.network_context,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkContextGetEndpointManagerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkContextGetEndpointManagerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
NetworkContextGetEndpointManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkContextGetEndpointManagerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextGetEndpointManagerRequest>(offset);
fidl::encoding::Encode::<NetworkContextGetEndpointManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endp_manager),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkContextGetEndpointManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextGetEndpointManagerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextGetEndpointManagerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
endp_manager: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.endp_manager,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkContextGetNetworkManagerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkContextGetNetworkManagerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
NetworkContextGetNetworkManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkContextGetNetworkManagerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextGetNetworkManagerRequest>(offset);
fidl::encoding::Encode::<NetworkContextGetNetworkManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.net_manager),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkContextGetNetworkManagerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextGetNetworkManagerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextGetNetworkManagerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
net_manager: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.net_manager,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkContextSetupRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkContextSetupRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkContextSetupRequest, D> for &NetworkContextSetupRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
fidl::encoding::Encode::<NetworkContextSetupRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<NetworkSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.networks),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<NetworkSetup>, D>,
> fidl::encoding::Encode<NetworkContextSetupRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkContextSetupRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { networks: fidl::new_empty!(fidl::encoding::UnboundedVector<NetworkSetup>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<NetworkSetup>,
D,
&mut self.networks,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkContextSetupResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkContextSetupResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
NetworkContextSetupResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkContextSetupResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextSetupResponse>(offset);
fidl::encoding::Encode::<
NetworkContextSetupResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.setup_handle,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkContextSetupResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkContextSetupResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkContextSetupResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
setup_handle: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.setup_handle,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkCreateFakeEndpointRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkCreateFakeEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
NetworkCreateFakeEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkCreateFakeEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkCreateFakeEndpointRequest>(offset);
fidl::encoding::Encode::<NetworkCreateFakeEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ep),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkCreateFakeEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkCreateFakeEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkCreateFakeEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
ep: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.ep,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkGetConfigResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkGetConfigResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkGetConfigResponse, D> for &NetworkGetConfigResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
fidl::encoding::Encode::<NetworkGetConfigResponse, D>::encode(
(<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
fidl::encoding::Encode<NetworkGetConfigResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkGetConfigResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(NetworkConfig, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkGetNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkGetNameResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkGetNameResponse, D> for &NetworkGetNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
fidl::encoding::Encode::<NetworkGetNameResponse, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<NetworkGetNameResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkGetNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkManagerCreateNetworkRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkManagerCreateNetworkRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D>
for &NetworkManagerCreateNetworkRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
fidl::encoding::Encode::<NetworkManagerCreateNetworkRequest, D>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T1: fidl::encoding::Encode<NetworkConfig, D>,
> fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkManagerCreateNetworkRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
config: fidl::new_empty!(NetworkConfig, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkManagerCreateNetworkResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkManagerCreateNetworkResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
NetworkManagerCreateNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkManagerCreateNetworkResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerCreateNetworkResponse>(offset);
fidl::encoding::Encode::<
NetworkManagerCreateNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.net
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkManagerCreateNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerCreateNetworkResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkManagerCreateNetworkResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
net: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.net,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkManagerGetNetworkRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkManagerGetNetworkRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D>
for &NetworkManagerGetNetworkRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
fidl::encoding::Encode::<NetworkManagerGetNetworkRequest, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkManagerGetNetworkRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for NetworkManagerGetNetworkResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkManagerGetNetworkResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
NetworkManagerGetNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut NetworkManagerGetNetworkResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerGetNetworkResponse>(offset);
fidl::encoding::Encode::<
NetworkManagerGetNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.net
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
NetworkManagerGetNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerGetNetworkResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for NetworkManagerGetNetworkResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
net: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.net,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkManagerListNetworksResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkManagerListNetworksResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkManagerListNetworksResponse, D>
for &NetworkManagerListNetworksResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
fidl::encoding::Encode::<NetworkManagerListNetworksResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.nets),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D,
>,
> fidl::encoding::Encode<NetworkManagerListNetworksResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkManagerListNetworksResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
nets: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
D,
&mut self.nets,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for &NetworkRemoveEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
fidl::encoding::Encode::<NetworkRemoveEndpointRequest, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRemoveEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkRemoveEndpointResponse, D>
for &NetworkRemoveEndpointResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NetworkRemoveEndpointResponse)
.write_unaligned((self as *const NetworkRemoveEndpointResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<NetworkRemoveEndpointResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRemoveEndpointResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkSetConfigRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkSetConfigRequest, D> for &NetworkSetConfigRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
fidl::encoding::Encode::<NetworkSetConfigRequest, D>::encode(
(<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
fidl::encoding::Encode<NetworkSetConfigRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkSetConfigRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(NetworkConfig, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkSetConfigResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkSetConfigResponse, D> for &NetworkSetConfigResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NetworkSetConfigResponse)
.write_unaligned((self as *const NetworkSetConfigResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<NetworkSetConfigResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkSetConfigResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkSetup {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkSetup {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkSetup, D>
for &NetworkSetup
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetup>(offset);
fidl::encoding::Encode::<NetworkSetup, D>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
<fidl::encoding::UnboundedVector<EndpointSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoints),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T1: fidl::encoding::Encode<NetworkConfig, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<EndpointSetup>, D>,
> fidl::encoding::Encode<NetworkSetup, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkSetup>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkSetup {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
config: fidl::new_empty!(NetworkConfig, D),
endpoints: fidl::new_empty!(fidl::encoding::UnboundedVector<EndpointSetup>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<EndpointSetup>,
D,
&mut self.endpoints,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkStartCaptureRequest, D> for &NetworkStartCaptureRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
fidl::encoding::Encode::<NetworkStartCaptureRequest, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<NetworkStartCaptureRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkStartCaptureRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkStartCaptureResponse, D> for &NetworkStartCaptureResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NetworkStartCaptureResponse)
.write_unaligned((self as *const NetworkStartCaptureResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<NetworkStartCaptureResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkStartCaptureResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReorderConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReorderConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReorderConfig, D>
for &ReorderConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReorderConfig>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ReorderConfig)
.write_unaligned((self as *const ReorderConfig).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<ReorderConfig, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReorderConfig>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReorderConfig {
#[inline(always)]
fn new_empty() -> Self {
Self { store_buff: fidl::new_empty!(u32, D), tick: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl NetworkConfig {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.reorder {
return 3;
}
if let Some(_) = self.packet_loss {
return 2;
}
if let Some(_) = self.latency {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for NetworkConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkConfig, D>
for &NetworkConfig
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkConfig>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<LatencyConfig, D>(
self.latency
.as_ref()
.map(<LatencyConfig as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<LossConfig, D>(
self.packet_loss
.as_ref()
.map(<LossConfig as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ReorderConfig, D>(
self.reorder
.as_ref()
.map(<ReorderConfig as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkConfig {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<LatencyConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.latency.get_or_insert_with(|| fidl::new_empty!(LatencyConfig, D));
fidl::decode!(LatencyConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<LossConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.packet_loss.get_or_insert_with(|| fidl::new_empty!(LossConfig, D));
fidl::decode!(LossConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ReorderConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.reorder.get_or_insert_with(|| fidl::new_empty!(ReorderConfig, D));
fidl::decode!(ReorderConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LossConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LossConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LossConfig, D>
for &LossConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LossConfig>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
LossConfig::RandomRate(ref val) => fidl::encoding::encode_in_envelope::<u8, D>(
<u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LossConfig {
#[inline(always)]
fn new_empty() -> Self {
Self::RandomRate(fidl::new_empty!(u8, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let LossConfig::RandomRate(_) = self {
} else {
*self = LossConfig::RandomRate(fidl::new_empty!(u8, D));
}
#[allow(irrefutable_let_patterns)]
if let LossConfig::RandomRate(ref mut val) = self {
fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}