fidl_cf_sc_internal_pkgresolverconfig/
fidl_cf_sc_internal_pkgresolverconfig.rs#![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 Config {
pub blob_download_concurrency_limit: u16,
pub blob_download_resumption_attempts_limit: u32,
pub blob_network_body_timeout_seconds: u32,
pub blob_network_header_timeout_seconds: u32,
pub delivery_blob_type: u32,
pub tuf_metadata_timeout_seconds: u32,
}
impl fidl::Persistable for Config {}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for Config {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Config {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Config>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Config).write_unaligned((self as *const Config).read());
let padding_ptr = buf_ptr.offset(0) as *mut u32;
let padding_mask = 0xffff0000u32;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Config>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).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 + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
self.5.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
#[inline(always)]
fn new_empty() -> Self {
Self {
blob_download_concurrency_limit: fidl::new_empty!(u16, D),
blob_download_resumption_attempts_limit: fidl::new_empty!(u32, D),
blob_network_body_timeout_seconds: fidl::new_empty!(u32, D),
blob_network_header_timeout_seconds: fidl::new_empty!(u32, D),
delivery_blob_type: fidl::new_empty!(u32, D),
tuf_metadata_timeout_seconds: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffff0000u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
}
Ok(())
}
}
}