#![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 type EventVector = Vec<u32>;
pub type IntegerHistogram = Vec<HistogramBucket>;
pub const MAX_BATCHED_EVENTS: u32 = 500;
pub const MAX_BYTES_PER_EVENT: i64 = 102400;
pub const MAX_EXPERIMENT_IDS: u32 = 100;
pub const MAX_HISTOGRAM_BUCKETS: u32 = 500;
pub const MAX_METRIC_DIMENSIONS: u32 = 10;
pub const MAX_STRING_EVENT_SIZE: u32 = 256;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(i32)]
pub enum Error {
InvalidArguments = 1,
EventTooBig = 2,
BufferFull = 3,
ShutDown = 4,
InternalError = -1,
}
impl Error {
#[inline]
pub fn from_primitive(prim: i32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidArguments),
2 => Some(Self::EventTooBig),
3 => Some(Self::BufferFull),
4 => Some(Self::ShutDown),
-1 => Some(Self::InternalError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> i32 {
self as i32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HistogramBucket {
pub index: u32,
pub count: u64,
}
impl fidl::Persistable for HistogramBucket {}
#[derive(Clone, Debug, PartialEq)]
pub struct MetricEvent {
pub metric_id: u32,
pub event_codes: Vec<u32>,
pub payload: MetricEventPayload,
}
impl fidl::Persistable for MetricEvent {}
#[derive(Debug, PartialEq)]
pub struct MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
pub project_spec: ProjectSpec,
pub logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for MetricEventLoggerFactoryCreateMetricEventLoggerRequest
{
}
#[derive(Debug, PartialEq)]
pub struct MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest {
pub project_spec: ProjectSpec,
pub experiment_ids: Vec<u32>,
pub logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MetricEventLoggerLogIntegerHistogramRequest {
pub metric_id: u32,
pub histogram: Vec<HistogramBucket>,
pub event_codes: Vec<u32>,
}
impl fidl::Persistable for MetricEventLoggerLogIntegerHistogramRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MetricEventLoggerLogIntegerRequest {
pub metric_id: u32,
pub value: i64,
pub event_codes: Vec<u32>,
}
impl fidl::Persistable for MetricEventLoggerLogIntegerRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct MetricEventLoggerLogMetricEventsRequest {
pub events: Vec<MetricEvent>,
}
impl fidl::Persistable for MetricEventLoggerLogMetricEventsRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MetricEventLoggerLogOccurrenceRequest {
pub metric_id: u32,
pub count: u64,
pub event_codes: Vec<u32>,
}
impl fidl::Persistable for MetricEventLoggerLogOccurrenceRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MetricEventLoggerLogStringRequest {
pub metric_id: u32,
pub string_value: String,
pub event_codes: Vec<u32>,
}
impl fidl::Persistable for MetricEventLoggerLogStringRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProjectSpec {
pub customer_id: Option<u32>,
pub project_id: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProjectSpec {}
#[derive(Clone, Debug)]
pub enum MetricEventPayload {
Count(u64),
IntegerValue(i64),
Histogram(Vec<HistogramBucket>),
StringValue(String),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! MetricEventPayloadUnknown {
() => {
_
};
}
impl PartialEq for MetricEventPayload {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Count(x), Self::Count(y)) => *x == *y,
(Self::IntegerValue(x), Self::IntegerValue(y)) => *x == *y,
(Self::Histogram(x), Self::Histogram(y)) => *x == *y,
(Self::StringValue(x), Self::StringValue(y)) => *x == *y,
_ => false,
}
}
}
impl MetricEventPayload {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Count(_) => 1,
Self::IntegerValue(_) => 2,
Self::Histogram(_) => 3,
Self::StringValue(_) => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for MetricEventPayload {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MetricEventLoggerMarker;
impl fidl::endpoints::ProtocolMarker for MetricEventLoggerMarker {
type Proxy = MetricEventLoggerProxy;
type RequestStream = MetricEventLoggerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MetricEventLoggerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MetricEventLogger";
}
pub type MetricEventLoggerLogOccurrenceResult = Result<(), Error>;
pub type MetricEventLoggerLogIntegerResult = Result<(), Error>;
pub type MetricEventLoggerLogIntegerHistogramResult = Result<(), Error>;
pub type MetricEventLoggerLogStringResult = Result<(), Error>;
pub type MetricEventLoggerLogMetricEventsResult = Result<(), Error>;
pub trait MetricEventLoggerProxyInterface: Send + Sync {
type LogOccurrenceResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogOccurrenceResult, fidl::Error>>
+ Send;
fn r#log_occurrence(
&self,
metric_id: u32,
count: u64,
event_codes: &[u32],
) -> Self::LogOccurrenceResponseFut;
type LogIntegerResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogIntegerResult, fidl::Error>>
+ Send;
fn r#log_integer(
&self,
metric_id: u32,
value: i64,
event_codes: &[u32],
) -> Self::LogIntegerResponseFut;
type LogIntegerHistogramResponseFut: std::future::Future<
Output = Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error>,
> + Send;
fn r#log_integer_histogram(
&self,
metric_id: u32,
histogram: &[HistogramBucket],
event_codes: &[u32],
) -> Self::LogIntegerHistogramResponseFut;
type LogStringResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogStringResult, fidl::Error>>
+ Send;
fn r#log_string(
&self,
metric_id: u32,
string_value: &str,
event_codes: &[u32],
) -> Self::LogStringResponseFut;
type LogMetricEventsResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogMetricEventsResult, fidl::Error>>
+ Send;
fn r#log_metric_events(&self, events: &[MetricEvent]) -> Self::LogMetricEventsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MetricEventLoggerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MetricEventLoggerSynchronousProxy {
type Proxy = MetricEventLoggerProxy;
type Protocol = MetricEventLoggerMarker;
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 MetricEventLoggerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<MetricEventLoggerMarker 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<MetricEventLoggerEvent, fidl::Error> {
MetricEventLoggerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#log_occurrence(
&self,
mut metric_id: u32,
mut count: u64,
mut event_codes: &[u32],
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerLogOccurrenceResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerLogOccurrenceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(metric_id, count, event_codes,),
0x26308985ae2bb3ac,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#log_integer(
&self,
mut metric_id: u32,
mut value: i64,
mut event_codes: &[u32],
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerLogIntegerResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerLogIntegerRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(metric_id, value, event_codes,),
0x5d453303a88bd552,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#log_integer_histogram(
&self,
mut metric_id: u32,
mut histogram: &[HistogramBucket],
mut event_codes: &[u32],
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerLogIntegerHistogramRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(metric_id, histogram, event_codes,),
0x79ac8a6bc06a01c0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#log_string(
&self,
mut metric_id: u32,
mut string_value: &str,
mut event_codes: &[u32],
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerLogStringResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerLogStringRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(metric_id, string_value, event_codes,),
0x1611efbdf6ac8300,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#log_metric_events(
&self,
mut events: &[MetricEvent],
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerLogMetricEventsResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerLogMetricEventsRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(events,),
0x4d8c26bb74820c6b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct MetricEventLoggerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MetricEventLoggerProxy {
type Protocol = MetricEventLoggerMarker;
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 MetricEventLoggerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MetricEventLoggerEventStream {
MetricEventLoggerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#log_occurrence(
&self,
mut metric_id: u32,
mut count: u64,
mut event_codes: &[u32],
) -> fidl::client::QueryResponseFut<
MetricEventLoggerLogOccurrenceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerProxyInterface::r#log_occurrence(self, metric_id, count, event_codes)
}
pub fn r#log_integer(
&self,
mut metric_id: u32,
mut value: i64,
mut event_codes: &[u32],
) -> fidl::client::QueryResponseFut<
MetricEventLoggerLogIntegerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerProxyInterface::r#log_integer(self, metric_id, value, event_codes)
}
pub fn r#log_integer_histogram(
&self,
mut metric_id: u32,
mut histogram: &[HistogramBucket],
mut event_codes: &[u32],
) -> fidl::client::QueryResponseFut<
MetricEventLoggerLogIntegerHistogramResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerProxyInterface::r#log_integer_histogram(
self,
metric_id,
histogram,
event_codes,
)
}
pub fn r#log_string(
&self,
mut metric_id: u32,
mut string_value: &str,
mut event_codes: &[u32],
) -> fidl::client::QueryResponseFut<
MetricEventLoggerLogStringResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerProxyInterface::r#log_string(self, metric_id, string_value, event_codes)
}
pub fn r#log_metric_events(
&self,
mut events: &[MetricEvent],
) -> fidl::client::QueryResponseFut<
MetricEventLoggerLogMetricEventsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerProxyInterface::r#log_metric_events(self, events)
}
}
impl MetricEventLoggerProxyInterface for MetricEventLoggerProxy {
type LogOccurrenceResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerLogOccurrenceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#log_occurrence(
&self,
mut metric_id: u32,
mut count: u64,
mut event_codes: &[u32],
) -> Self::LogOccurrenceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerLogOccurrenceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x26308985ae2bb3ac,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerLogOccurrenceRequest,
MetricEventLoggerLogOccurrenceResult,
>(
(metric_id, count, event_codes,),
0x26308985ae2bb3ac,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LogIntegerResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerLogIntegerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#log_integer(
&self,
mut metric_id: u32,
mut value: i64,
mut event_codes: &[u32],
) -> Self::LogIntegerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerLogIntegerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5d453303a88bd552,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerLogIntegerRequest,
MetricEventLoggerLogIntegerResult,
>(
(metric_id, value, event_codes,),
0x5d453303a88bd552,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LogIntegerHistogramResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerLogIntegerHistogramResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#log_integer_histogram(
&self,
mut metric_id: u32,
mut histogram: &[HistogramBucket],
mut event_codes: &[u32],
) -> Self::LogIntegerHistogramResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x79ac8a6bc06a01c0,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerLogIntegerHistogramRequest,
MetricEventLoggerLogIntegerHistogramResult,
>(
(metric_id, histogram, event_codes,),
0x79ac8a6bc06a01c0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LogStringResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerLogStringResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#log_string(
&self,
mut metric_id: u32,
mut string_value: &str,
mut event_codes: &[u32],
) -> Self::LogStringResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerLogStringResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1611efbdf6ac8300,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerLogStringRequest,
MetricEventLoggerLogStringResult,
>(
(metric_id, string_value, event_codes,),
0x1611efbdf6ac8300,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LogMetricEventsResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerLogMetricEventsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#log_metric_events(&self, mut events: &[MetricEvent]) -> Self::LogMetricEventsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerLogMetricEventsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4d8c26bb74820c6b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerLogMetricEventsRequest,
MetricEventLoggerLogMetricEventsResult,
>(
(events,),
0x4d8c26bb74820c6b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MetricEventLoggerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MetricEventLoggerEventStream {}
impl futures::stream::FusedStream for MetricEventLoggerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MetricEventLoggerEventStream {
type Item = Result<MetricEventLoggerEvent, 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(MetricEventLoggerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MetricEventLoggerEvent {}
impl MetricEventLoggerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MetricEventLoggerEvent, 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:
<MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MetricEventLoggerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MetricEventLoggerRequestStream {}
impl futures::stream::FusedStream for MetricEventLoggerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MetricEventLoggerRequestStream {
type Protocol = MetricEventLoggerMarker;
type ControlHandle = MetricEventLoggerControlHandle;
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 {
MetricEventLoggerControlHandle { 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 MetricEventLoggerRequestStream {
type Item = Result<MetricEventLoggerRequest, 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 MetricEventLoggerRequestStream 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 {
0x26308985ae2bb3ac => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MetricEventLoggerLogOccurrenceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogOccurrenceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MetricEventLoggerControlHandle { inner: this.inner.clone() };
Ok(MetricEventLoggerRequest::LogOccurrence {
metric_id: req.metric_id,
count: req.count,
event_codes: req.event_codes,
responder: MetricEventLoggerLogOccurrenceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5d453303a88bd552 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MetricEventLoggerLogIntegerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogIntegerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MetricEventLoggerControlHandle { inner: this.inner.clone() };
Ok(MetricEventLoggerRequest::LogInteger {
metric_id: req.metric_id,
value: req.value,
event_codes: req.event_codes,
responder: MetricEventLoggerLogIntegerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x79ac8a6bc06a01c0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MetricEventLoggerLogIntegerHistogramRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogIntegerHistogramRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MetricEventLoggerControlHandle { inner: this.inner.clone() };
Ok(MetricEventLoggerRequest::LogIntegerHistogram {
metric_id: req.metric_id,
histogram: req.histogram,
event_codes: req.event_codes,
responder: MetricEventLoggerLogIntegerHistogramResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1611efbdf6ac8300 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MetricEventLoggerLogStringRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogStringRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MetricEventLoggerControlHandle { inner: this.inner.clone() };
Ok(MetricEventLoggerRequest::LogString {
metric_id: req.metric_id,
string_value: req.string_value,
event_codes: req.event_codes,
responder: MetricEventLoggerLogStringResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4d8c26bb74820c6b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MetricEventLoggerLogMetricEventsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogMetricEventsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MetricEventLoggerControlHandle { inner: this.inner.clone() };
Ok(MetricEventLoggerRequest::LogMetricEvents {
events: req.events,
responder: MetricEventLoggerLogMetricEventsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MetricEventLoggerRequest {
LogOccurrence {
metric_id: u32,
count: u64,
event_codes: Vec<u32>,
responder: MetricEventLoggerLogOccurrenceResponder,
},
LogInteger {
metric_id: u32,
value: i64,
event_codes: Vec<u32>,
responder: MetricEventLoggerLogIntegerResponder,
},
LogIntegerHistogram {
metric_id: u32,
histogram: Vec<HistogramBucket>,
event_codes: Vec<u32>,
responder: MetricEventLoggerLogIntegerHistogramResponder,
},
LogString {
metric_id: u32,
string_value: String,
event_codes: Vec<u32>,
responder: MetricEventLoggerLogStringResponder,
},
LogMetricEvents {
events: Vec<MetricEvent>,
responder: MetricEventLoggerLogMetricEventsResponder,
},
}
impl MetricEventLoggerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_log_occurrence(
self,
) -> Option<(u32, u64, Vec<u32>, MetricEventLoggerLogOccurrenceResponder)> {
if let MetricEventLoggerRequest::LogOccurrence {
metric_id,
count,
event_codes,
responder,
} = self
{
Some((metric_id, count, event_codes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_log_integer(
self,
) -> Option<(u32, i64, Vec<u32>, MetricEventLoggerLogIntegerResponder)> {
if let MetricEventLoggerRequest::LogInteger { metric_id, value, event_codes, responder } =
self
{
Some((metric_id, value, event_codes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_log_integer_histogram(
self,
) -> Option<(u32, Vec<HistogramBucket>, Vec<u32>, MetricEventLoggerLogIntegerHistogramResponder)>
{
if let MetricEventLoggerRequest::LogIntegerHistogram {
metric_id,
histogram,
event_codes,
responder,
} = self
{
Some((metric_id, histogram, event_codes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_log_string(
self,
) -> Option<(u32, String, Vec<u32>, MetricEventLoggerLogStringResponder)> {
if let MetricEventLoggerRequest::LogString {
metric_id,
string_value,
event_codes,
responder,
} = self
{
Some((metric_id, string_value, event_codes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_log_metric_events(
self,
) -> Option<(Vec<MetricEvent>, MetricEventLoggerLogMetricEventsResponder)> {
if let MetricEventLoggerRequest::LogMetricEvents { events, responder } = self {
Some((events, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MetricEventLoggerRequest::LogOccurrence { .. } => "log_occurrence",
MetricEventLoggerRequest::LogInteger { .. } => "log_integer",
MetricEventLoggerRequest::LogIntegerHistogram { .. } => "log_integer_histogram",
MetricEventLoggerRequest::LogString { .. } => "log_string",
MetricEventLoggerRequest::LogMetricEvents { .. } => "log_metric_events",
}
}
}
#[derive(Debug, Clone)]
pub struct MetricEventLoggerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MetricEventLoggerControlHandle {
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 MetricEventLoggerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerLogOccurrenceResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerLogOccurrenceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerLogOccurrenceResponder {
type ControlHandle = MetricEventLoggerControlHandle;
fn control_handle(&self) -> &MetricEventLoggerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerLogOccurrenceResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x26308985ae2bb3ac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerLogIntegerResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerLogIntegerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerLogIntegerResponder {
type ControlHandle = MetricEventLoggerControlHandle;
fn control_handle(&self) -> &MetricEventLoggerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerLogIntegerResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x5d453303a88bd552,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerLogIntegerHistogramResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerLogIntegerHistogramResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerLogIntegerHistogramResponder {
type ControlHandle = MetricEventLoggerControlHandle;
fn control_handle(&self) -> &MetricEventLoggerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerLogIntegerHistogramResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x79ac8a6bc06a01c0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerLogStringResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerLogStringResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerLogStringResponder {
type ControlHandle = MetricEventLoggerControlHandle;
fn control_handle(&self) -> &MetricEventLoggerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerLogStringResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x1611efbdf6ac8300,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerLogMetricEventsResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerLogMetricEventsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerLogMetricEventsResponder {
type ControlHandle = MetricEventLoggerControlHandle;
fn control_handle(&self) -> &MetricEventLoggerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerLogMetricEventsResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x4d8c26bb74820c6b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MetricEventLoggerFactoryMarker;
impl fidl::endpoints::ProtocolMarker for MetricEventLoggerFactoryMarker {
type Proxy = MetricEventLoggerFactoryProxy;
type RequestStream = MetricEventLoggerFactoryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MetricEventLoggerFactorySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.metrics.MetricEventLoggerFactory";
}
impl fidl::endpoints::DiscoverableProtocolMarker for MetricEventLoggerFactoryMarker {}
pub type MetricEventLoggerFactoryCreateMetricEventLoggerResult = Result<(), Error>;
pub type MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult = Result<(), Error>;
pub trait MetricEventLoggerFactoryProxyInterface: Send + Sync {
type CreateMetricEventLoggerResponseFut: std::future::Future<
Output = Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error>,
> + Send;
fn r#create_metric_event_logger(
&self,
project_spec: &ProjectSpec,
logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> Self::CreateMetricEventLoggerResponseFut;
type CreateMetricEventLoggerWithExperimentsResponseFut: std::future::Future<
Output = Result<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
fidl::Error,
>,
> + Send;
fn r#create_metric_event_logger_with_experiments(
&self,
project_spec: &ProjectSpec,
experiment_ids: &[u32],
logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> Self::CreateMetricEventLoggerWithExperimentsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MetricEventLoggerFactorySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MetricEventLoggerFactorySynchronousProxy {
type Proxy = MetricEventLoggerFactoryProxy;
type Protocol = MetricEventLoggerFactoryMarker;
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 MetricEventLoggerFactorySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<MetricEventLoggerFactoryMarker 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<MetricEventLoggerFactoryEvent, fidl::Error> {
MetricEventLoggerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_metric_event_logger(
&self,
mut project_spec: &ProjectSpec,
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error> {
let _response = self.client.send_query::<
MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(project_spec, logger,),
0xd6cf51cee5039fe,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#create_metric_event_logger_with_experiments(
&self,
mut project_spec: &ProjectSpec,
mut experiment_ids: &[u32],
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult, fidl::Error>
{
let _response = self.client.send_query::<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(project_spec, experiment_ids, logger,),
0x7f1f745ef7bf48fa,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct MetricEventLoggerFactoryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MetricEventLoggerFactoryProxy {
type Protocol = MetricEventLoggerFactoryMarker;
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 MetricEventLoggerFactoryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MetricEventLoggerFactoryEventStream {
MetricEventLoggerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_metric_event_logger(
&self,
mut project_spec: &ProjectSpec,
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> fidl::client::QueryResponseFut<
MetricEventLoggerFactoryCreateMetricEventLoggerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerFactoryProxyInterface::r#create_metric_event_logger(
self,
project_spec,
logger,
)
}
pub fn r#create_metric_event_logger_with_experiments(
&self,
mut project_spec: &ProjectSpec,
mut experiment_ids: &[u32],
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> fidl::client::QueryResponseFut<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MetricEventLoggerFactoryProxyInterface::r#create_metric_event_logger_with_experiments(
self,
project_spec,
experiment_ids,
logger,
)
}
}
impl MetricEventLoggerFactoryProxyInterface for MetricEventLoggerFactoryProxy {
type CreateMetricEventLoggerResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerFactoryCreateMetricEventLoggerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_metric_event_logger(
&self,
mut project_spec: &ProjectSpec,
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> Self::CreateMetricEventLoggerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xd6cf51cee5039fe,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
MetricEventLoggerFactoryCreateMetricEventLoggerResult,
>(
(project_spec, logger,),
0xd6cf51cee5039fe,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateMetricEventLoggerWithExperimentsResponseFut = fidl::client::QueryResponseFut<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_metric_event_logger_with_experiments(
&self,
mut project_spec: &ProjectSpec,
mut experiment_ids: &[u32],
mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
) -> Self::CreateMetricEventLoggerWithExperimentsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult, fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7f1f745ef7bf48fa,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
>(
(project_spec, experiment_ids, logger,),
0x7f1f745ef7bf48fa,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MetricEventLoggerFactoryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MetricEventLoggerFactoryEventStream {}
impl futures::stream::FusedStream for MetricEventLoggerFactoryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MetricEventLoggerFactoryEventStream {
type Item = Result<MetricEventLoggerFactoryEvent, 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(MetricEventLoggerFactoryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MetricEventLoggerFactoryEvent {}
impl MetricEventLoggerFactoryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MetricEventLoggerFactoryEvent, 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:
<MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MetricEventLoggerFactoryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MetricEventLoggerFactoryRequestStream {}
impl futures::stream::FusedStream for MetricEventLoggerFactoryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MetricEventLoggerFactoryRequestStream {
type Protocol = MetricEventLoggerFactoryMarker;
type ControlHandle = MetricEventLoggerFactoryControlHandle;
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 {
MetricEventLoggerFactoryControlHandle { 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 MetricEventLoggerFactoryRequestStream {
type Item = Result<MetricEventLoggerFactoryRequest, 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 MetricEventLoggerFactoryRequestStream 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 {
0xd6cf51cee5039fe => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(MetricEventLoggerFactoryCreateMetricEventLoggerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = MetricEventLoggerFactoryControlHandle {
inner: this.inner.clone(),
};
Ok(MetricEventLoggerFactoryRequest::CreateMetricEventLogger {project_spec: req.project_spec,
logger: req.logger,
responder: MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7f1f745ef7bf48fa => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = MetricEventLoggerFactoryControlHandle {
inner: this.inner.clone(),
};
Ok(MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments {project_spec: req.project_spec,
experiment_ids: req.experiment_ids,
logger: req.logger,
responder: MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MetricEventLoggerFactoryRequest {
CreateMetricEventLogger {
project_spec: ProjectSpec,
logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
responder: MetricEventLoggerFactoryCreateMetricEventLoggerResponder,
},
CreateMetricEventLoggerWithExperiments {
project_spec: ProjectSpec,
experiment_ids: Vec<u32>,
logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
responder: MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder,
},
}
impl MetricEventLoggerFactoryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_metric_event_logger(
self,
) -> Option<(
ProjectSpec,
fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
MetricEventLoggerFactoryCreateMetricEventLoggerResponder,
)> {
if let MetricEventLoggerFactoryRequest::CreateMetricEventLogger {
project_spec,
logger,
responder,
} = self
{
Some((project_spec, logger, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_metric_event_logger_with_experiments(
self,
) -> Option<(
ProjectSpec,
Vec<u32>,
fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder,
)> {
if let MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments {
project_spec,
experiment_ids,
logger,
responder,
} = self
{
Some((project_spec, experiment_ids, logger, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MetricEventLoggerFactoryRequest::CreateMetricEventLogger { .. } => {
"create_metric_event_logger"
}
MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments { .. } => {
"create_metric_event_logger_with_experiments"
}
}
}
}
#[derive(Debug, Clone)]
pub struct MetricEventLoggerFactoryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MetricEventLoggerFactoryControlHandle {
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 MetricEventLoggerFactoryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerFactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
type ControlHandle = MetricEventLoggerFactoryControlHandle;
fn control_handle(&self) -> &MetricEventLoggerFactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0xd6cf51cee5039fe,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
control_handle: std::mem::ManuallyDrop<MetricEventLoggerFactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder
for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder
{
type ControlHandle = MetricEventLoggerFactoryControlHandle;
fn control_handle(&self) -> &MetricEventLoggerFactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x7f1f745ef7bf48fa,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Error {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<i32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<i32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Error {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self::InternalError
}
#[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 prim = decoder.read_num::<i32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HistogramBucket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HistogramBucket {
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<HistogramBucket, D>
for &HistogramBucket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HistogramBucket>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HistogramBucket)
.write_unaligned((self as *const HistogramBucket).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<HistogramBucket, 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::<HistogramBucket>(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 HistogramBucket {
#[inline(always)]
fn new_empty() -> Self {
Self { index: fidl::new_empty!(u32, D), count: 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 fidl::encoding::ValueTypeMarker for MetricEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEvent {
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<MetricEvent, D>
for &MetricEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEvent>(offset);
fidl::encoding::Encode::<MetricEvent, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric_id),
<fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(
&self.event_codes,
),
<MetricEventPayload as fidl::encoding::ValueTypeMarker>::borrow(&self.payload),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
T2: fidl::encoding::Encode<MetricEventPayload, D>,
> fidl::encoding::Encode<MetricEvent, 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::<MetricEvent>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MetricEvent {
#[inline(always)]
fn new_empty() -> Self {
Self {
metric_id: fidl::new_empty!(u32, D),
event_codes: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, D),
payload: fidl::new_empty!(MetricEventPayload, 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 = 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,
});
}
fidl::decode!(u32, D, &mut self.metric_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.event_codes, decoder, offset + 8, _depth)?;
fidl::decode!(MetricEventPayload, D, &mut self.payload, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
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 MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
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<
MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut MetricEventLoggerFactoryCreateMetricEventLoggerRequest
{
#[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::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(
offset,
);
fidl::encoding::Encode::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<ProjectSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.project_spec),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.logger),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProjectSpec, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
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::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(
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 MetricEventLoggerFactoryCreateMetricEventLoggerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
project_spec: fidl::new_empty!(
ProjectSpec,
fidl::encoding::DefaultFuchsiaResourceDialect
),
logger: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
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!(
ProjectSpec,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.project_spec,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.logger,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker
for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
{
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 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
{
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
fidl::encoding::Encode<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
{
#[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::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<ProjectSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.project_spec),
<fidl::encoding::Vector<u32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.experiment_ids),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.logger),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProjectSpec, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<u32, 100>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[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::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(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 + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
project_spec: fidl::new_empty!(
ProjectSpec,
fidl::encoding::DefaultFuchsiaResourceDialect
),
experiment_ids: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, fidl::encoding::DefaultFuchsiaResourceDialect),
logger: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
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(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
ProjectSpec,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.project_spec,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<u32, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.experiment_ids, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.logger,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricEventLoggerLogIntegerHistogramRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerLogIntegerHistogramRequest {
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<MetricEventLoggerLogIntegerHistogramRequest, D>
for &MetricEventLoggerLogIntegerHistogramRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventLoggerLogIntegerHistogramRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerLogIntegerHistogramRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric_id),
<fidl::encoding::Vector<HistogramBucket, 500> as fidl::encoding::ValueTypeMarker>::borrow(&self.histogram),
<fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(&self.event_codes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<HistogramBucket, 500>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
> fidl::encoding::Encode<MetricEventLoggerLogIntegerHistogramRequest, 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::<MetricEventLoggerLogIntegerHistogramRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MetricEventLoggerLogIntegerHistogramRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
metric_id: fidl::new_empty!(u32, D),
histogram: fidl::new_empty!(fidl::encoding::Vector<HistogramBucket, 500>, D),
event_codes: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, 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 = 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,
});
}
fidl::decode!(u32, D, &mut self.metric_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<HistogramBucket, 500>, D, &mut self.histogram, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.event_codes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricEventLoggerLogIntegerRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerLogIntegerRequest {
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<MetricEventLoggerLogIntegerRequest, D>
for &MetricEventLoggerLogIntegerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventLoggerLogIntegerRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerLogIntegerRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric_id),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(
&self.event_codes,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<i64, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
> fidl::encoding::Encode<MetricEventLoggerLogIntegerRequest, 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::<MetricEventLoggerLogIntegerRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MetricEventLoggerLogIntegerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
metric_id: fidl::new_empty!(u32, D),
value: fidl::new_empty!(i64, D),
event_codes: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, 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 = 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,
});
}
fidl::decode!(u32, D, &mut self.metric_id, decoder, offset + 0, _depth)?;
fidl::decode!(i64, D, &mut self.value, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.event_codes, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricEventLoggerLogMetricEventsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerLogMetricEventsRequest {
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<MetricEventLoggerLogMetricEventsRequest, D>
for &MetricEventLoggerLogMetricEventsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventLoggerLogMetricEventsRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerLogMetricEventsRequest, D>::encode(
(
<fidl::encoding::Vector<MetricEvent, 500> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<MetricEvent, 500>, D>,
> fidl::encoding::Encode<MetricEventLoggerLogMetricEventsRequest, 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::<MetricEventLoggerLogMetricEventsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MetricEventLoggerLogMetricEventsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { events: fidl::new_empty!(fidl::encoding::Vector<MetricEvent, 500>, 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::Vector<MetricEvent, 500>, D, &mut self.events, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricEventLoggerLogOccurrenceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerLogOccurrenceRequest {
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<MetricEventLoggerLogOccurrenceRequest, D>
for &MetricEventLoggerLogOccurrenceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventLoggerLogOccurrenceRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerLogOccurrenceRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric_id),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.count),
<fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(
&self.event_codes,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
> fidl::encoding::Encode<MetricEventLoggerLogOccurrenceRequest, 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::<MetricEventLoggerLogOccurrenceRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MetricEventLoggerLogOccurrenceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
metric_id: fidl::new_empty!(u32, D),
count: fidl::new_empty!(u64, D),
event_codes: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, 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 = 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,
});
}
fidl::decode!(u32, D, &mut self.metric_id, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.count, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.event_codes, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MetricEventLoggerLogStringRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerLogStringRequest {
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<MetricEventLoggerLogStringRequest, D>
for &MetricEventLoggerLogStringRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventLoggerLogStringRequest>(offset);
fidl::encoding::Encode::<MetricEventLoggerLogStringRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric_id),
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.string_value,
),
<fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(
&self.event_codes,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
> fidl::encoding::Encode<MetricEventLoggerLogStringRequest, 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::<MetricEventLoggerLogStringRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MetricEventLoggerLogStringRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
metric_id: fidl::new_empty!(u32, D),
string_value: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
event_codes: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, 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 = 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,
});
}
fidl::decode!(u32, D, &mut self.metric_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
&mut self.string_value,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.event_codes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl ProjectSpec {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.project_id {
return 2;
}
if let Some(_) = self.customer_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ProjectSpec {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProjectSpec {
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<ProjectSpec, D>
for &ProjectSpec
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProjectSpec>(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::<u32, D>(
self.customer_id.as_ref().map(<u32 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::<u32, D>(
self.project_id.as_ref().map(<u32 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 ProjectSpec {
#[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 =
<u32 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.customer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 =
<u32 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.project_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 MetricEventPayload {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MetricEventPayload {
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<MetricEventPayload, D>
for &MetricEventPayload
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MetricEventPayload>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
MetricEventPayload::Count(ref val) => {
fidl::encoding::encode_in_envelope::<u64, D>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MetricEventPayload::IntegerValue(ref val) => {
fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MetricEventPayload::Histogram(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<HistogramBucket, 500>, D>(
<fidl::encoding::Vector<HistogramBucket, 500> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MetricEventPayload::StringValue(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<256>, D>(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
MetricEventPayload::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MetricEventPayload {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl::encoding::Vector<HistogramBucket, 500> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 MetricEventPayload::Count(_) = self {
} else {
*self = MetricEventPayload::Count(fidl::new_empty!(u64, D));
}
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::Count(ref mut val) = self {
fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::IntegerValue(_) = self {
} else {
*self = MetricEventPayload::IntegerValue(fidl::new_empty!(i64, D));
}
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::IntegerValue(ref mut val) = self {
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::Histogram(_) = self {
} else {
*self = MetricEventPayload::Histogram(
fidl::new_empty!(fidl::encoding::Vector<HistogramBucket, 500>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::Histogram(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<HistogramBucket, 500>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::StringValue(_) = self {
} else {
*self = MetricEventPayload::StringValue(fidl::new_empty!(
fidl::encoding::BoundedString<256>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let MetricEventPayload::StringValue(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = MetricEventPayload::__SourceBreaking { unknown_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(())
}
}
}