#![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(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProviderConfig {
pub buffering_mode: fidl_fuchsia_tracing::BufferingMode,
pub buffer: fidl::Vmo,
pub fifo: fidl::Fifo,
pub categories: Vec<String>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderConfig {}
#[derive(Clone, Debug, PartialEq)]
pub struct ProviderGetKnownCategoriesResponse {
pub categories: Vec<fidl_fuchsia_tracing::KnownCategory>,
}
impl fidl::Persistable for ProviderGetKnownCategoriesResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProviderInitializeRequest {
pub config: ProviderConfig,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderInitializeRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProviderStartRequest {
pub options: StartOptions,
}
impl fidl::Persistable for ProviderStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegistryRegisterProviderRequest {
pub provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pub pid: u64,
pub name: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RegistryRegisterProviderRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegistryRegisterProviderSynchronouslyRequest {
pub provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pub pid: u64,
pub name: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RegistryRegisterProviderSynchronouslyRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegistryRegisterProviderSynchronouslyResponse {
pub s: i32,
pub started: bool,
}
impl fidl::Persistable for RegistryRegisterProviderSynchronouslyResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StartOptions {
pub buffer_disposition: fidl_fuchsia_tracing::BufferDisposition,
pub additional_categories: Vec<String>,
}
impl fidl::Persistable for StartOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProviderMarker;
impl fidl::endpoints::ProtocolMarker for ProviderMarker {
type Proxy = ProviderProxy;
type RequestStream = ProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Provider";
}
pub trait ProviderProxyInterface: Send + Sync {
fn r#initialize(&self, config: ProviderConfig) -> Result<(), fidl::Error>;
fn r#start(&self, options: &StartOptions) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
fn r#terminate(&self) -> Result<(), fidl::Error>;
type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
+ Send;
fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
type Proxy = ProviderProxy;
type Protocol = ProviderMarker;
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 ProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProviderMarker 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<ProviderEvent, fidl::Error> {
ProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
self.client.send::<ProviderInitializeRequest>(
(&mut config,),
0x9e31667d7b180f7,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
self.client.send::<ProviderStartRequest>(
(options,),
0x5bae2b60be66a815,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x133df8ebb1897df0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#terminate(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6b5564032f2726b1,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_known_categories(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ProviderGetKnownCategoriesResponse>(
(),
0x5f5b0ad77af3f886,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.categories)
}
}
#[derive(Debug, Clone)]
pub struct ProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProviderProxy {
type Protocol = ProviderMarker;
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 ProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProviderEventStream {
ProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
ProviderProxyInterface::r#initialize(self, config)
}
pub fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
ProviderProxyInterface::r#start(self, options)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
ProviderProxyInterface::r#stop(self)
}
pub fn r#terminate(&self) -> Result<(), fidl::Error> {
ProviderProxyInterface::r#terminate(self)
}
pub fn r#get_known_categories(
&self,
) -> fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_tracing::KnownCategory>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProviderProxyInterface::r#get_known_categories(self)
}
}
impl ProviderProxyInterface for ProviderProxy {
fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
self.client.send::<ProviderInitializeRequest>(
(&mut config,),
0x9e31667d7b180f7,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
self.client.send::<ProviderStartRequest>(
(options,),
0x5bae2b60be66a815,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x133df8ebb1897df0,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#terminate(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6b5564032f2726b1,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_tracing::KnownCategory>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProviderGetKnownCategoriesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5f5b0ad77af3f886,
>(_buf?)?;
Ok(_response.categories)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
Vec<fidl_fuchsia_tracing::KnownCategory>,
>(
(),
0x5f5b0ad77af3f886,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProviderEventStream {}
impl futures::stream::FusedStream for ProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProviderEventStream {
type Item = Result<ProviderEvent, 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(ProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProviderEvent {}
impl ProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProviderEvent, 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: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProviderRequestStream {}
impl futures::stream::FusedStream for ProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProviderRequestStream {
type Protocol = ProviderMarker;
type ControlHandle = ProviderControlHandle;
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 {
ProviderControlHandle { 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 ProviderRequestStream {
type Item = Result<ProviderRequest, 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 ProviderRequestStream 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 {
0x9e31667d7b180f7 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProviderInitializeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderInitializeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::Initialize { config: req.config, control_handle })
}
0x5bae2b60be66a815 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProviderStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::Start { options: req.options, control_handle })
}
0x133df8ebb1897df0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
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 = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::Stop { control_handle })
}
0x6b5564032f2726b1 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
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 = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::Terminate { control_handle })
}
0x5f5b0ad77af3f886 => {
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 = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::GetKnownCategories {
responder: ProviderGetKnownCategoriesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProviderRequest {
Initialize { config: ProviderConfig, control_handle: ProviderControlHandle },
Start { options: StartOptions, control_handle: ProviderControlHandle },
Stop { control_handle: ProviderControlHandle },
Terminate { control_handle: ProviderControlHandle },
GetKnownCategories { responder: ProviderGetKnownCategoriesResponder },
}
impl ProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_initialize(self) -> Option<(ProviderConfig, ProviderControlHandle)> {
if let ProviderRequest::Initialize { config, control_handle } = self {
Some((config, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartOptions, ProviderControlHandle)> {
if let ProviderRequest::Start { options, control_handle } = self {
Some((options, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(ProviderControlHandle)> {
if let ProviderRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_terminate(self) -> Option<(ProviderControlHandle)> {
if let ProviderRequest::Terminate { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_known_categories(self) -> Option<(ProviderGetKnownCategoriesResponder)> {
if let ProviderRequest::GetKnownCategories { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProviderRequest::Initialize { .. } => "initialize",
ProviderRequest::Start { .. } => "start",
ProviderRequest::Stop { .. } => "stop",
ProviderRequest::Terminate { .. } => "terminate",
ProviderRequest::GetKnownCategories { .. } => "get_known_categories",
}
}
}
#[derive(Debug, Clone)]
pub struct ProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProviderControlHandle {
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 ProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProviderGetKnownCategoriesResponder {
control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProviderGetKnownCategoriesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProviderGetKnownCategoriesResponder {
type ControlHandle = ProviderControlHandle;
fn control_handle(&self) -> &ProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProviderGetKnownCategoriesResponder {
pub fn send(
self,
mut categories: &[fidl_fuchsia_tracing::KnownCategory],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(categories);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut categories: &[fidl_fuchsia_tracing::KnownCategory],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(categories);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut categories: &[fidl_fuchsia_tracing::KnownCategory],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProviderGetKnownCategoriesResponse>(
(categories,),
self.tx_id,
0x5f5b0ad77af3f886,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RegistryMarker;
impl fidl::endpoints::ProtocolMarker for RegistryMarker {
type Proxy = RegistryProxy;
type RequestStream = RegistryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RegistrySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.tracing.provider.Registry";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
pub trait RegistryProxyInterface: Send + Sync {
fn r#register_provider(
&self,
provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pid: u64,
name: &str,
) -> Result<(), fidl::Error>;
type RegisterProviderSynchronouslyResponseFut: std::future::Future<Output = Result<(i32, bool), fidl::Error>>
+ Send;
fn r#register_provider_synchronously(
&self,
provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pid: u64,
name: &str,
) -> Self::RegisterProviderSynchronouslyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RegistrySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
type Proxy = RegistryProxy;
type Protocol = RegistryMarker;
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 RegistrySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RegistryMarker 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<RegistryEvent, fidl::Error> {
RegistryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
) -> Result<(), fidl::Error> {
self.client.send::<RegistryRegisterProviderRequest>(
(provider, pid, name),
0x75bcae3dfa08479c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#register_provider_synchronously(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, bool), fidl::Error> {
let _response = self.client.send_query::<
RegistryRegisterProviderSynchronouslyRequest,
RegistryRegisterProviderSynchronouslyResponse,
>(
(provider, pid, name,),
0x4835ed419a808f16,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.s, _response.started))
}
}
#[derive(Debug, Clone)]
pub struct RegistryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RegistryProxy {
type Protocol = RegistryMarker;
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 RegistryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RegistryEventStream {
RegistryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
) -> Result<(), fidl::Error> {
RegistryProxyInterface::r#register_provider(self, provider, pid, name)
}
pub fn r#register_provider_synchronously(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
) -> fidl::client::QueryResponseFut<(i32, bool), fidl::encoding::DefaultFuchsiaResourceDialect>
{
RegistryProxyInterface::r#register_provider_synchronously(self, provider, pid, name)
}
}
impl RegistryProxyInterface for RegistryProxy {
fn r#register_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
) -> Result<(), fidl::Error> {
self.client.send::<RegistryRegisterProviderRequest>(
(provider, pid, name),
0x75bcae3dfa08479c,
fidl::encoding::DynamicFlags::empty(),
)
}
type RegisterProviderSynchronouslyResponseFut =
fidl::client::QueryResponseFut<(i32, bool), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_provider_synchronously(
&self,
mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
mut pid: u64,
mut name: &str,
) -> Self::RegisterProviderSynchronouslyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, bool), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RegistryRegisterProviderSynchronouslyResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4835ed419a808f16,
>(_buf?)?;
Ok((_response.s, _response.started))
}
self.client
.send_query_and_decode::<RegistryRegisterProviderSynchronouslyRequest, (i32, bool)>(
(provider, pid, name),
0x4835ed419a808f16,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RegistryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RegistryEventStream {}
impl futures::stream::FusedStream for RegistryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RegistryEventStream {
type Item = Result<RegistryEvent, 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(RegistryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RegistryEvent {}
impl RegistryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RegistryEvent, 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: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RegistryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RegistryRequestStream {}
impl futures::stream::FusedStream for RegistryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RegistryRequestStream {
type Protocol = RegistryMarker;
type ControlHandle = RegistryControlHandle;
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 {
RegistryControlHandle { 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 RegistryRequestStream {
type Item = Result<RegistryRequest, 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 RegistryRequestStream 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 {
0x75bcae3dfa08479c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
RegistryRegisterProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterProviderRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RegistryControlHandle { inner: this.inner.clone() };
Ok(RegistryRequest::RegisterProvider {
provider: req.provider,
pid: req.pid,
name: req.name,
control_handle,
})
}
0x4835ed419a808f16 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RegistryRegisterProviderSynchronouslyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterProviderSynchronouslyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RegistryControlHandle { inner: this.inner.clone() };
Ok(RegistryRequest::RegisterProviderSynchronously {
provider: req.provider,
pid: req.pid,
name: req.name,
responder: RegistryRegisterProviderSynchronouslyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RegistryRequest {
RegisterProvider {
provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pid: u64,
name: String,
control_handle: RegistryControlHandle,
},
RegisterProviderSynchronously {
provider: fidl::endpoints::ClientEnd<ProviderMarker>,
pid: u64,
name: String,
responder: RegistryRegisterProviderSynchronouslyResponder,
},
}
impl RegistryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_provider(
self,
) -> Option<(fidl::endpoints::ClientEnd<ProviderMarker>, u64, String, RegistryControlHandle)>
{
if let RegistryRequest::RegisterProvider { provider, pid, name, control_handle } = self {
Some((provider, pid, name, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_provider_synchronously(
self,
) -> Option<(
fidl::endpoints::ClientEnd<ProviderMarker>,
u64,
String,
RegistryRegisterProviderSynchronouslyResponder,
)> {
if let RegistryRequest::RegisterProviderSynchronously { provider, pid, name, responder } =
self
{
Some((provider, pid, name, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RegistryRequest::RegisterProvider { .. } => "register_provider",
RegistryRequest::RegisterProviderSynchronously { .. } => {
"register_provider_synchronously"
}
}
}
}
#[derive(Debug, Clone)]
pub struct RegistryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RegistryControlHandle {
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 RegistryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RegistryRegisterProviderSynchronouslyResponder {
control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RegistryRegisterProviderSynchronouslyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RegistryRegisterProviderSynchronouslyResponder {
type ControlHandle = RegistryControlHandle;
fn control_handle(&self) -> &RegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RegistryRegisterProviderSynchronouslyResponder {
pub fn send(self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, started);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, started);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RegistryRegisterProviderSynchronouslyResponse>(
(s, started),
self.tx_id,
0x4835ed419a808f16,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for ProviderConfig {
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 ProviderConfig {
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
fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ProviderConfig
{
#[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::<ProviderConfig>(offset);
fidl::encoding::Encode::<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow(&self.buffering_mode),
<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
<fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.fifo),
<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_tracing::BufferingMode,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Fifo,
{ fidl::ObjectType::FIFO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2, T3)
{
#[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::<ProviderConfig>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProviderConfig
{
#[inline(always)]
fn new_empty() -> Self {
Self {
buffering_mode: fidl::new_empty!(
fidl_fuchsia_tracing::BufferingMode,
fidl::encoding::DefaultFuchsiaResourceDialect
),
buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
categories: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
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 = 0xffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_tracing::BufferingMode,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.buffering_mode,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.buffer, decoder, offset + 4, _depth)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.categories,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProviderGetKnownCategoriesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProviderGetKnownCategoriesResponse {
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<ProviderGetKnownCategoriesResponse, D>
for &ProviderGetKnownCategoriesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProviderGetKnownCategoriesResponse>(offset);
fidl::encoding::Encode::<ProviderGetKnownCategoriesResponse, D>::encode(
(
<fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>,
D,
>,
> fidl::encoding::Encode<ProviderGetKnownCategoriesResponse, 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::<ProviderGetKnownCategoriesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProviderGetKnownCategoriesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
categories: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D, &mut self.categories, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProviderInitializeRequest {
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 ProviderInitializeRequest {
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
fidl::encoding::Encode<
ProviderInitializeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProviderInitializeRequest
{
#[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::<ProviderInitializeRequest>(offset);
fidl::encoding::Encode::<
ProviderInitializeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<ProviderConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.config,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
ProviderInitializeRequest,
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::<ProviderInitializeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProviderInitializeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
config: fidl::new_empty!(
ProviderConfig,
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!(
ProviderConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProviderStartRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProviderStartRequest {
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<ProviderStartRequest, D>
for &ProviderStartRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProviderStartRequest>(offset);
fidl::encoding::Encode::<ProviderStartRequest, D>::encode(
(<StartOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StartOptions, D>>
fidl::encoding::Encode<ProviderStartRequest, 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::<ProviderStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderStartRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { options: fidl::new_empty!(StartOptions, 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!(StartOptions, D, &mut self.options, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RegistryRegisterProviderRequest {
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 RegistryRegisterProviderRequest {
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
fidl::encoding::Encode<
RegistryRegisterProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RegistryRegisterProviderRequest
{
#[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::<RegistryRegisterProviderRequest>(offset);
fidl::encoding::Encode::<RegistryRegisterProviderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::BoundedString<100>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RegistryRegisterProviderRequest,
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::<RegistryRegisterProviderRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RegistryRegisterProviderRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
pid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
name: fidl::new_empty!(
fidl::encoding::BoundedString<100>,
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::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.pid,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<100>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RegistryRegisterProviderSynchronouslyRequest {
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 RegistryRegisterProviderSynchronouslyRequest {
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
fidl::encoding::Encode<
RegistryRegisterProviderSynchronouslyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RegistryRegisterProviderSynchronouslyRequest
{
#[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::<RegistryRegisterProviderSynchronouslyRequest>(offset);
fidl::encoding::Encode::<RegistryRegisterProviderSynchronouslyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::BoundedString<100>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RegistryRegisterProviderSynchronouslyRequest,
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::<RegistryRegisterProviderSynchronouslyRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RegistryRegisterProviderSynchronouslyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
pid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
name: fidl::new_empty!(
fidl::encoding::BoundedString<100>,
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::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.pid,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<100>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RegistryRegisterProviderSynchronouslyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RegistryRegisterProviderSynchronouslyResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RegistryRegisterProviderSynchronouslyResponse, D>
for &RegistryRegisterProviderSynchronouslyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegistryRegisterProviderSynchronouslyResponse>(offset);
fidl::encoding::Encode::<RegistryRegisterProviderSynchronouslyResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.started),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<RegistryRegisterProviderSynchronouslyResponse, 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::<RegistryRegisterProviderSynchronouslyResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RegistryRegisterProviderSynchronouslyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(i32, D), started: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.started, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StartOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StartOptions {
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<StartOptions, D>
for &StartOptions
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartOptions>(offset);
fidl::encoding::Encode::<StartOptions, D>::encode(
(
<fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_disposition),
<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.additional_categories),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_tracing::BufferDisposition, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
D,
>,
> fidl::encoding::Encode<StartOptions, 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::<StartOptions>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartOptions {
#[inline(always)]
fn new_empty() -> Self {
Self {
buffer_disposition: fidl::new_empty!(fidl_fuchsia_tracing::BufferDisposition, D),
additional_categories: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
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_fuchsia_tracing::BufferDisposition,
D,
&mut self.buffer_disposition,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
D,
&mut self.additional_categories,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
}