#![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;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InspectListChildrenResponse {
pub children_names: Vec<String>,
}
impl fidl::Persistable for InspectListChildrenResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InspectOpenChildRequest {
pub child_name: String,
pub child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectOpenChildRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InspectOpenChildResponse {
pub success: bool,
}
impl fidl::Persistable for InspectOpenChildResponse {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct InspectReadDataResponse {
pub object: Object,
}
impl fidl::Persistable for InspectReadDataResponse {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Metric {
pub key: String,
pub value: MetricValue,
}
impl fidl::Persistable for Metric {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Object {
pub name: String,
pub properties: Vec<Property>,
pub metrics: Vec<Metric>,
}
impl fidl::Persistable for Object {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Property {
pub key: String,
pub value: PropertyValue,
}
impl fidl::Persistable for Property {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub enum MetricValue {
IntValue(i64),
UintValue(u64),
DoubleValue(f64),
}
impl MetricValue {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::IntValue(_) => 1,
Self::UintValue(_) => 2,
Self::DoubleValue(_) => 3,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for MetricValue {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PropertyValue {
Str(String),
Bytes(Vec<u8>),
}
impl PropertyValue {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Str(_) => 1,
Self::Bytes(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for PropertyValue {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InspectMarker;
impl fidl::endpoints::ProtocolMarker for InspectMarker {
type Proxy = InspectProxy;
type RequestStream = InspectRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InspectSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.inspect.deprecated.Inspect";
}
impl fidl::endpoints::DiscoverableProtocolMarker for InspectMarker {}
pub trait InspectProxyInterface: Send + Sync {
type ReadDataResponseFut: std::future::Future<Output = Result<Object, fidl::Error>> + Send;
fn r#read_data(&self) -> Self::ReadDataResponseFut;
type ListChildrenResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
+ Send;
fn r#list_children(&self) -> Self::ListChildrenResponseFut;
type OpenChildResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
fn r#open_child(
&self,
child_name: &str,
child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
) -> Self::OpenChildResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InspectSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InspectSynchronousProxy {
type Proxy = InspectProxy;
type Protocol = InspectMarker;
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 InspectSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <InspectMarker 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<InspectEvent, fidl::Error> {
InspectEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#read_data(&self, ___deadline: zx::MonotonicInstant) -> Result<Object, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, InspectReadDataResponse>(
(),
0x1c6778e57fcfa9e1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.object)
}
pub fn r#list_children(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<String>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, InspectListChildrenResponse>(
(),
0x463fdc024dc40611,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.children_names)
}
pub fn r#open_child(
&self,
mut child_name: &str,
mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<bool, fidl::Error> {
let _response =
self.client.send_query::<InspectOpenChildRequest, InspectOpenChildResponse>(
(child_name, child_channel),
0x30513125b65c866a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.success)
}
}
#[derive(Debug, Clone)]
pub struct InspectProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for InspectProxy {
type Protocol = InspectMarker;
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 InspectProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InspectEventStream {
InspectEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#read_data(
&self,
) -> fidl::client::QueryResponseFut<Object, fidl::encoding::DefaultFuchsiaResourceDialect> {
InspectProxyInterface::r#read_data(self)
}
pub fn r#list_children(
&self,
) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
InspectProxyInterface::r#list_children(self)
}
pub fn r#open_child(
&self,
mut child_name: &str,
mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
InspectProxyInterface::r#open_child(self, child_name, child_channel)
}
}
impl InspectProxyInterface for InspectProxy {
type ReadDataResponseFut =
fidl::client::QueryResponseFut<Object, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#read_data(&self) -> Self::ReadDataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Object, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
InspectReadDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1c6778e57fcfa9e1,
>(_buf?)?;
Ok(_response.object)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Object>(
(),
0x1c6778e57fcfa9e1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ListChildrenResponseFut =
fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#list_children(&self) -> Self::ListChildrenResponseFut {
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::<
InspectListChildrenResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x463fdc024dc40611,
>(_buf?)?;
Ok(_response.children_names)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
(),
0x463fdc024dc40611,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OpenChildResponseFut =
fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#open_child(
&self,
mut child_name: &str,
mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
) -> Self::OpenChildResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
InspectOpenChildResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x30513125b65c866a,
>(_buf?)?;
Ok(_response.success)
}
self.client.send_query_and_decode::<InspectOpenChildRequest, bool>(
(child_name, child_channel),
0x30513125b65c866a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct InspectEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for InspectEventStream {}
impl futures::stream::FusedStream for InspectEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InspectEventStream {
type Item = Result<InspectEvent, 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(InspectEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InspectEvent {}
impl InspectEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<InspectEvent, 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: <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InspectRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for InspectRequestStream {}
impl futures::stream::FusedStream for InspectRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InspectRequestStream {
type Protocol = InspectMarker;
type ControlHandle = InspectControlHandle;
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 {
InspectControlHandle { 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 InspectRequestStream {
type Item = Result<InspectRequest, 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 InspectRequestStream 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 {
0x1c6778e57fcfa9e1 => {
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 = InspectControlHandle { inner: this.inner.clone() };
Ok(InspectRequest::ReadData {
responder: InspectReadDataResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x463fdc024dc40611 => {
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 = InspectControlHandle { inner: this.inner.clone() };
Ok(InspectRequest::ListChildren {
responder: InspectListChildrenResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x30513125b65c866a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
InspectOpenChildRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectOpenChildRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InspectControlHandle { inner: this.inner.clone() };
Ok(InspectRequest::OpenChild {
child_name: req.child_name,
child_channel: req.child_channel,
responder: InspectOpenChildResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum InspectRequest {
ReadData {
responder: InspectReadDataResponder,
},
ListChildren {
responder: InspectListChildrenResponder,
},
OpenChild {
child_name: String,
child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
responder: InspectOpenChildResponder,
},
}
impl InspectRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_read_data(self) -> Option<(InspectReadDataResponder)> {
if let InspectRequest::ReadData { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_list_children(self) -> Option<(InspectListChildrenResponder)> {
if let InspectRequest::ListChildren { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_child(
self,
) -> Option<(String, fidl::endpoints::ServerEnd<InspectMarker>, InspectOpenChildResponder)>
{
if let InspectRequest::OpenChild { child_name, child_channel, responder } = self {
Some((child_name, child_channel, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InspectRequest::ReadData { .. } => "read_data",
InspectRequest::ListChildren { .. } => "list_children",
InspectRequest::OpenChild { .. } => "open_child",
}
}
}
#[derive(Debug, Clone)]
pub struct InspectControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for InspectControlHandle {
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 InspectControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InspectReadDataResponder {
control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InspectReadDataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InspectReadDataResponder {
type ControlHandle = InspectControlHandle;
fn control_handle(&self) -> &InspectControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InspectReadDataResponder {
pub fn send(self, mut object: &Object) -> Result<(), fidl::Error> {
let _result = self.send_raw(object);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut object: &Object) -> Result<(), fidl::Error> {
let _result = self.send_raw(object);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut object: &Object) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<InspectReadDataResponse>(
(object,),
self.tx_id,
0x1c6778e57fcfa9e1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InspectListChildrenResponder {
control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InspectListChildrenResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InspectListChildrenResponder {
type ControlHandle = InspectControlHandle;
fn control_handle(&self) -> &InspectControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InspectListChildrenResponder {
pub fn send(self, mut children_names: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(children_names);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut children_names: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(children_names);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut children_names: &[String]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<InspectListChildrenResponse>(
(children_names,),
self.tx_id,
0x463fdc024dc40611,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InspectOpenChildResponder {
control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InspectOpenChildResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InspectOpenChildResponder {
type ControlHandle = InspectControlHandle;
fn control_handle(&self) -> &InspectControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InspectOpenChildResponder {
pub fn send(self, mut success: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(success);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut success: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(success);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut success: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<InspectOpenChildResponse>(
(success,),
self.tx_id,
0x30513125b65c866a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for InspectListChildrenResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InspectListChildrenResponse {
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<InspectListChildrenResponse, D> for &InspectListChildrenResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InspectListChildrenResponse>(offset);
fidl::encoding::Encode::<InspectListChildrenResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.children_names),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
D,
>,
> fidl::encoding::Encode<InspectListChildrenResponse, 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::<InspectListChildrenResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InspectListChildrenResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
children_names: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
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::UnboundedString>,
D,
&mut self.children_names,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for InspectOpenChildRequest {
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 InspectOpenChildRequest {
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
fidl::encoding::Encode<
InspectOpenChildRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut InspectOpenChildRequest
{
#[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::<InspectOpenChildRequest>(offset);
fidl::encoding::Encode::<InspectOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
InspectOpenChildRequest,
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::<InspectOpenChildRequest>(offset);
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 + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for InspectOpenChildRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
child_name: fidl::new_empty!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect
),
child_channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
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 + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.child_channel,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InspectOpenChildResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InspectOpenChildResponse {
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<InspectOpenChildResponse, D> for &InspectOpenChildResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InspectOpenChildResponse>(offset);
fidl::encoding::Encode::<InspectOpenChildResponse, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<InspectOpenChildResponse, 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::<InspectOpenChildResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InspectOpenChildResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { success: 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.success, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InspectReadDataResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InspectReadDataResponse {
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<InspectReadDataResponse, D> for &InspectReadDataResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InspectReadDataResponse>(offset);
fidl::encoding::Encode::<InspectReadDataResponse, D>::encode(
(<Object as fidl::encoding::ValueTypeMarker>::borrow(&self.object),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Object, D>>
fidl::encoding::Encode<InspectReadDataResponse, 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::<InspectReadDataResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InspectReadDataResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { object: fidl::new_empty!(Object, 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!(Object, D, &mut self.object, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Metric {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Metric {
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<Metric, D> for &Metric {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Metric>(offset);
fidl::encoding::Encode::<Metric, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<MetricValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<MetricValue, D>,
> fidl::encoding::Encode<Metric, 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::<Metric>(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 Metric {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::UnboundedString, D),
value: fidl::new_empty!(MetricValue, 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::UnboundedString,
D,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(MetricValue, D, &mut self.value, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Object {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Object {
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<Object, D> for &Object {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Object>(offset);
fidl::encoding::Encode::<Object, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::UnboundedVector<Property> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
<fidl::encoding::UnboundedVector<Metric> as fidl::encoding::ValueTypeMarker>::borrow(&self.metrics),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Property>, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Metric>, D>,
> fidl::encoding::Encode<Object, 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::<Object>(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 Object {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
properties: fidl::new_empty!(fidl::encoding::UnboundedVector<Property>, D),
metrics: fidl::new_empty!(fidl::encoding::UnboundedVector<Metric>, 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::UnboundedString,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<Property>,
D,
&mut self.properties,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<Metric>,
D,
&mut self.metrics,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Property {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Property {
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<Property, D> for &Property {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Property>(offset);
fidl::encoding::Encode::<Property, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<PropertyValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<PropertyValue, D>,
> fidl::encoding::Encode<Property, 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::<Property>(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 Property {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::UnboundedString, D),
value: fidl::new_empty!(PropertyValue, 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::UnboundedString,
D,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(PropertyValue, D, &mut self.value, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricValue {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricValue {
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<MetricValue, D>
for &MetricValue
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricValue>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
MetricValue::IntValue(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
MetricValue::UintValue(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
MetricValue::DoubleValue(ref val) => fidl::encoding::encode_in_envelope::<f64, D>(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MetricValue {
#[inline(always)]
fn new_empty() -> Self {
Self::IntValue(fidl::new_empty!(i64, 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 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <f64 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 MetricValue::IntValue(_) = self {
} else {
*self = MetricValue::IntValue(fidl::new_empty!(i64, D));
}
#[allow(irrefutable_let_patterns)]
if let MetricValue::IntValue(ref mut val) = self {
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let MetricValue::UintValue(_) = self {
} else {
*self = MetricValue::UintValue(fidl::new_empty!(u64, D));
}
#[allow(irrefutable_let_patterns)]
if let MetricValue::UintValue(ref mut val) = self {
fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let MetricValue::DoubleValue(_) = self {
} else {
*self = MetricValue::DoubleValue(fidl::new_empty!(f64, D));
}
#[allow(irrefutable_let_patterns)]
if let MetricValue::DoubleValue(ref mut val) = self {
fidl::decode!(f64, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for PropertyValue {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PropertyValue {
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<PropertyValue, D>
for &PropertyValue
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PropertyValue>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
PropertyValue::Str(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedString, D>(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
PropertyValue::Bytes(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyValue {
#[inline(always)]
fn new_empty() -> Self {
Self::Str(fidl::new_empty!(fidl::encoding::UnboundedString, 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 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => {
<fidl::encoding::UnboundedVector<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 PropertyValue::Str(_) = self {
} else {
*self = PropertyValue::Str(fidl::new_empty!(
fidl::encoding::UnboundedString,
D
));
}
#[allow(irrefutable_let_patterns)]
if let PropertyValue::Str(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedString,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let PropertyValue::Bytes(_) = self {
} else {
*self = PropertyValue::Bytes(fidl::new_empty!(
fidl::encoding::UnboundedVector<u8>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let PropertyValue::Bytes(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<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(())
}
}
}