#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct CpuSet {
pub mask: [u64; 8],
}
impl fidl::Persistable for CpuSet {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ProfileProviderGetCpuAffinityProfileRequest {
pub cpu_mask: CpuSet,
}
impl fidl::Persistable for ProfileProviderGetCpuAffinityProfileRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderGetCpuAffinityProfileResponse {
pub status: i32,
pub profile: Option<fidl::Profile>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetCpuAffinityProfileResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderGetDeadlineProfileRequest {
pub capacity: u64,
pub deadline: u64,
pub period: u64,
pub name: String,
}
impl fidl::Persistable for ProfileProviderGetDeadlineProfileRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderGetDeadlineProfileResponse {
pub status: i32,
pub profile: Option<fidl::Profile>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetDeadlineProfileResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderGetProfileRequest {
pub priority: u32,
pub name: String,
}
impl fidl::Persistable for ProfileProviderGetProfileRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderGetProfileResponse {
pub status: i32,
pub profile: Option<fidl::Profile>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetProfileResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderSetProfileByRoleRequest {
pub handle: fidl::Handle,
pub role: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderSetProfileByRoleRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ProfileProviderSetProfileByRoleResponse {
pub status: i32,
}
impl fidl::Persistable for ProfileProviderSetProfileByRoleResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProfileProviderMarker;
impl fidl::endpoints::ProtocolMarker for ProfileProviderMarker {
type Proxy = ProfileProviderProxy;
type RequestStream = ProfileProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.scheduler.deprecated.ProfileProvider";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileProviderMarker {}
pub trait ProfileProviderProxyInterface: Send + Sync {
type GetProfileResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Profile>), fidl::Error>>
+ Send;
fn r#get_profile(&self, priority: u32, name: &str) -> Self::GetProfileResponseFut;
type GetDeadlineProfileResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Profile>), fidl::Error>>
+ Send;
fn r#get_deadline_profile(
&self,
capacity: u64,
deadline: u64,
period: u64,
name: &str,
) -> Self::GetDeadlineProfileResponseFut;
type GetCpuAffinityProfileResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Profile>), fidl::Error>>
+ Send;
fn r#get_cpu_affinity_profile(
&self,
cpu_mask: &CpuSet,
) -> Self::GetCpuAffinityProfileResponseFut;
type SetProfileByRoleResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#set_profile_by_role(
&self,
handle: fidl::Handle,
role: &str,
) -> Self::SetProfileByRoleResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileProviderSynchronousProxy {
type Proxy = ProfileProviderProxy;
type Protocol = ProfileProviderMarker;
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 ProfileProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileProviderMarker 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<ProfileProviderEvent, fidl::Error> {
ProfileProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_profile(
&self,
mut priority: u32,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = self
.client
.send_query::<ProfileProviderGetProfileRequest, ProfileProviderGetProfileResponse>(
(priority, name),
0x686b544f3d19d679,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.profile))
}
pub fn r#get_deadline_profile(
&self,
mut capacity: u64,
mut deadline: u64,
mut period: u64,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = self.client.send_query::<
ProfileProviderGetDeadlineProfileRequest,
ProfileProviderGetDeadlineProfileResponse,
>(
(capacity, deadline, period, name,),
0x62404c816133daee,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.profile))
}
pub fn r#get_cpu_affinity_profile(
&self,
mut cpu_mask: &CpuSet,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = self.client.send_query::<
ProfileProviderGetCpuAffinityProfileRequest,
ProfileProviderGetCpuAffinityProfileResponse,
>(
(cpu_mask,),
0x36cc6d51ff82ee04,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.profile))
}
pub fn r#set_profile_by_role(
&self,
mut handle: fidl::Handle,
mut role: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<
ProfileProviderSetProfileByRoleRequest,
ProfileProviderSetProfileByRoleResponse,
>(
(handle, role,),
0x31c4d936c0009564,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct ProfileProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProfileProviderProxy {
type Protocol = ProfileProviderMarker;
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 ProfileProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileProviderEventStream {
ProfileProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_profile(
&self,
mut priority: u32,
mut name: &str,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProviderProxyInterface::r#get_profile(self, priority, name)
}
pub fn r#get_deadline_profile(
&self,
mut capacity: u64,
mut deadline: u64,
mut period: u64,
mut name: &str,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProviderProxyInterface::r#get_deadline_profile(
self, capacity, deadline, period, name,
)
}
pub fn r#get_cpu_affinity_profile(
&self,
mut cpu_mask: &CpuSet,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProviderProxyInterface::r#get_cpu_affinity_profile(self, cpu_mask)
}
pub fn r#set_profile_by_role(
&self,
mut handle: fidl::Handle,
mut role: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
ProfileProviderProxyInterface::r#set_profile_by_role(self, handle, role)
}
}
impl ProfileProviderProxyInterface for ProfileProviderProxy {
type GetProfileResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_profile(&self, mut priority: u32, mut name: &str) -> Self::GetProfileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProfileProviderGetProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x686b544f3d19d679,
>(_buf?)?;
Ok((_response.status, _response.profile))
}
self.client.send_query_and_decode::<
ProfileProviderGetProfileRequest,
(i32, Option<fidl::Profile>),
>(
(priority, name,),
0x686b544f3d19d679,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDeadlineProfileResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_deadline_profile(
&self,
mut capacity: u64,
mut deadline: u64,
mut period: u64,
mut name: &str,
) -> Self::GetDeadlineProfileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProfileProviderGetDeadlineProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x62404c816133daee,
>(_buf?)?;
Ok((_response.status, _response.profile))
}
self.client.send_query_and_decode::<
ProfileProviderGetDeadlineProfileRequest,
(i32, Option<fidl::Profile>),
>(
(capacity, deadline, period, name,),
0x62404c816133daee,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetCpuAffinityProfileResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::Profile>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_cpu_affinity_profile(
&self,
mut cpu_mask: &CpuSet,
) -> Self::GetCpuAffinityProfileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::Profile>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProfileProviderGetCpuAffinityProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x36cc6d51ff82ee04,
>(_buf?)?;
Ok((_response.status, _response.profile))
}
self.client.send_query_and_decode::<
ProfileProviderGetCpuAffinityProfileRequest,
(i32, Option<fidl::Profile>),
>(
(cpu_mask,),
0x36cc6d51ff82ee04,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetProfileByRoleResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_profile_by_role(
&self,
mut handle: fidl::Handle,
mut role: &str,
) -> Self::SetProfileByRoleResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProfileProviderSetProfileByRoleResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x31c4d936c0009564,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<ProfileProviderSetProfileByRoleRequest, i32>(
(handle, role),
0x31c4d936c0009564,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProfileProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProfileProviderEventStream {}
impl futures::stream::FusedStream for ProfileProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileProviderEventStream {
type Item = Result<ProfileProviderEvent, 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(ProfileProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileProviderEvent {}
impl ProfileProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProfileProviderEvent, 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:
<ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileProviderRequestStream {}
impl futures::stream::FusedStream for ProfileProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileProviderRequestStream {
type Protocol = ProfileProviderMarker;
type ControlHandle = ProfileProviderControlHandle;
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 {
ProfileProviderControlHandle { 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 ProfileProviderRequestStream {
type Item = Result<ProfileProviderRequest, 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 ProfileProviderRequestStream 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 {
0x686b544f3d19d679 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderGetProfileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderGetProfileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::GetProfile {
priority: req.priority,
name: req.name,
responder: ProfileProviderGetProfileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x62404c816133daee => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderGetDeadlineProfileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderGetDeadlineProfileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::GetDeadlineProfile {
capacity: req.capacity,
deadline: req.deadline,
period: req.period,
name: req.name,
responder: ProfileProviderGetDeadlineProfileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x36cc6d51ff82ee04 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderGetCpuAffinityProfileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderGetCpuAffinityProfileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::GetCpuAffinityProfile {
cpu_mask: req.cpu_mask,
responder: ProfileProviderGetCpuAffinityProfileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x31c4d936c0009564 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderSetProfileByRoleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderSetProfileByRoleRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::SetProfileByRole {
handle: req.handle,
role: req.role,
responder: ProfileProviderSetProfileByRoleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProfileProviderRequest {
GetProfile { priority: u32, name: String, responder: ProfileProviderGetProfileResponder },
GetDeadlineProfile {
capacity: u64,
deadline: u64,
period: u64,
name: String,
responder: ProfileProviderGetDeadlineProfileResponder,
},
GetCpuAffinityProfile {
cpu_mask: CpuSet,
responder: ProfileProviderGetCpuAffinityProfileResponder,
},
SetProfileByRole {
handle: fidl::Handle,
role: String,
responder: ProfileProviderSetProfileByRoleResponder,
},
}
impl ProfileProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_profile(self) -> Option<(u32, String, ProfileProviderGetProfileResponder)> {
if let ProfileProviderRequest::GetProfile { priority, name, responder } = self {
Some((priority, name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_deadline_profile(
self,
) -> Option<(u64, u64, u64, String, ProfileProviderGetDeadlineProfileResponder)> {
if let ProfileProviderRequest::GetDeadlineProfile {
capacity,
deadline,
period,
name,
responder,
} = self
{
Some((capacity, deadline, period, name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_cpu_affinity_profile(
self,
) -> Option<(CpuSet, ProfileProviderGetCpuAffinityProfileResponder)> {
if let ProfileProviderRequest::GetCpuAffinityProfile { cpu_mask, responder } = self {
Some((cpu_mask, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_profile_by_role(
self,
) -> Option<(fidl::Handle, String, ProfileProviderSetProfileByRoleResponder)> {
if let ProfileProviderRequest::SetProfileByRole { handle, role, responder } = self {
Some((handle, role, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileProviderRequest::GetProfile { .. } => "get_profile",
ProfileProviderRequest::GetDeadlineProfile { .. } => "get_deadline_profile",
ProfileProviderRequest::GetCpuAffinityProfile { .. } => "get_cpu_affinity_profile",
ProfileProviderRequest::SetProfileByRole { .. } => "set_profile_by_role",
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProfileProviderControlHandle {
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 ProfileProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderGetProfileResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderGetProfileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderGetProfileResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderGetProfileResponder {
pub fn send(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProfileProviderGetProfileResponse>(
(status, profile),
self.tx_id,
0x686b544f3d19d679,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderGetDeadlineProfileResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderGetDeadlineProfileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderGetDeadlineProfileResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderGetDeadlineProfileResponder {
pub fn send(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProfileProviderGetDeadlineProfileResponse>(
(status, profile),
self.tx_id,
0x62404c816133daee,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderGetCpuAffinityProfileResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderGetCpuAffinityProfileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderGetCpuAffinityProfileResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderGetCpuAffinityProfileResponder {
pub fn send(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, profile);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut profile: Option<fidl::Profile>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProfileProviderGetCpuAffinityProfileResponse>(
(status, profile),
self.tx_id,
0x36cc6d51ff82ee04,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderSetProfileByRoleResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderSetProfileByRoleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderSetProfileByRoleResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderSetProfileByRoleResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProfileProviderSetProfileByRoleResponse>(
(status,),
self.tx_id,
0x31c4d936c0009564,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for CpuSet {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CpuSet {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
#[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<CpuSet, D> for &CpuSet {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CpuSet>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut CpuSet).write_unaligned((self as *const CpuSet).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u64, 8>, D>,
> fidl::encoding::Encode<CpuSet, 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::<CpuSet>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuSet {
#[inline(always)]
fn new_empty() -> Self {
Self { mask: fidl::new_empty!(fidl::encoding::Array<u64, 8>, 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, 64);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileProviderGetCpuAffinityProfileRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetCpuAffinityProfileRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
#[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<ProfileProviderGetCpuAffinityProfileRequest, D>
for &ProfileProviderGetCpuAffinityProfileRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileProviderGetCpuAffinityProfileRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ProfileProviderGetCpuAffinityProfileRequest).write_unaligned(
(self as *const ProfileProviderGetCpuAffinityProfileRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CpuSet, D>>
fidl::encoding::Encode<ProfileProviderGetCpuAffinityProfileRequest, 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::<ProfileProviderGetCpuAffinityProfileRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProfileProviderGetCpuAffinityProfileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { cpu_mask: fidl::new_empty!(CpuSet, 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, 64);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetCpuAffinityProfileResponse {
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 ProfileProviderGetCpuAffinityProfileResponse {
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
fidl::encoding::Encode<
ProfileProviderGetCpuAffinityProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderGetCpuAffinityProfileResponse
{
#[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::<ProfileProviderGetCpuAffinityProfileResponse>(offset);
fidl::encoding::Encode::<
ProfileProviderGetCpuAffinityProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.profile
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderGetCpuAffinityProfileResponse,
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::<ProfileProviderGetCpuAffinityProfileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetCpuAffinityProfileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
profile: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.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!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.profile,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileProviderGetDeadlineProfileRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetDeadlineProfileRequest {
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<ProfileProviderGetDeadlineProfileRequest, D>
for &ProfileProviderGetDeadlineProfileRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileRequest>(offset);
fidl::encoding::Encode::<ProfileProviderGetDeadlineProfileRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.capacity),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.period),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
> fidl::encoding::Encode<ProfileProviderGetDeadlineProfileRequest, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProfileProviderGetDeadlineProfileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
capacity: fidl::new_empty!(u64, D),
deadline: fidl::new_empty!(u64, D),
period: fidl::new_empty!(u64, D),
name: fidl::new_empty!(fidl::encoding::BoundedString<64>, 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!(u64, D, &mut self.capacity, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.deadline, decoder, offset + 8, _depth)?;
fidl::decode!(u64, D, &mut self.period, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.name,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetDeadlineProfileResponse {
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 ProfileProviderGetDeadlineProfileResponse {
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
fidl::encoding::Encode<
ProfileProviderGetDeadlineProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderGetDeadlineProfileResponse
{
#[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::<ProfileProviderGetDeadlineProfileResponse>(offset);
fidl::encoding::Encode::<
ProfileProviderGetDeadlineProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.profile
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderGetDeadlineProfileResponse,
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::<ProfileProviderGetDeadlineProfileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetDeadlineProfileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
profile: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.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!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.profile,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileProviderGetProfileRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetProfileRequest {
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<ProfileProviderGetProfileRequest, D>
for &ProfileProviderGetProfileRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileProviderGetProfileRequest>(offset);
fidl::encoding::Encode::<ProfileProviderGetProfileRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
> fidl::encoding::Encode<ProfileProviderGetProfileRequest, 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::<ProfileProviderGetProfileRequest>(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 ProfileProviderGetProfileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
priority: fidl::new_empty!(u32, D),
name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, D, &mut self.priority, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetProfileResponse {
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 ProfileProviderGetProfileResponse {
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
fidl::encoding::Encode<
ProfileProviderGetProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderGetProfileResponse
{
#[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::<ProfileProviderGetProfileResponse>(offset);
fidl::encoding::Encode::<
ProfileProviderGetProfileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.profile
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderGetProfileResponse,
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::<ProfileProviderGetProfileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderGetProfileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
profile: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.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!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Profile,
{ fidl::ObjectType::PROFILE.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.profile,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderSetProfileByRoleRequest {
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 ProfileProviderSetProfileByRoleRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ProfileProviderSetProfileByRoleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderSetProfileByRoleRequest
{
#[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::<ProfileProviderSetProfileByRoleRequest>(offset);
fidl::encoding::Encode::<ProfileProviderSetProfileByRoleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
<fidl::encoding::BoundedString<2048> as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<2048>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderSetProfileByRoleRequest,
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::<ProfileProviderSetProfileByRoleRequest>(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 ProfileProviderSetProfileByRoleRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
role: fidl::new_empty!(
fidl::encoding::BoundedString<2048>,
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::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<2048>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.role,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileProviderSetProfileByRoleResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileProviderSetProfileByRoleResponse {
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
}
#[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<ProfileProviderSetProfileByRoleResponse, D>
for &ProfileProviderSetProfileByRoleResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileProviderSetProfileByRoleResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ProfileProviderSetProfileByRoleResponse).write_unaligned(
(self as *const ProfileProviderSetProfileByRoleResponse).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<ProfileProviderSetProfileByRoleResponse, 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::<ProfileProviderSetProfileByRoleResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProfileProviderSetProfileByRoleResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, 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, 4);
}
Ok(())
}
}
}