#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
Unknown = 1,
Internal = 2,
Resource = 3,
Network = 4,
Hardware = 5,
Protocol = 6,
ProtocolUnrecoverable = 7,
RateLimited = 8,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unknown),
2 => Some(Self::Internal),
3 => Some(Self::Resource),
4 => Some(Self::Network),
5 => Some(Self::Hardware),
6 => Some(Self::Protocol),
7 => Some(Self::ProtocolUnrecoverable),
8 => Some(Self::RateLimited),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Status {
Initializing = 0,
Ok = 1,
UnknownUnhealthy = 2,
Network = 3,
Hardware = 4,
Protocol = 5,
Resource = 6,
}
impl Status {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Initializing),
1 => Some(Self::Ok),
2 => Some(Self::UnknownUnhealthy),
3 => Some(Self::Network),
4 => Some(Self::Hardware),
5 => Some(Self::Protocol),
6 => Some(Self::Resource),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Urgency {
High,
Medium,
Low,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! UrgencyUnknown {
() => {
_
};
}
impl Urgency {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::High),
2 => Some(Self::Medium),
3 => Some(Self::Low),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::High,
2 => Self::Medium,
3 => Self::Low,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::High => 1,
Self::Medium => 2,
Self::Low => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PullSourceNextPossibleSampleTimeResponse {
pub next_possible_time: i64,
}
impl fidl::Persistable for PullSourceNextPossibleSampleTimeResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PullSourceSampleRequest {
pub urgency: Urgency,
}
impl fidl::Persistable for PullSourceSampleRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PullSourceSampleResponse {
pub sample: TimeSample,
}
impl fidl::Persistable for PullSourceSampleResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct PushSourceWatchSampleResponse {
pub sample: TimeSample,
}
impl fidl::Persistable for PushSourceWatchSampleResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PushSourceWatchStatusResponse {
pub status: Status,
}
impl fidl::Persistable for PushSourceWatchStatusResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct TimeSourceUpdateDevicePropertiesRequest {
pub properties: Properties,
}
impl fidl::Persistable for TimeSourceUpdateDevicePropertiesRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Properties {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Properties {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TimeSample {
pub utc: Option<i64>,
pub monotonic: Option<i64>,
pub standard_deviation: Option<i64>,
pub reference: Option<fidl::BootInstant>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for TimeSample {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PullSourceMarker;
impl fidl::endpoints::ProtocolMarker for PullSourceMarker {
type Proxy = PullSourceProxy;
type RequestStream = PullSourceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PullSourceSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.time.external.PullSource";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PullSourceMarker {}
pub type PullSourceSampleResult = Result<TimeSample, Error>;
pub trait PullSourceProxyInterface: Send + Sync {
fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
type SampleResponseFut: std::future::Future<Output = Result<PullSourceSampleResult, fidl::Error>>
+ Send;
fn r#sample(&self, urgency: Urgency) -> Self::SampleResponseFut;
type NextPossibleSampleTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>>
+ Send;
fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PullSourceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PullSourceSynchronousProxy {
type Proxy = PullSourceProxy;
type Protocol = PullSourceMarker;
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 PullSourceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PullSourceMarker 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<PullSourceEvent, fidl::Error> {
PullSourceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#sample(
&self,
mut urgency: Urgency,
___deadline: zx::MonotonicInstant,
) -> Result<PullSourceSampleResult, fidl::Error> {
let _response = self.client.send_query::<
PullSourceSampleRequest,
fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
>(
(urgency,),
0x2d29007d8c9cb45a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.sample))
}
pub fn r#next_possible_sample_time(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<i64, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PullSourceNextPossibleSampleTimeResponse>(
(),
0x69ca2b1fd63e88a5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.next_possible_time)
}
}
#[derive(Debug, Clone)]
pub struct PullSourceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PullSourceProxy {
type Protocol = PullSourceMarker;
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 PullSourceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PullSourceEventStream {
PullSourceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
PullSourceProxyInterface::r#update_device_properties(self, properties)
}
pub fn r#sample(
&self,
mut urgency: Urgency,
) -> fidl::client::QueryResponseFut<
PullSourceSampleResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PullSourceProxyInterface::r#sample(self, urgency)
}
pub fn r#next_possible_sample_time(
&self,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
PullSourceProxyInterface::r#next_possible_sample_time(self)
}
}
impl PullSourceProxyInterface for PullSourceProxy {
fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
type SampleResponseFut = fidl::client::QueryResponseFut<
PullSourceSampleResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#sample(&self, mut urgency: Urgency) -> Self::SampleResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PullSourceSampleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2d29007d8c9cb45a,
>(_buf?)?;
Ok(_response.map(|x| x.sample))
}
self.client.send_query_and_decode::<PullSourceSampleRequest, PullSourceSampleResult>(
(urgency,),
0x2d29007d8c9cb45a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type NextPossibleSampleTimeResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PullSourceNextPossibleSampleTimeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x69ca2b1fd63e88a5,
>(_buf?)?;
Ok(_response.next_possible_time)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x69ca2b1fd63e88a5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PullSourceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PullSourceEventStream {}
impl futures::stream::FusedStream for PullSourceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PullSourceEventStream {
type Item = Result<PullSourceEvent, 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(PullSourceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PullSourceEvent {}
impl PullSourceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PullSourceEvent, 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: <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PullSourceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PullSourceRequestStream {}
impl futures::stream::FusedStream for PullSourceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PullSourceRequestStream {
type Protocol = PullSourceMarker;
type ControlHandle = PullSourceControlHandle;
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 {
PullSourceControlHandle { 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 PullSourceRequestStream {
type Item = Result<PullSourceRequest, 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 PullSourceRequestStream 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 {
0x63704f8bd0962f00 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
TimeSourceUpdateDevicePropertiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
Ok(PullSourceRequest::UpdateDeviceProperties {
properties: req.properties,
control_handle,
})
}
0x2d29007d8c9cb45a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PullSourceSampleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PullSourceSampleRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
Ok(PullSourceRequest::Sample {
urgency: req.urgency,
responder: PullSourceSampleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x69ca2b1fd63e88a5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
Ok(PullSourceRequest::NextPossibleSampleTime {
responder: PullSourceNextPossibleSampleTimeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PullSourceRequest {
UpdateDeviceProperties { properties: Properties, control_handle: PullSourceControlHandle },
Sample { urgency: Urgency, responder: PullSourceSampleResponder },
NextPossibleSampleTime { responder: PullSourceNextPossibleSampleTimeResponder },
}
impl PullSourceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_update_device_properties(self) -> Option<(Properties, PullSourceControlHandle)> {
if let PullSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
Some((properties, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_sample(self) -> Option<(Urgency, PullSourceSampleResponder)> {
if let PullSourceRequest::Sample { urgency, responder } = self {
Some((urgency, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_next_possible_sample_time(
self,
) -> Option<(PullSourceNextPossibleSampleTimeResponder)> {
if let PullSourceRequest::NextPossibleSampleTime { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PullSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
PullSourceRequest::Sample { .. } => "sample",
PullSourceRequest::NextPossibleSampleTime { .. } => "next_possible_sample_time",
}
}
}
#[derive(Debug, Clone)]
pub struct PullSourceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PullSourceControlHandle {
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 PullSourceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PullSourceSampleResponder {
control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PullSourceSampleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PullSourceSampleResponder {
type ControlHandle = PullSourceControlHandle;
fn control_handle(&self) -> &PullSourceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PullSourceSampleResponder {
pub fn send(self, mut result: Result<&TimeSample, 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<&TimeSample, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<PullSourceSampleResponse, Error>>(
result.map(|sample| (sample,)),
self.tx_id,
0x2d29007d8c9cb45a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PullSourceNextPossibleSampleTimeResponder {
control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PullSourceNextPossibleSampleTimeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PullSourceNextPossibleSampleTimeResponder {
type ControlHandle = PullSourceControlHandle;
fn control_handle(&self) -> &PullSourceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PullSourceNextPossibleSampleTimeResponder {
pub fn send(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(next_possible_time);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(next_possible_time);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PullSourceNextPossibleSampleTimeResponse>(
(next_possible_time,),
self.tx_id,
0x69ca2b1fd63e88a5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PushSourceMarker;
impl fidl::endpoints::ProtocolMarker for PushSourceMarker {
type Proxy = PushSourceProxy;
type RequestStream = PushSourceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PushSourceSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.time.external.PushSource";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PushSourceMarker {}
pub trait PushSourceProxyInterface: Send + Sync {
fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
type WatchSampleResponseFut: std::future::Future<Output = Result<TimeSample, fidl::Error>>
+ Send;
fn r#watch_sample(&self) -> Self::WatchSampleResponseFut;
type WatchStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PushSourceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PushSourceSynchronousProxy {
type Proxy = PushSourceProxy;
type Protocol = PushSourceMarker;
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 PushSourceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PushSourceMarker 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<PushSourceEvent, fidl::Error> {
PushSourceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_sample(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<TimeSample, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchSampleResponse>(
(),
0x44d515a56e8304dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.sample)
}
pub fn r#watch_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchStatusResponse>(
(),
0x60621a545f488bb1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct PushSourceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PushSourceProxy {
type Protocol = PushSourceMarker;
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 PushSourceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PushSourceEventStream {
PushSourceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
PushSourceProxyInterface::r#update_device_properties(self, properties)
}
pub fn r#watch_sample(
&self,
) -> fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PushSourceProxyInterface::r#watch_sample(self)
}
pub fn r#watch_status(
&self,
) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
PushSourceProxyInterface::r#watch_status(self)
}
}
impl PushSourceProxyInterface for PushSourceProxy {
fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchSampleResponseFut =
fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_sample(&self) -> Self::WatchSampleResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TimeSample, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PushSourceWatchSampleResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x44d515a56e8304dc,
>(_buf?)?;
Ok(_response.sample)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TimeSample>(
(),
0x44d515a56e8304dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchStatusResponseFut =
fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PushSourceWatchStatusResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x60621a545f488bb1,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
(),
0x60621a545f488bb1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PushSourceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PushSourceEventStream {}
impl futures::stream::FusedStream for PushSourceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PushSourceEventStream {
type Item = Result<PushSourceEvent, 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(PushSourceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PushSourceEvent {}
impl PushSourceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PushSourceEvent, 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: <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PushSourceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PushSourceRequestStream {}
impl futures::stream::FusedStream for PushSourceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PushSourceRequestStream {
type Protocol = PushSourceMarker;
type ControlHandle = PushSourceControlHandle;
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 {
PushSourceControlHandle { 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 PushSourceRequestStream {
type Item = Result<PushSourceRequest, 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 PushSourceRequestStream 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 {
0x63704f8bd0962f00 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
TimeSourceUpdateDevicePropertiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
Ok(PushSourceRequest::UpdateDeviceProperties {
properties: req.properties,
control_handle,
})
}
0x44d515a56e8304dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
Ok(PushSourceRequest::WatchSample {
responder: PushSourceWatchSampleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x60621a545f488bb1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
Ok(PushSourceRequest::WatchStatus {
responder: PushSourceWatchStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PushSourceRequest {
UpdateDeviceProperties { properties: Properties, control_handle: PushSourceControlHandle },
WatchSample { responder: PushSourceWatchSampleResponder },
WatchStatus { responder: PushSourceWatchStatusResponder },
}
impl PushSourceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_update_device_properties(self) -> Option<(Properties, PushSourceControlHandle)> {
if let PushSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
Some((properties, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_sample(self) -> Option<(PushSourceWatchSampleResponder)> {
if let PushSourceRequest::WatchSample { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_status(self) -> Option<(PushSourceWatchStatusResponder)> {
if let PushSourceRequest::WatchStatus { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PushSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
PushSourceRequest::WatchSample { .. } => "watch_sample",
PushSourceRequest::WatchStatus { .. } => "watch_status",
}
}
}
#[derive(Debug, Clone)]
pub struct PushSourceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PushSourceControlHandle {
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 PushSourceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PushSourceWatchSampleResponder {
control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PushSourceWatchSampleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PushSourceWatchSampleResponder {
type ControlHandle = PushSourceControlHandle;
fn control_handle(&self) -> &PushSourceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PushSourceWatchSampleResponder {
pub fn send(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
let _result = self.send_raw(sample);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
let _result = self.send_raw(sample);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PushSourceWatchSampleResponse>(
(sample,),
self.tx_id,
0x44d515a56e8304dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PushSourceWatchStatusResponder {
control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PushSourceWatchStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PushSourceWatchStatusResponder {
type ControlHandle = PushSourceControlHandle;
fn control_handle(&self) -> &PushSourceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PushSourceWatchStatusResponder {
pub fn send(self, mut status: Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PushSourceWatchStatusResponse>(
(status,),
self.tx_id,
0x60621a545f488bb1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TimeSourceMarker;
impl fidl::endpoints::ProtocolMarker for TimeSourceMarker {
type Proxy = TimeSourceProxy;
type RequestStream = TimeSourceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TimeSourceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) TimeSource";
}
pub trait TimeSourceProxyInterface: Send + Sync {
fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TimeSourceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TimeSourceSynchronousProxy {
type Proxy = TimeSourceProxy;
type Protocol = TimeSourceMarker;
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 TimeSourceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <TimeSourceMarker 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<TimeSourceEvent, fidl::Error> {
TimeSourceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct TimeSourceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for TimeSourceProxy {
type Protocol = TimeSourceMarker;
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 TimeSourceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TimeSourceEventStream {
TimeSourceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#update_device_properties(
&self,
mut properties: &Properties,
) -> Result<(), fidl::Error> {
TimeSourceProxyInterface::r#update_device_properties(self, properties)
}
}
impl TimeSourceProxyInterface for TimeSourceProxy {
fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
(properties,),
0x63704f8bd0962f00,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct TimeSourceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for TimeSourceEventStream {}
impl futures::stream::FusedStream for TimeSourceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TimeSourceEventStream {
type Item = Result<TimeSourceEvent, 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(TimeSourceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TimeSourceEvent {}
impl TimeSourceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<TimeSourceEvent, 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: <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TimeSourceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for TimeSourceRequestStream {}
impl futures::stream::FusedStream for TimeSourceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TimeSourceRequestStream {
type Protocol = TimeSourceMarker;
type ControlHandle = TimeSourceControlHandle;
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 {
TimeSourceControlHandle { 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 TimeSourceRequestStream {
type Item = Result<TimeSourceRequest, 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 TimeSourceRequestStream 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 {
0x63704f8bd0962f00 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
TimeSourceUpdateDevicePropertiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TimeSourceControlHandle { inner: this.inner.clone() };
Ok(TimeSourceRequest::UpdateDeviceProperties {
properties: req.properties,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum TimeSourceRequest {
UpdateDeviceProperties { properties: Properties, control_handle: TimeSourceControlHandle },
}
impl TimeSourceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_update_device_properties(self) -> Option<(Properties, TimeSourceControlHandle)> {
if let TimeSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
Some((properties, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TimeSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
}
}
}
#[derive(Debug, Clone)]
pub struct TimeSourceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for TimeSourceControlHandle {
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 TimeSourceControlHandle {}
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::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[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::Unknown
}
#[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::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Status {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Status {
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 Status {
#[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 Status {
#[inline(always)]
fn new_empty() -> Self {
Self::Initializing
}
#[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::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Urgency {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Urgency {
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 Urgency {
#[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 Urgency {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PullSourceNextPossibleSampleTimeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PullSourceNextPossibleSampleTimeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PullSourceNextPossibleSampleTimeResponse, D>
for &PullSourceNextPossibleSampleTimeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PullSourceNextPossibleSampleTimeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PullSourceNextPossibleSampleTimeResponse).write_unaligned(
(self as *const PullSourceNextPossibleSampleTimeResponse).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<PullSourceNextPossibleSampleTimeResponse, 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::<PullSourceNextPossibleSampleTimeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PullSourceNextPossibleSampleTimeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { next_possible_time: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PullSourceSampleRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PullSourceSampleRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PullSourceSampleRequest, D> for &PullSourceSampleRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PullSourceSampleRequest>(offset);
fidl::encoding::Encode::<PullSourceSampleRequest, D>::encode(
(<Urgency as fidl::encoding::ValueTypeMarker>::borrow(&self.urgency),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Urgency, D>>
fidl::encoding::Encode<PullSourceSampleRequest, 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::<PullSourceSampleRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PullSourceSampleRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { urgency: fidl::new_empty!(Urgency, 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!(Urgency, D, &mut self.urgency, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PullSourceSampleResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PullSourceSampleResponse {
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<PullSourceSampleResponse, D> for &PullSourceSampleResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PullSourceSampleResponse>(offset);
fidl::encoding::Encode::<PullSourceSampleResponse, D>::encode(
(<TimeSample as fidl::encoding::ValueTypeMarker>::borrow(&self.sample),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TimeSample, D>>
fidl::encoding::Encode<PullSourceSampleResponse, 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::<PullSourceSampleResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PullSourceSampleResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { sample: fidl::new_empty!(TimeSample, 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!(TimeSample, D, &mut self.sample, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PushSourceWatchSampleResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PushSourceWatchSampleResponse {
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<PushSourceWatchSampleResponse, D>
for &PushSourceWatchSampleResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PushSourceWatchSampleResponse>(offset);
fidl::encoding::Encode::<PushSourceWatchSampleResponse, D>::encode(
(<TimeSample as fidl::encoding::ValueTypeMarker>::borrow(&self.sample),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TimeSample, D>>
fidl::encoding::Encode<PushSourceWatchSampleResponse, 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::<PushSourceWatchSampleResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PushSourceWatchSampleResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { sample: fidl::new_empty!(TimeSample, 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!(TimeSample, D, &mut self.sample, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PushSourceWatchStatusResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PushSourceWatchStatusResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PushSourceWatchStatusResponse, D>
for &PushSourceWatchStatusResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PushSourceWatchStatusResponse>(offset);
fidl::encoding::Encode::<PushSourceWatchStatusResponse, D>::encode(
(<Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Status, D>>
fidl::encoding::Encode<PushSourceWatchStatusResponse, 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::<PushSourceWatchStatusResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PushSourceWatchStatusResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(Status, 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!(Status, D, &mut self.status, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TimeSourceUpdateDevicePropertiesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TimeSourceUpdateDevicePropertiesRequest {
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<TimeSourceUpdateDevicePropertiesRequest, D>
for &TimeSourceUpdateDevicePropertiesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TimeSourceUpdateDevicePropertiesRequest>(offset);
fidl::encoding::Encode::<TimeSourceUpdateDevicePropertiesRequest, D>::encode(
(<Properties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Properties, D>>
fidl::encoding::Encode<TimeSourceUpdateDevicePropertiesRequest, 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::<TimeSourceUpdateDevicePropertiesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TimeSourceUpdateDevicePropertiesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { properties: fidl::new_empty!(Properties, 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!(Properties, D, &mut self.properties, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl Properties {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for Properties {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Properties {
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<Properties, D>
for &Properties
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Properties>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Properties {
#[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;
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 TimeSample {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.reference {
return 4;
}
if let Some(_) = self.standard_deviation {
return 3;
}
if let Some(_) = self.monotonic {
return 2;
}
if let Some(_) = self.utc {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for TimeSample {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TimeSample {
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<TimeSample, D>
for &TimeSample
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TimeSample>(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::<i64, D>(
self.utc.as_ref().map(<i64 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::<i64, D>(
self.monotonic.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.standard_deviation
.as_ref()
.map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::BootInstant, D>(
self.reference
.as_ref()
.map(<fidl::BootInstant 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 TimeSample {
#[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 =
<i64 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.utc.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, 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 =
<i64 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.monotonic.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 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.standard_deviation.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, 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 < 4 {
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 =
<fidl::BootInstant 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.reference.get_or_insert_with(|| fidl::new_empty!(fidl::BootInstant, D));
fidl::decode!(fidl::BootInstant, 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(())
}
}
}