#![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 DeadlineEventType {
Set = 1,
Expired = 2,
}
impl DeadlineEventType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Set),
2 => Some(Self::Expired),
_ => 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(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeClockCancelEventRequest {
pub event: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockCancelEventRequest
{
}
#[derive(Debug, PartialEq)]
pub struct FakeClockControlAddStopPointRequest {
pub deadline_id: fidl_fuchsia_testing_deadline::DeadlineId,
pub event_type: DeadlineEventType,
pub on_stop: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockControlAddStopPointRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeClockControlAdvanceRequest {
pub increment: Increment,
}
impl fidl::Persistable for FakeClockControlAdvanceRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct FakeClockControlIgnoreNamedDeadlineRequest {
pub deadline_id: fidl_fuchsia_testing_deadline::DeadlineId,
}
impl fidl::Persistable for FakeClockControlIgnoreNamedDeadlineRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeClockControlResumeWithIncrementsRequest {
pub real: i64,
pub increment: Increment,
}
impl fidl::Persistable for FakeClockControlResumeWithIncrementsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct FakeClockCreateNamedDeadlineRequest {
pub id: fidl_fuchsia_testing_deadline::DeadlineId,
pub duration: i64,
}
impl fidl::Persistable for FakeClockCreateNamedDeadlineRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FakeClockCreateNamedDeadlineResponse {
pub deadline: i64,
}
impl fidl::Persistable for FakeClockCreateNamedDeadlineResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FakeClockGetResponse {
pub time: i64,
}
impl fidl::Persistable for FakeClockGetResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeClockRegisterEventRequest {
pub event: fidl::EventPair,
pub time: i64,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockRegisterEventRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FakeClockRescheduleEventRequest {
pub event: fidl::EventPair,
pub time: i64,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockRescheduleEventRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RandomRange {
pub min_rand: i64,
pub max_rand: i64,
}
impl fidl::Persistable for RandomRange {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Increment {
Determined(i64),
Random(RandomRange),
}
impl Increment {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Determined(_) => 1,
Self::Random(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Increment {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FakeClockMarker;
impl fidl::endpoints::ProtocolMarker for FakeClockMarker {
type Proxy = FakeClockProxy;
type RequestStream = FakeClockRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FakeClockSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.testing.FakeClock";
}
impl fidl::endpoints::DiscoverableProtocolMarker for FakeClockMarker {}
pub trait FakeClockProxyInterface: Send + Sync {
type GetResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#get(&self) -> Self::GetResponseFut;
fn r#register_event(&self, event: fidl::EventPair, time: i64) -> Result<(), fidl::Error>;
type RescheduleEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#reschedule_event(
&self,
event: fidl::EventPair,
time: i64,
) -> Self::RescheduleEventResponseFut;
type CancelEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#cancel_event(&self, event: fidl::EventPair) -> Self::CancelEventResponseFut;
type CreateNamedDeadlineResponseFut: std::future::Future<Output = Result<i64, fidl::Error>>
+ Send;
fn r#create_named_deadline(
&self,
id: &fidl_fuchsia_testing_deadline::DeadlineId,
duration: i64,
) -> Self::CreateNamedDeadlineResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FakeClockSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FakeClockSynchronousProxy {
type Proxy = FakeClockProxy;
type Protocol = FakeClockMarker;
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 FakeClockSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FakeClockMarker 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<FakeClockEvent, fidl::Error> {
FakeClockEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, FakeClockGetResponse>(
(),
0x2a08c060e0b95e7c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.time)
}
pub fn r#register_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<FakeClockRegisterEventRequest>(
(event, time),
0x79917345514b5f95,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#reschedule_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<FakeClockRescheduleEventRequest, fidl::encoding::EmptyPayload>(
(event, time),
0x4e5207df2b0dba46,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#cancel_event(
&self,
mut event: fidl::EventPair,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<FakeClockCancelEventRequest, fidl::encoding::EmptyPayload>(
(event,),
0x18bbdb18faa6cac0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#create_named_deadline(
&self,
mut id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut duration: i64,
___deadline: zx::MonotonicInstant,
) -> Result<i64, fidl::Error> {
let _response = self.client.send_query::<
FakeClockCreateNamedDeadlineRequest,
FakeClockCreateNamedDeadlineResponse,
>(
(id, duration,),
0xf7a02c2ac2d116c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.deadline)
}
}
#[derive(Debug, Clone)]
pub struct FakeClockProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for FakeClockProxy {
type Protocol = FakeClockMarker;
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 FakeClockProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <FakeClockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FakeClockEventStream {
FakeClockEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get(
&self,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockProxyInterface::r#get(self)
}
pub fn r#register_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
) -> Result<(), fidl::Error> {
FakeClockProxyInterface::r#register_event(self, event, time)
}
pub fn r#reschedule_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockProxyInterface::r#reschedule_event(self, event, time)
}
pub fn r#cancel_event(
&self,
mut event: fidl::EventPair,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockProxyInterface::r#cancel_event(self, event)
}
pub fn r#create_named_deadline(
&self,
mut id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut duration: i64,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockProxyInterface::r#create_named_deadline(self, id, duration)
}
}
impl FakeClockProxyInterface for FakeClockProxy {
type GetResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get(&self) -> Self::GetResponseFut {
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::<
FakeClockGetResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2a08c060e0b95e7c,
>(_buf?)?;
Ok(_response.time)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x2a08c060e0b95e7c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#register_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<FakeClockRegisterEventRequest>(
(event, time),
0x79917345514b5f95,
fidl::encoding::DynamicFlags::empty(),
)
}
type RescheduleEventResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#reschedule_event(
&self,
mut event: fidl::EventPair,
mut time: i64,
) -> Self::RescheduleEventResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e5207df2b0dba46,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<FakeClockRescheduleEventRequest, ()>(
(event, time),
0x4e5207df2b0dba46,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CancelEventResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#cancel_event(&self, mut event: fidl::EventPair) -> Self::CancelEventResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x18bbdb18faa6cac0,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<FakeClockCancelEventRequest, ()>(
(event,),
0x18bbdb18faa6cac0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateNamedDeadlineResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#create_named_deadline(
&self,
mut id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut duration: i64,
) -> Self::CreateNamedDeadlineResponseFut {
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::<
FakeClockCreateNamedDeadlineResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xf7a02c2ac2d116c,
>(_buf?)?;
Ok(_response.deadline)
}
self.client.send_query_and_decode::<FakeClockCreateNamedDeadlineRequest, i64>(
(id, duration),
0xf7a02c2ac2d116c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct FakeClockEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for FakeClockEventStream {}
impl futures::stream::FusedStream for FakeClockEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FakeClockEventStream {
type Item = Result<FakeClockEvent, 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(FakeClockEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FakeClockEvent {}
impl FakeClockEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<FakeClockEvent, 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: <FakeClockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FakeClockRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for FakeClockRequestStream {}
impl futures::stream::FusedStream for FakeClockRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FakeClockRequestStream {
type Protocol = FakeClockMarker;
type ControlHandle = FakeClockControlHandle;
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 {
FakeClockControlHandle { 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 FakeClockRequestStream {
type Item = Result<FakeClockRequest, 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 FakeClockRequestStream 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 {
0x2a08c060e0b95e7c => {
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 = FakeClockControlHandle { inner: this.inner.clone() };
Ok(FakeClockRequest::Get {
responder: FakeClockGetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x79917345514b5f95 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
FakeClockRegisterEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockRegisterEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FakeClockControlHandle { inner: this.inner.clone() };
Ok(FakeClockRequest::RegisterEvent {
event: req.event,
time: req.time,
control_handle,
})
}
0x4e5207df2b0dba46 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockRescheduleEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockRescheduleEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FakeClockControlHandle { inner: this.inner.clone() };
Ok(FakeClockRequest::RescheduleEvent {
event: req.event,
time: req.time,
responder: FakeClockRescheduleEventResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x18bbdb18faa6cac0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockCancelEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockCancelEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FakeClockControlHandle { inner: this.inner.clone() };
Ok(FakeClockRequest::CancelEvent {
event: req.event,
responder: FakeClockCancelEventResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xf7a02c2ac2d116c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockCreateNamedDeadlineRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockCreateNamedDeadlineRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FakeClockControlHandle { inner: this.inner.clone() };
Ok(FakeClockRequest::CreateNamedDeadline {
id: req.id,
duration: req.duration,
responder: FakeClockCreateNamedDeadlineResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<FakeClockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum FakeClockRequest {
Get { responder: FakeClockGetResponder },
RegisterEvent { event: fidl::EventPair, time: i64, control_handle: FakeClockControlHandle },
RescheduleEvent {
event: fidl::EventPair,
time: i64,
responder: FakeClockRescheduleEventResponder,
},
CancelEvent { event: fidl::EventPair, responder: FakeClockCancelEventResponder },
CreateNamedDeadline {
id: fidl_fuchsia_testing_deadline::DeadlineId,
duration: i64,
responder: FakeClockCreateNamedDeadlineResponder,
},
}
impl FakeClockRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get(self) -> Option<(FakeClockGetResponder)> {
if let FakeClockRequest::Get { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_event(self) -> Option<(fidl::EventPair, i64, FakeClockControlHandle)> {
if let FakeClockRequest::RegisterEvent { event, time, control_handle } = self {
Some((event, time, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reschedule_event(
self,
) -> Option<(fidl::EventPair, i64, FakeClockRescheduleEventResponder)> {
if let FakeClockRequest::RescheduleEvent { event, time, responder } = self {
Some((event, time, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_cancel_event(self) -> Option<(fidl::EventPair, FakeClockCancelEventResponder)> {
if let FakeClockRequest::CancelEvent { event, responder } = self {
Some((event, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_named_deadline(
self,
) -> Option<(
fidl_fuchsia_testing_deadline::DeadlineId,
i64,
FakeClockCreateNamedDeadlineResponder,
)> {
if let FakeClockRequest::CreateNamedDeadline { id, duration, responder } = self {
Some((id, duration, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FakeClockRequest::Get { .. } => "get",
FakeClockRequest::RegisterEvent { .. } => "register_event",
FakeClockRequest::RescheduleEvent { .. } => "reschedule_event",
FakeClockRequest::CancelEvent { .. } => "cancel_event",
FakeClockRequest::CreateNamedDeadline { .. } => "create_named_deadline",
}
}
}
#[derive(Debug, Clone)]
pub struct FakeClockControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for FakeClockControlHandle {
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 FakeClockControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockGetResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockGetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockGetResponder {
type ControlHandle = FakeClockControlHandle;
fn control_handle(&self) -> &FakeClockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockGetResponder {
pub fn send(self, mut time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(time);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(time);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut time: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<FakeClockGetResponse>(
(time,),
self.tx_id,
0x2a08c060e0b95e7c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockRescheduleEventResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockRescheduleEventResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockRescheduleEventResponder {
type ControlHandle = FakeClockControlHandle;
fn control_handle(&self) -> &FakeClockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockRescheduleEventResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x4e5207df2b0dba46,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockCancelEventResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockCancelEventResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockCancelEventResponder {
type ControlHandle = FakeClockControlHandle;
fn control_handle(&self) -> &FakeClockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockCancelEventResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x18bbdb18faa6cac0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockCreateNamedDeadlineResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockCreateNamedDeadlineResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockCreateNamedDeadlineResponder {
type ControlHandle = FakeClockControlHandle;
fn control_handle(&self) -> &FakeClockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockCreateNamedDeadlineResponder {
pub fn send(self, mut deadline: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(deadline);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut deadline: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(deadline);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut deadline: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<FakeClockCreateNamedDeadlineResponse>(
(deadline,),
self.tx_id,
0xf7a02c2ac2d116c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FakeClockControlMarker;
impl fidl::endpoints::ProtocolMarker for FakeClockControlMarker {
type Proxy = FakeClockControlProxy;
type RequestStream = FakeClockControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FakeClockControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.testing.FakeClockControl";
}
impl fidl::endpoints::DiscoverableProtocolMarker for FakeClockControlMarker {}
pub type FakeClockControlAdvanceResult = Result<(), i32>;
pub type FakeClockControlResumeWithIncrementsResult = Result<(), i32>;
pub type FakeClockControlAddStopPointResult = Result<(), i32>;
pub trait FakeClockControlProxyInterface: Send + Sync {
type AdvanceResponseFut: std::future::Future<Output = Result<FakeClockControlAdvanceResult, fidl::Error>>
+ Send;
fn r#advance(&self, increment: &Increment) -> Self::AdvanceResponseFut;
type ResumeWithIncrementsResponseFut: std::future::Future<
Output = Result<FakeClockControlResumeWithIncrementsResult, fidl::Error>,
> + Send;
fn r#resume_with_increments(
&self,
real: i64,
increment: &Increment,
) -> Self::ResumeWithIncrementsResponseFut;
type AddStopPointResponseFut: std::future::Future<Output = Result<FakeClockControlAddStopPointResult, fidl::Error>>
+ Send;
fn r#add_stop_point(
&self,
deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
event_type: DeadlineEventType,
on_stop: fidl::EventPair,
) -> Self::AddStopPointResponseFut;
type PauseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#pause(&self) -> Self::PauseResponseFut;
type IgnoreNamedDeadlineResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#ignore_named_deadline(
&self,
deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
) -> Self::IgnoreNamedDeadlineResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FakeClockControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FakeClockControlSynchronousProxy {
type Proxy = FakeClockControlProxy;
type Protocol = FakeClockControlMarker;
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 FakeClockControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FakeClockControlMarker 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<FakeClockControlEvent, fidl::Error> {
FakeClockControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#advance(
&self,
mut increment: &Increment,
___deadline: zx::MonotonicInstant,
) -> Result<FakeClockControlAdvanceResult, fidl::Error> {
let _response = self.client.send_query::<
FakeClockControlAdvanceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(increment,),
0x42f2265fb495497a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#resume_with_increments(
&self,
mut real: i64,
mut increment: &Increment,
___deadline: zx::MonotonicInstant,
) -> Result<FakeClockControlResumeWithIncrementsResult, fidl::Error> {
let _response = self.client.send_query::<
FakeClockControlResumeWithIncrementsRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(real, increment,),
0x259be1eeba0bdd4a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_stop_point(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut event_type: DeadlineEventType,
mut on_stop: fidl::EventPair,
___deadline: zx::MonotonicInstant,
) -> Result<FakeClockControlAddStopPointResult, fidl::Error> {
let _response = self.client.send_query::<
FakeClockControlAddStopPointRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(deadline_id, event_type, on_stop,),
0x3b52fe2cba8c4245,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#pause(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x260df03b49199ba4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#ignore_named_deadline(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<FakeClockControlIgnoreNamedDeadlineRequest, fidl::encoding::EmptyPayload>(
(deadline_id,),
0x2e445152a80d44aa,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct FakeClockControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for FakeClockControlProxy {
type Protocol = FakeClockControlMarker;
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 FakeClockControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <FakeClockControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FakeClockControlEventStream {
FakeClockControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#advance(
&self,
mut increment: &Increment,
) -> fidl::client::QueryResponseFut<
FakeClockControlAdvanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FakeClockControlProxyInterface::r#advance(self, increment)
}
pub fn r#resume_with_increments(
&self,
mut real: i64,
mut increment: &Increment,
) -> fidl::client::QueryResponseFut<
FakeClockControlResumeWithIncrementsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FakeClockControlProxyInterface::r#resume_with_increments(self, real, increment)
}
pub fn r#add_stop_point(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut event_type: DeadlineEventType,
mut on_stop: fidl::EventPair,
) -> fidl::client::QueryResponseFut<
FakeClockControlAddStopPointResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FakeClockControlProxyInterface::r#add_stop_point(self, deadline_id, event_type, on_stop)
}
pub fn r#pause(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockControlProxyInterface::r#pause(self)
}
pub fn r#ignore_named_deadline(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
FakeClockControlProxyInterface::r#ignore_named_deadline(self, deadline_id)
}
}
impl FakeClockControlProxyInterface for FakeClockControlProxy {
type AdvanceResponseFut = fidl::client::QueryResponseFut<
FakeClockControlAdvanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#advance(&self, mut increment: &Increment) -> Self::AdvanceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FakeClockControlAdvanceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x42f2265fb495497a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<FakeClockControlAdvanceRequest, FakeClockControlAdvanceResult>(
(increment,),
0x42f2265fb495497a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ResumeWithIncrementsResponseFut = fidl::client::QueryResponseFut<
FakeClockControlResumeWithIncrementsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#resume_with_increments(
&self,
mut real: i64,
mut increment: &Increment,
) -> Self::ResumeWithIncrementsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FakeClockControlResumeWithIncrementsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x259be1eeba0bdd4a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
FakeClockControlResumeWithIncrementsRequest,
FakeClockControlResumeWithIncrementsResult,
>(
(real, increment,),
0x259be1eeba0bdd4a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddStopPointResponseFut = fidl::client::QueryResponseFut<
FakeClockControlAddStopPointResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_stop_point(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
mut event_type: DeadlineEventType,
mut on_stop: fidl::EventPair,
) -> Self::AddStopPointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FakeClockControlAddStopPointResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b52fe2cba8c4245,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
FakeClockControlAddStopPointRequest,
FakeClockControlAddStopPointResult,
>(
(deadline_id, event_type, on_stop,),
0x3b52fe2cba8c4245,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PauseResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#pause(&self) -> Self::PauseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x260df03b49199ba4,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x260df03b49199ba4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type IgnoreNamedDeadlineResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ignore_named_deadline(
&self,
mut deadline_id: &fidl_fuchsia_testing_deadline::DeadlineId,
) -> Self::IgnoreNamedDeadlineResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2e445152a80d44aa,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<FakeClockControlIgnoreNamedDeadlineRequest, ()>(
(deadline_id,),
0x2e445152a80d44aa,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct FakeClockControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for FakeClockControlEventStream {}
impl futures::stream::FusedStream for FakeClockControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FakeClockControlEventStream {
type Item = Result<FakeClockControlEvent, 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(FakeClockControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FakeClockControlEvent {}
impl FakeClockControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<FakeClockControlEvent, 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:
<FakeClockControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FakeClockControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for FakeClockControlRequestStream {}
impl futures::stream::FusedStream for FakeClockControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FakeClockControlRequestStream {
type Protocol = FakeClockControlMarker;
type ControlHandle = FakeClockControlControlHandle;
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 {
FakeClockControlControlHandle { 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 FakeClockControlRequestStream {
type Item = Result<FakeClockControlRequest, 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 FakeClockControlRequestStream 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 {
0x42f2265fb495497a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockControlAdvanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockControlAdvanceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeClockControlControlHandle { inner: this.inner.clone() };
Ok(FakeClockControlRequest::Advance {
increment: req.increment,
responder: FakeClockControlAdvanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x259be1eeba0bdd4a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockControlResumeWithIncrementsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockControlResumeWithIncrementsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeClockControlControlHandle { inner: this.inner.clone() };
Ok(FakeClockControlRequest::ResumeWithIncrements {
real: req.real,
increment: req.increment,
responder: FakeClockControlResumeWithIncrementsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3b52fe2cba8c4245 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockControlAddStopPointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockControlAddStopPointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeClockControlControlHandle { inner: this.inner.clone() };
Ok(FakeClockControlRequest::AddStopPoint {
deadline_id: req.deadline_id,
event_type: req.event_type,
on_stop: req.on_stop,
responder: FakeClockControlAddStopPointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x260df03b49199ba4 => {
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 =
FakeClockControlControlHandle { inner: this.inner.clone() };
Ok(FakeClockControlRequest::Pause {
responder: FakeClockControlPauseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2e445152a80d44aa => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FakeClockControlIgnoreNamedDeadlineRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeClockControlIgnoreNamedDeadlineRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
FakeClockControlControlHandle { inner: this.inner.clone() };
Ok(FakeClockControlRequest::IgnoreNamedDeadline {
deadline_id: req.deadline_id,
responder: FakeClockControlIgnoreNamedDeadlineResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<FakeClockControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum FakeClockControlRequest {
Advance { increment: Increment, responder: FakeClockControlAdvanceResponder },
ResumeWithIncrements {
real: i64,
increment: Increment,
responder: FakeClockControlResumeWithIncrementsResponder,
},
AddStopPoint {
deadline_id: fidl_fuchsia_testing_deadline::DeadlineId,
event_type: DeadlineEventType,
on_stop: fidl::EventPair,
responder: FakeClockControlAddStopPointResponder,
},
Pause { responder: FakeClockControlPauseResponder },
IgnoreNamedDeadline {
deadline_id: fidl_fuchsia_testing_deadline::DeadlineId,
responder: FakeClockControlIgnoreNamedDeadlineResponder,
},
}
impl FakeClockControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_advance(self) -> Option<(Increment, FakeClockControlAdvanceResponder)> {
if let FakeClockControlRequest::Advance { increment, responder } = self {
Some((increment, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_resume_with_increments(
self,
) -> Option<(i64, Increment, FakeClockControlResumeWithIncrementsResponder)> {
if let FakeClockControlRequest::ResumeWithIncrements { real, increment, responder } = self {
Some((real, increment, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_stop_point(
self,
) -> Option<(
fidl_fuchsia_testing_deadline::DeadlineId,
DeadlineEventType,
fidl::EventPair,
FakeClockControlAddStopPointResponder,
)> {
if let FakeClockControlRequest::AddStopPoint {
deadline_id,
event_type,
on_stop,
responder,
} = self
{
Some((deadline_id, event_type, on_stop, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause(self) -> Option<(FakeClockControlPauseResponder)> {
if let FakeClockControlRequest::Pause { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ignore_named_deadline(
self,
) -> Option<(
fidl_fuchsia_testing_deadline::DeadlineId,
FakeClockControlIgnoreNamedDeadlineResponder,
)> {
if let FakeClockControlRequest::IgnoreNamedDeadline { deadline_id, responder } = self {
Some((deadline_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FakeClockControlRequest::Advance { .. } => "advance",
FakeClockControlRequest::ResumeWithIncrements { .. } => "resume_with_increments",
FakeClockControlRequest::AddStopPoint { .. } => "add_stop_point",
FakeClockControlRequest::Pause { .. } => "pause",
FakeClockControlRequest::IgnoreNamedDeadline { .. } => "ignore_named_deadline",
}
}
}
#[derive(Debug, Clone)]
pub struct FakeClockControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for FakeClockControlControlHandle {
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 FakeClockControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockControlAdvanceResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockControlAdvanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockControlAdvanceResponder {
type ControlHandle = FakeClockControlControlHandle;
fn control_handle(&self) -> &FakeClockControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockControlAdvanceResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x42f2265fb495497a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockControlResumeWithIncrementsResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockControlResumeWithIncrementsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockControlResumeWithIncrementsResponder {
type ControlHandle = FakeClockControlControlHandle;
fn control_handle(&self) -> &FakeClockControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockControlResumeWithIncrementsResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x259be1eeba0bdd4a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockControlAddStopPointResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockControlAddStopPointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockControlAddStopPointResponder {
type ControlHandle = FakeClockControlControlHandle;
fn control_handle(&self) -> &FakeClockControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockControlAddStopPointResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3b52fe2cba8c4245,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockControlPauseResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockControlPauseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockControlPauseResponder {
type ControlHandle = FakeClockControlControlHandle;
fn control_handle(&self) -> &FakeClockControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockControlPauseResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x260df03b49199ba4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FakeClockControlIgnoreNamedDeadlineResponder {
control_handle: std::mem::ManuallyDrop<FakeClockControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FakeClockControlIgnoreNamedDeadlineResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FakeClockControlIgnoreNamedDeadlineResponder {
type ControlHandle = FakeClockControlControlHandle;
fn control_handle(&self) -> &FakeClockControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FakeClockControlIgnoreNamedDeadlineResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x2e445152a80d44aa,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for DeadlineEventType {
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 DeadlineEventType {
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 DeadlineEventType
{
#[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 DeadlineEventType {
#[inline(always)]
fn new_empty() -> Self {
Self::Set
}
#[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(())
}
}
impl fidl::encoding::ResourceTypeMarker for FakeClockCancelEventRequest {
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 FakeClockCancelEventRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
FakeClockCancelEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut FakeClockCancelEventRequest
{
#[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::<FakeClockCancelEventRequest>(offset);
fidl::encoding::Encode::<
FakeClockCancelEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.event
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
FakeClockCancelEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockCancelEventRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockCancelEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
event: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for FakeClockControlAddStopPointRequest {
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 FakeClockControlAddStopPointRequest {
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<
FakeClockControlAddStopPointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut FakeClockControlAddStopPointRequest
{
#[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::<FakeClockControlAddStopPointRequest>(offset);
fidl::encoding::Encode::<FakeClockControlAddStopPointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_testing_deadline::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline_id),
<DeadlineEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.event_type),
<fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.on_stop),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_testing_deadline::DeadlineId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
DeadlineEventType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
FakeClockControlAddStopPointRequest,
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::<FakeClockControlAddStopPointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 36, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockControlAddStopPointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
deadline_id: fidl::new_empty!(
fidl_fuchsia_testing_deadline::DeadlineId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
event_type: fidl::new_empty!(
DeadlineEventType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
on_stop: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_testing_deadline::DeadlineId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.deadline_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
DeadlineEventType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.event_type,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.on_stop, decoder, offset + 36, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeClockControlAdvanceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockControlAdvanceRequest {
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<FakeClockControlAdvanceRequest, D>
for &FakeClockControlAdvanceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockControlAdvanceRequest>(offset);
fidl::encoding::Encode::<FakeClockControlAdvanceRequest, D>::encode(
(<Increment as fidl::encoding::ValueTypeMarker>::borrow(&self.increment),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Increment, D>>
fidl::encoding::Encode<FakeClockControlAdvanceRequest, 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::<FakeClockControlAdvanceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeClockControlAdvanceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { increment: fidl::new_empty!(Increment, 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!(Increment, D, &mut self.increment, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeClockControlIgnoreNamedDeadlineRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockControlIgnoreNamedDeadlineRequest {
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<FakeClockControlIgnoreNamedDeadlineRequest, D>
for &FakeClockControlIgnoreNamedDeadlineRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockControlIgnoreNamedDeadlineRequest>(offset);
fidl::encoding::Encode::<FakeClockControlIgnoreNamedDeadlineRequest, D>::encode(
(
<fidl_fuchsia_testing_deadline::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline_id),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_testing_deadline::DeadlineId, D>,
> fidl::encoding::Encode<FakeClockControlIgnoreNamedDeadlineRequest, 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::<FakeClockControlIgnoreNamedDeadlineRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeClockControlIgnoreNamedDeadlineRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { deadline_id: fidl::new_empty!(fidl_fuchsia_testing_deadline::DeadlineId, 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_fuchsia_testing_deadline::DeadlineId,
D,
&mut self.deadline_id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeClockControlResumeWithIncrementsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockControlResumeWithIncrementsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<FakeClockControlResumeWithIncrementsRequest, D>
for &FakeClockControlResumeWithIncrementsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockControlResumeWithIncrementsRequest>(offset);
fidl::encoding::Encode::<FakeClockControlResumeWithIncrementsRequest, D>::encode(
(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.real),
<Increment as fidl::encoding::ValueTypeMarker>::borrow(&self.increment),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<Increment, D>,
> fidl::encoding::Encode<FakeClockControlResumeWithIncrementsRequest, 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::<FakeClockControlResumeWithIncrementsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeClockControlResumeWithIncrementsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { real: fidl::new_empty!(i64, D), increment: fidl::new_empty!(Increment, 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!(i64, D, &mut self.real, decoder, offset + 0, _depth)?;
fidl::decode!(Increment, D, &mut self.increment, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineRequest {
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<FakeClockCreateNamedDeadlineRequest, D>
for &FakeClockCreateNamedDeadlineRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineRequest>(offset);
fidl::encoding::Encode::<FakeClockCreateNamedDeadlineRequest, D>::encode(
(
<fidl_fuchsia_testing_deadline::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_testing_deadline::DeadlineId, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<FakeClockCreateNamedDeadlineRequest, 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::<FakeClockCreateNamedDeadlineRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeClockCreateNamedDeadlineRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_testing_deadline::DeadlineId, D),
duration: 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);
fidl::decode!(
fidl_fuchsia_testing_deadline::DeadlineId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(i64, D, &mut self.duration, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineResponse {
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<FakeClockCreateNamedDeadlineResponse, D>
for &FakeClockCreateNamedDeadlineResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FakeClockCreateNamedDeadlineResponse)
.write_unaligned((self as *const FakeClockCreateNamedDeadlineResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<FakeClockCreateNamedDeadlineResponse, 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::<FakeClockCreateNamedDeadlineResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FakeClockCreateNamedDeadlineResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { deadline: 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 FakeClockGetResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FakeClockGetResponse {
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<FakeClockGetResponse, D>
for &FakeClockGetResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FakeClockGetResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FakeClockGetResponse)
.write_unaligned((self as *const FakeClockGetResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<FakeClockGetResponse, 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::<FakeClockGetResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FakeClockGetResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { 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::ResourceTypeMarker for FakeClockRegisterEventRequest {
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 FakeClockRegisterEventRequest {
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
fidl::encoding::Encode<
FakeClockRegisterEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut FakeClockRegisterEventRequest
{
#[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::<FakeClockRegisterEventRequest>(offset);
fidl::encoding::Encode::<
FakeClockRegisterEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.event
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
FakeClockRegisterEventRequest,
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::<FakeClockRegisterEventRequest>(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 fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockRegisterEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
event: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
time: fidl::new_empty!(i64, 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(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!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
fidl::decode!(
i64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.time,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for FakeClockRescheduleEventRequest {
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 FakeClockRescheduleEventRequest {
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
fidl::encoding::Encode<
FakeClockRescheduleEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut FakeClockRescheduleEventRequest
{
#[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::<FakeClockRescheduleEventRequest>(offset);
fidl::encoding::Encode::<
FakeClockRescheduleEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.event
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
FakeClockRescheduleEventRequest,
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::<FakeClockRescheduleEventRequest>(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 fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for FakeClockRescheduleEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
event: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
time: fidl::new_empty!(i64, 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(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!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
fidl::decode!(
i64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.time,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RandomRange {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RandomRange {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RandomRange, D>
for &RandomRange
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RandomRange>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RandomRange).write_unaligned((self as *const RandomRange).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<RandomRange, 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::<RandomRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RandomRange {
#[inline(always)]
fn new_empty() -> Self {
Self { min_rand: fidl::new_empty!(i64, D), max_rand: 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Increment {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Increment {
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<Increment, D>
for &Increment
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Increment>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Increment::Determined(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Increment::Random(ref val) => fidl::encoding::encode_in_envelope::<RandomRange, D>(
<RandomRange as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Increment {
#[inline(always)]
fn new_empty() -> Self {
Self::Determined(fidl::new_empty!(i64, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <RandomRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Increment::Determined(_) = self {
} else {
*self = Increment::Determined(fidl::new_empty!(i64, D));
}
#[allow(irrefutable_let_patterns)]
if let Increment::Determined(ref mut val) = self {
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Increment::Random(_) = self {
} else {
*self = Increment::Random(fidl::new_empty!(RandomRange, D));
}
#[allow(irrefutable_let_patterns)]
if let Increment::Random(ref mut val) = self {
fidl::decode!(RandomRange, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}