#![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;
pub type DeviceName = String;
pub type PeerIdString = String;
pub type UuidString = String;
pub const MAJOR_DEVICE_CLASS_AUDIO_VIDEO: u32 = 1024;
pub const MAJOR_DEVICE_CLASS_COMPUTER: u32 = 256;
pub const MAJOR_DEVICE_CLASS_HEALTH: u32 = 2304;
pub const MAJOR_DEVICE_CLASS_IMAGING: u32 = 1536;
pub const MAJOR_DEVICE_CLASS_LAN: u32 = 768;
pub const MAJOR_DEVICE_CLASS_MASK: u32 = 7936;
pub const MAJOR_DEVICE_CLASS_MISCELLANEOUS: u32 = 0;
pub const MAJOR_DEVICE_CLASS_PERIPHERAL: u32 = 1280;
pub const MAJOR_DEVICE_CLASS_PHONE: u32 = 512;
pub const MAJOR_DEVICE_CLASS_TOY: u32 = 2048;
pub const MAJOR_DEVICE_CLASS_UNCATEGORIZED: u32 = 7936;
pub const MAJOR_DEVICE_CLASS_WEARABLE: u32 = 1792;
pub const MAX_DEVICE_NAME_LENGTH: u8 = 248;
pub const UUID_STRING_REPRESENTATION_LENGTH: u8 = 36;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum AddressType {
Public = 1,
Random = 2,
}
impl AddressType {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Public),
2 => Some(Self::Random),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Appearance {
Unknown,
Phone,
Computer,
Watch,
WatchSports,
Clock,
Display,
RemoteControl,
EyeGlasses,
Tag,
Keyring,
MediaPlayer,
BarcodeScanner,
Thermometer,
ThermometerEar,
HeartRateSensor,
HeartRateSensorBelt,
BloodPressure,
BloodPressureArm,
BloodPressureWrist,
Hid,
HidKeyboard,
HidMouse,
HidJoystick,
HidGamepad,
HidDigitizerTablet,
HidCardReader,
HidDigitalPen,
HidBarcodeScanner,
GlucoseMeter,
RunningWalkingSensor,
RunningWalkingSensorInShoe,
RunningWalkingSensorOnShoe,
RunningWalkingSensorOnHip,
Cycling,
CyclingComputer,
CyclingSpeedSensor,
CyclingCadenceSensor,
CyclingPowerSensor,
CyclingSpeedAndCadenceSensor,
PulseOximeter,
PulseOximeterFingertip,
PulseOximeterWrist,
WeightScale,
PersonalMobility,
PersonalMobilityWheelchair,
PersonalMobilityScooter,
GlucoseMonitor,
SportsActivity,
SportsActivityLocationDisplay,
SportsActivityLocationAndNavDisplay,
SportsActivityLocationPod,
SportsActivityLocationAndNavPod,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! AppearanceUnknown {
() => {
_
};
}
impl Appearance {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
0 => Some(Self::Unknown),
64 => Some(Self::Phone),
128 => Some(Self::Computer),
192 => Some(Self::Watch),
193 => Some(Self::WatchSports),
256 => Some(Self::Clock),
320 => Some(Self::Display),
384 => Some(Self::RemoteControl),
448 => Some(Self::EyeGlasses),
512 => Some(Self::Tag),
576 => Some(Self::Keyring),
640 => Some(Self::MediaPlayer),
704 => Some(Self::BarcodeScanner),
768 => Some(Self::Thermometer),
769 => Some(Self::ThermometerEar),
832 => Some(Self::HeartRateSensor),
833 => Some(Self::HeartRateSensorBelt),
896 => Some(Self::BloodPressure),
897 => Some(Self::BloodPressureArm),
898 => Some(Self::BloodPressureWrist),
960 => Some(Self::Hid),
961 => Some(Self::HidKeyboard),
962 => Some(Self::HidMouse),
963 => Some(Self::HidJoystick),
964 => Some(Self::HidGamepad),
965 => Some(Self::HidDigitizerTablet),
966 => Some(Self::HidCardReader),
967 => Some(Self::HidDigitalPen),
968 => Some(Self::HidBarcodeScanner),
1024 => Some(Self::GlucoseMeter),
1088 => Some(Self::RunningWalkingSensor),
1089 => Some(Self::RunningWalkingSensorInShoe),
1090 => Some(Self::RunningWalkingSensorOnShoe),
1091 => Some(Self::RunningWalkingSensorOnHip),
1152 => Some(Self::Cycling),
1153 => Some(Self::CyclingComputer),
1154 => Some(Self::CyclingSpeedSensor),
1155 => Some(Self::CyclingCadenceSensor),
1156 => Some(Self::CyclingPowerSensor),
1157 => Some(Self::CyclingSpeedAndCadenceSensor),
3136 => Some(Self::PulseOximeter),
3137 => Some(Self::PulseOximeterFingertip),
3138 => Some(Self::PulseOximeterWrist),
3200 => Some(Self::WeightScale),
3264 => Some(Self::PersonalMobility),
3265 => Some(Self::PersonalMobilityWheelchair),
3266 => Some(Self::PersonalMobilityScooter),
3328 => Some(Self::GlucoseMonitor),
5184 => Some(Self::SportsActivity),
5185 => Some(Self::SportsActivityLocationDisplay),
5186 => Some(Self::SportsActivityLocationAndNavDisplay),
5187 => Some(Self::SportsActivityLocationPod),
5188 => Some(Self::SportsActivityLocationAndNavPod),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
0 => Self::Unknown,
64 => Self::Phone,
128 => Self::Computer,
192 => Self::Watch,
193 => Self::WatchSports,
256 => Self::Clock,
320 => Self::Display,
384 => Self::RemoteControl,
448 => Self::EyeGlasses,
512 => Self::Tag,
576 => Self::Keyring,
640 => Self::MediaPlayer,
704 => Self::BarcodeScanner,
768 => Self::Thermometer,
769 => Self::ThermometerEar,
832 => Self::HeartRateSensor,
833 => Self::HeartRateSensorBelt,
896 => Self::BloodPressure,
897 => Self::BloodPressureArm,
898 => Self::BloodPressureWrist,
960 => Self::Hid,
961 => Self::HidKeyboard,
962 => Self::HidMouse,
963 => Self::HidJoystick,
964 => Self::HidGamepad,
965 => Self::HidDigitizerTablet,
966 => Self::HidCardReader,
967 => Self::HidDigitalPen,
968 => Self::HidBarcodeScanner,
1024 => Self::GlucoseMeter,
1088 => Self::RunningWalkingSensor,
1089 => Self::RunningWalkingSensorInShoe,
1090 => Self::RunningWalkingSensorOnShoe,
1091 => Self::RunningWalkingSensorOnHip,
1152 => Self::Cycling,
1153 => Self::CyclingComputer,
1154 => Self::CyclingSpeedSensor,
1155 => Self::CyclingCadenceSensor,
1156 => Self::CyclingPowerSensor,
1157 => Self::CyclingSpeedAndCadenceSensor,
3136 => Self::PulseOximeter,
3137 => Self::PulseOximeterFingertip,
3138 => Self::PulseOximeterWrist,
3200 => Self::WeightScale,
3264 => Self::PersonalMobility,
3265 => Self::PersonalMobilityWheelchair,
3266 => Self::PersonalMobilityScooter,
3328 => Self::GlucoseMonitor,
5184 => Self::SportsActivity,
5185 => Self::SportsActivityLocationDisplay,
5186 => Self::SportsActivityLocationAndNavDisplay,
5187 => Self::SportsActivityLocationPod,
5188 => Self::SportsActivityLocationAndNavPod,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffff }
}
#[inline]
pub const fn into_primitive(self) -> u16 {
match self {
Self::Unknown => 0,
Self::Phone => 64,
Self::Computer => 128,
Self::Watch => 192,
Self::WatchSports => 193,
Self::Clock => 256,
Self::Display => 320,
Self::RemoteControl => 384,
Self::EyeGlasses => 448,
Self::Tag => 512,
Self::Keyring => 576,
Self::MediaPlayer => 640,
Self::BarcodeScanner => 704,
Self::Thermometer => 768,
Self::ThermometerEar => 769,
Self::HeartRateSensor => 832,
Self::HeartRateSensorBelt => 833,
Self::BloodPressure => 896,
Self::BloodPressureArm => 897,
Self::BloodPressureWrist => 898,
Self::Hid => 960,
Self::HidKeyboard => 961,
Self::HidMouse => 962,
Self::HidJoystick => 963,
Self::HidGamepad => 964,
Self::HidDigitizerTablet => 965,
Self::HidCardReader => 966,
Self::HidDigitalPen => 967,
Self::HidBarcodeScanner => 968,
Self::GlucoseMeter => 1024,
Self::RunningWalkingSensor => 1088,
Self::RunningWalkingSensorInShoe => 1089,
Self::RunningWalkingSensorOnShoe => 1090,
Self::RunningWalkingSensorOnHip => 1091,
Self::Cycling => 1152,
Self::CyclingComputer => 1153,
Self::CyclingSpeedSensor => 1154,
Self::CyclingCadenceSensor => 1155,
Self::CyclingPowerSensor => 1156,
Self::CyclingSpeedAndCadenceSensor => 1157,
Self::PulseOximeter => 3136,
Self::PulseOximeterFingertip => 3137,
Self::PulseOximeterWrist => 3138,
Self::WeightScale => 3200,
Self::PersonalMobility => 3264,
Self::PersonalMobilityWheelchair => 3265,
Self::PersonalMobilityScooter => 3266,
Self::GlucoseMonitor => 3328,
Self::SportsActivity => 5184,
Self::SportsActivityLocationDisplay => 5185,
Self::SportsActivityLocationAndNavDisplay => 5186,
Self::SportsActivityLocationPod => 5187,
Self::SportsActivityLocationAndNavPod => 5188,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AssignedCodingFormat {
ULawLog,
ALawLog,
Cvsd,
Transparent,
LinearPcm,
Msbc,
Lc3,
G729A,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AssignedCodingFormatUnknown {
() => {
_
};
}
impl AssignedCodingFormat {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::ULawLog),
1 => Some(Self::ALawLog),
2 => Some(Self::Cvsd),
3 => Some(Self::Transparent),
4 => Some(Self::LinearPcm),
5 => Some(Self::Msbc),
6 => Some(Self::Lc3),
7 => Some(Self::G729A),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::ULawLog,
1 => Self::ALawLog,
2 => Self::Cvsd,
3 => Self::Transparent,
4 => Self::LinearPcm,
5 => Self::Msbc,
6 => Self::Lc3,
7 => Self::G729A,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::ULawLog => 0,
Self::ALawLog => 1,
Self::Cvsd => 2,
Self::Transparent => 3,
Self::LinearPcm => 4,
Self::Msbc => 5,
Self::Lc3 => 6,
Self::G729A => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ChannelMode {
Basic,
EnhancedRetransmission,
LeCreditBasedFlowControl,
EnhancedCreditBasedFlowControl,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ChannelModeUnknown {
() => {
_
};
}
impl ChannelMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Basic),
2 => Some(Self::EnhancedRetransmission),
3 => Some(Self::LeCreditBasedFlowControl),
4 => Some(Self::EnhancedCreditBasedFlowControl),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Basic,
2 => Self::EnhancedRetransmission,
3 => Self::LeCreditBasedFlowControl,
4 => Self::EnhancedCreditBasedFlowControl,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Basic => 1,
Self::EnhancedRetransmission => 2,
Self::LeCreditBasedFlowControl => 3,
Self::EnhancedCreditBasedFlowControl => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ConnectionRole {
Leader = 1,
Follower = 2,
}
impl ConnectionRole {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Leader),
2 => Some(Self::Follower),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum DataDirection {
Input = 1,
Output = 2,
}
impl DataDirection {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Input),
2 => Some(Self::Output),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ErrorCode {
Unknown = 0,
Failed = 1,
Canceled = 2,
InProgress = 3,
TimedOut = 4,
NotFound = 5,
NotSupported = 6,
BluetoothNotAvailable = 7,
BadState = 8,
InvalidArguments = 9,
Already = 10,
ProtocolError = 11,
}
impl ErrorCode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unknown),
1 => Some(Self::Failed),
2 => Some(Self::Canceled),
3 => Some(Self::InProgress),
4 => Some(Self::TimedOut),
5 => Some(Self::NotFound),
6 => Some(Self::NotSupported),
7 => Some(Self::BluetoothNotAvailable),
8 => Some(Self::BadState),
9 => Some(Self::InvalidArguments),
10 => Some(Self::Already),
11 => Some(Self::ProtocolError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum LogicalTransportType {
LeCis,
LeBis,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u8 },
}
#[macro_export]
macro_rules! LogicalTransportTypeUnknown {
() => {
_
};
}
impl LogicalTransportType {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::LeCis),
2 => Some(Self::LeBis),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::LeCis,
2 => Self::LeBis,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::LeCis => 1,
Self::LeBis => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Address {
pub type_: AddressType,
pub bytes: [u8; 6],
}
impl fidl::Persistable for Address {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Bool {
pub value: bool,
}
impl fidl::Persistable for Bool {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelSendRequest {
pub packets: Vec<Packet>,
}
impl fidl::Persistable for ChannelSendRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelReceiveResponse {
pub packets: Vec<Packet>,
}
impl fidl::Persistable for ChannelReceiveResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceClass {
pub value: u32,
}
impl fidl::Persistable for DeviceClass {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Error {
pub error_code: ErrorCode,
pub protocol_error_code: u32,
pub description: Option<String>,
}
impl fidl::Persistable for Error {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HostId {
pub value: u64,
}
impl fidl::Persistable for HostId {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Int8 {
pub value: i8,
}
impl fidl::Persistable for Int8 {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Packet {
pub packet: Vec<u8>,
}
impl fidl::Persistable for Packet {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PeerId {
pub value: u64,
}
impl fidl::Persistable for PeerId {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Status {
pub error: Option<Box<Error>>,
}
impl fidl::Persistable for Status {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct UInt16 {
pub value: u16,
}
impl fidl::Persistable for UInt16 {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Uuid {
pub value: [u8; 16],
}
impl fidl::Persistable for Uuid {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ChannelParameters {
pub channel_mode: Option<ChannelMode>,
pub max_rx_packet_size: Option<u16>,
pub security_requirements: Option<SecurityRequirements>,
pub flush_timeout: Option<i64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ChannelParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CodecAttributes {
pub codec_id: Option<CodecId>,
pub codec_configuration: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for CodecAttributes {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SecurityRequirements {
pub authentication_required: Option<bool>,
pub secure_connections_required: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SecurityRequirements {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VendorCodingFormat {
pub company_id: Option<u16>,
pub vendor_id: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for VendorCodingFormat {}
#[derive(Clone, Debug)]
pub enum CodecId {
AssignedFormat(AssignedCodingFormat),
VendorFormat(VendorCodingFormat),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! CodecIdUnknown {
() => {
_
};
}
impl PartialEq for CodecId {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::AssignedFormat(x), Self::AssignedFormat(y)) => *x == *y,
(Self::VendorFormat(x), Self::VendorFormat(y)) => *x == *y,
_ => false,
}
}
}
impl CodecId {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::AssignedFormat(_) => 1,
Self::VendorFormat(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for CodecId {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ChannelMarker;
impl fidl::endpoints::ProtocolMarker for ChannelMarker {
type Proxy = ChannelProxy;
type RequestStream = ChannelRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ChannelSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Channel";
}
pub trait ChannelProxyInterface: Send + Sync {
type Send_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_(&self, packets: &[Packet]) -> Self::Send_ResponseFut;
type ReceiveResponseFut: std::future::Future<Output = Result<Vec<Packet>, fidl::Error>> + Send;
fn r#receive(&self) -> Self::ReceiveResponseFut;
type WatchChannelParametersResponseFut: std::future::Future<Output = Result<ChannelParameters, fidl::Error>>
+ Send;
fn r#watch_channel_parameters(&self) -> Self::WatchChannelParametersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ChannelSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ChannelSynchronousProxy {
type Proxy = ChannelProxy;
type Protocol = ChannelMarker;
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 ChannelSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ChannelMarker 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<ChannelEvent, fidl::Error> {
ChannelEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#send_(
&self,
mut packets: &[Packet],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ChannelSendRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(packets,),
0x6fc4419c2e763324,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("send_")?;
Ok(_response)
}
pub fn r#receive(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Packet>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ChannelReceiveResponse>,
>(
(),
0x3498d7bdb7cdbfd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("receive")?;
Ok(_response.packets)
}
pub fn r#watch_channel_parameters(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelParameters, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ChannelParameters>,
>(
(),
0x5a0cec81d5076c12,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("watch_channel_parameters")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ChannelProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ChannelProxy {
type Protocol = ChannelMarker;
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 ChannelProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ChannelEventStream {
ChannelEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#send_(
&self,
mut packets: &[Packet],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ChannelProxyInterface::r#send_(self, packets)
}
pub fn r#receive(
&self,
) -> fidl::client::QueryResponseFut<Vec<Packet>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
ChannelProxyInterface::r#receive(self)
}
pub fn r#watch_channel_parameters(
&self,
) -> fidl::client::QueryResponseFut<
ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#watch_channel_parameters(self)
}
}
impl ChannelProxyInterface for ChannelProxy {
type Send_ResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_(&self, mut packets: &[Packet]) -> Self::Send_ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6fc4419c2e763324,
>(_buf?)?
.into_result::<ChannelMarker>("send_")?;
Ok(_response)
}
self.client.send_query_and_decode::<ChannelSendRequest, ()>(
(packets,),
0x6fc4419c2e763324,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReceiveResponseFut =
fidl::client::QueryResponseFut<Vec<Packet>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#receive(&self) -> Self::ReceiveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<Packet>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ChannelReceiveResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3498d7bdb7cdbfd4,
>(_buf?)?
.into_result::<ChannelMarker>("receive")?;
Ok(_response.packets)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Packet>>(
(),
0x3498d7bdb7cdbfd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WatchChannelParametersResponseFut = fidl::client::QueryResponseFut<
ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_channel_parameters(&self) -> Self::WatchChannelParametersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelParameters, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ChannelParameters>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5a0cec81d5076c12,
>(_buf?)?
.into_result::<ChannelMarker>("watch_channel_parameters")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChannelParameters>(
(),
0x5a0cec81d5076c12,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ChannelEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ChannelEventStream {}
impl futures::stream::FusedStream for ChannelEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ChannelEventStream {
type Item = Result<ChannelEvent, 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(ChannelEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ChannelEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ChannelEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ChannelEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ChannelRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ChannelRequestStream {}
impl futures::stream::FusedStream for ChannelRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ChannelRequestStream {
type Protocol = ChannelMarker;
type ControlHandle = ChannelControlHandle;
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 {
ChannelControlHandle { 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 ChannelRequestStream {
type Item = Result<ChannelRequest, 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 ChannelRequestStream 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 {
0x6fc4419c2e763324 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelSendRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelSendRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::Send_ {
packets: req.packets,
responder: ChannelSend_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3498d7bdb7cdbfd4 => {
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 = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::Receive {
responder: ChannelReceiveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5a0cec81d5076c12 => {
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 = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::WatchChannelParameters {
responder: ChannelWatchChannelParametersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ChannelRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ChannelControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ChannelRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ChannelControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ChannelRequest {
Send_ { packets: Vec<Packet>, responder: ChannelSend_Responder },
Receive { responder: ChannelReceiveResponder },
WatchChannelParameters { responder: ChannelWatchChannelParametersResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ChannelControlHandle,
method_type: fidl::MethodType,
},
}
impl ChannelRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_send_(self) -> Option<(Vec<Packet>, ChannelSend_Responder)> {
if let ChannelRequest::Send_ { packets, responder } = self {
Some((packets, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_receive(self) -> Option<(ChannelReceiveResponder)> {
if let ChannelRequest::Receive { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_channel_parameters(self) -> Option<(ChannelWatchChannelParametersResponder)> {
if let ChannelRequest::WatchChannelParameters { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ChannelRequest::Send_ { .. } => "send_",
ChannelRequest::Receive { .. } => "receive",
ChannelRequest::WatchChannelParameters { .. } => "watch_channel_parameters",
ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ChannelControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ChannelControlHandle {
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 ChannelControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelSend_Responder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelSend_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelSend_Responder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelSend_Responder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
fidl::encoding::Flexible::new(()),
self.tx_id,
0x6fc4419c2e763324,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelReceiveResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelReceiveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelReceiveResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelReceiveResponder {
pub fn send(self, mut packets: &[Packet]) -> Result<(), fidl::Error> {
let _result = self.send_raw(packets);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut packets: &[Packet]) -> Result<(), fidl::Error> {
let _result = self.send_raw(packets);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut packets: &[Packet]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<ChannelReceiveResponse>>(
fidl::encoding::Flexible::new((packets,)),
self.tx_id,
0x3498d7bdb7cdbfd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelWatchChannelParametersResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelWatchChannelParametersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelWatchChannelParametersResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelWatchChannelParametersResponder {
pub fn send(self, mut payload: &ChannelParameters) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut payload: &ChannelParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &ChannelParameters) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<ChannelParameters>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x5a0cec81d5076c12,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AddressType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AddressType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AddressType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressType {
#[inline(always)]
fn new_empty() -> Self {
Self::Public
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Appearance {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u16>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u16>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Appearance {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Appearance {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Appearance {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AssignedCodingFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AssignedCodingFormat {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for AssignedCodingFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AssignedCodingFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelMode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ChannelMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectionRole {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ConnectionRole {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ConnectionRole {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionRole {
#[inline(always)]
fn new_empty() -> Self {
Self::Leader
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DataDirection {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for DataDirection {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DataDirection {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DataDirection {
#[inline(always)]
fn new_empty() -> Self {
Self::Input
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ErrorCode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ErrorCode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
#[inline(always)]
fn new_empty() -> Self {
Self::Unknown
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for LogicalTransportType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for LogicalTransportType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for LogicalTransportType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogicalTransportType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Address {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Address {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
7
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Address>(offset);
fidl::encoding::Encode::<Address, D>::encode(
(
<AddressType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(
&self.bytes,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AddressType, D>,
T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
> fidl::encoding::Encode<Address, 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::<Address>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
#[inline(always)]
fn new_empty() -> Self {
Self {
type_: fidl::new_empty!(AddressType, D),
bytes: fidl::new_empty!(fidl::encoding::Array<u8, 6>, 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!(AddressType, D, &mut self.type_, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bytes, decoder, offset + 1, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Bool {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Bool {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Bool, D> for &Bool {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Bool>(offset);
fidl::encoding::Encode::<Bool, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<Bool, 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::<Bool>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Bool {
#[inline(always)]
fn new_empty() -> Self {
Self { value: 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);
fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ChannelSendRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelSendRequest {
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<ChannelSendRequest, D>
for &ChannelSendRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelSendRequest>(offset);
fidl::encoding::Encode::<ChannelSendRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
> fidl::encoding::Encode<ChannelSendRequest, 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::<ChannelSendRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSendRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, 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::UnboundedVector<Packet>,
D,
&mut self.packets,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ChannelReceiveResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelReceiveResponse {
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<ChannelReceiveResponse, D> for &ChannelReceiveResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
fidl::encoding::Encode::<ChannelReceiveResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
> fidl::encoding::Encode<ChannelReceiveResponse, 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::<ChannelReceiveResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelReceiveResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, 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::UnboundedVector<Packet>,
D,
&mut self.packets,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceClass {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceClass {
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<DeviceClass, D>
for &DeviceClass
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceClass>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceClass).write_unaligned((self as *const DeviceClass).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceClass, 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::<DeviceClass>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
#[inline(always)]
fn new_empty() -> Self {
Self { value: 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) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Error {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
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<Error, D> for &Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Error>(offset);
fidl::encoding::Encode::<Error, D>::encode(
(
<ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.error_code),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_error_code),
<fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.description),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ErrorCode, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
> fidl::encoding::Encode<Error, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Error>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self {
error_code: fidl::new_empty!(ErrorCode, D),
protocol_error_code: fidl::new_empty!(u32, D),
description: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
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!(ErrorCode, D, &mut self.error_code, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.protocol_error_code, decoder, offset + 4, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::UnboundedString>,
D,
&mut self.description,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostId {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostId, D> for &HostId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostId>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HostId).write_unaligned((self as *const HostId).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<HostId, 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::<HostId>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostId {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Int8 {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Int8 {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[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<Int8, D> for &Int8 {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Int8>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Int8).write_unaligned((self as *const Int8).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i8, D>>
fidl::encoding::Encode<Int8, 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::<Int8>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Int8 {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(i8, 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, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Packet {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Packet {
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<Packet, D> for &Packet {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Packet>(offset);
fidl::encoding::Encode::<Packet, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.packet,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<Packet, 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::<Packet>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, 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::UnboundedVector<u8>,
D,
&mut self.packet,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerId {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerId, D> for &PeerId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerId>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PeerId).write_unaligned((self as *const PeerId).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<PeerId, 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::<PeerId>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerId {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Status {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Status {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Status, D> for &Status {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Status>(offset);
fidl::encoding::Encode::<Status, D>::encode(
(<fidl::encoding::Boxed<Error> as fidl::encoding::ValueTypeMarker>::borrow(
&self.error,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<Error>, D>,
> fidl::encoding::Encode<Status, 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::<Status>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(fidl::encoding::Boxed<Error>, 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::Boxed<Error>,
D,
&mut self.error,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UInt16 {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UInt16 {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[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<UInt16, D> for &UInt16 {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UInt16>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut UInt16).write_unaligned((self as *const UInt16).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<UInt16, 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::<UInt16>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UInt16 {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u16, 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, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Uuid {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Uuid {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Uuid, D> for &Uuid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Uuid>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Uuid).write_unaligned((self as *const Uuid).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
> fidl::encoding::Encode<Uuid, 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::<Uuid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Uuid {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl ChannelParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flush_timeout {
return 4;
}
if let Some(_) = self.security_requirements {
return 3;
}
if let Some(_) = self.max_rx_packet_size {
return 2;
}
if let Some(_) = self.channel_mode {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ChannelParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelParameters {
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<ChannelParameters, D>
for &ChannelParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelParameters>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ChannelMode, D>(
self.channel_mode
.as_ref()
.map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.max_rx_packet_size
.as_ref()
.map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
self.security_requirements
.as_ref()
.map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode, D));
fidl::decode!(ChannelMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.max_rx_packet_size.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.security_requirements
.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
fidl::decode!(
SecurityRequirements,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl CodecAttributes {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.codec_configuration {
return 2;
}
if let Some(_) = self.codec_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for CodecAttributes {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CodecAttributes {
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<CodecAttributes, D>
for &CodecAttributes
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CodecAttributes>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<CodecId, D>(
self.codec_id.as_ref().map(<CodecId as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
self.codec_configuration.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecAttributes {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<CodecId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.codec_id.get_or_insert_with(|| fidl::new_empty!(CodecId, D));
fidl::decode!(CodecId, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.codec_configuration.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl SecurityRequirements {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.secure_connections_required {
return 2;
}
if let Some(_) = self.authentication_required {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
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<SecurityRequirements, D>
for &SecurityRequirements
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityRequirements>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.authentication_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.secure_connections_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.secure_connections_required
.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl VendorCodingFormat {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.vendor_id {
return 2;
}
if let Some(_) = self.company_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for VendorCodingFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorCodingFormat {
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<VendorCodingFormat, D>
for &VendorCodingFormat
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorCodingFormat>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.company_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.vendor_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorCodingFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.company_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CodecId {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CodecId {
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<CodecId, D> for &CodecId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CodecId>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
CodecId::AssignedFormat(ref val) => {
fidl::encoding::encode_in_envelope::<AssignedCodingFormat, D>(
<AssignedCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
CodecId::VendorFormat(ref val) => {
fidl::encoding::encode_in_envelope::<VendorCodingFormat, D>(
<VendorCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
CodecId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecId {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <AssignedCodingFormat as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => {
<VendorCodingFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let CodecId::AssignedFormat(_) = self {
} else {
*self = CodecId::AssignedFormat(fidl::new_empty!(AssignedCodingFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let CodecId::AssignedFormat(ref mut val) = self {
fidl::decode!(AssignedCodingFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let CodecId::VendorFormat(_) = self {
} else {
*self = CodecId::VendorFormat(fidl::new_empty!(VendorCodingFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let CodecId::VendorFormat(ref mut val) = self {
fidl::decode!(VendorCodingFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = CodecId::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}