#![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 ChannelMode = fidl_fuchsia_bluetooth::ChannelMode;
pub type ChannelParameters = fidl_fuchsia_bluetooth::ChannelParameters;
pub type ProtocolDescriptorList = Vec<ProtocolDescriptor>;
pub type RfcommChannel = u8;
pub const ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST: u16 = 13;
pub const ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST: u16 = 9;
pub const ATTR_BROWSE_GROUP_LIST: u16 = 5;
pub const ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST: u16 = 6;
pub const ATTR_PROTOCOL_DESCRIPTOR_LIST: u16 = 4;
pub const ATTR_SERVICE_AVAILABILITY: u16 = 8;
pub const ATTR_SERVICE_CLASS_ID_LIST: u16 = 1;
pub const ATTR_SERVICE_ID: u16 = 3;
pub const ATTR_SERVICE_INFO_TIME_TO_LIVE: u16 = 7;
pub const ATTR_SERVICE_RECORD_HANDLE: u16 = 0;
pub const ATTR_SERVICE_RECORD_STATE: u16 = 2;
pub const MAX_ADDITIONAL_ATTRIBUTES: u16 = 65023;
pub const MAX_ATTRIBUTES: u16 = 512;
pub const MAX_INFORMATION_COUNT: u8 = 85;
pub const MAX_SEQUENCE_LENGTH: u8 = 255;
pub const MAX_SERVICES_PER_ADVERTISEMENT: u8 = 32;
pub const MAX_STRING_LENGTH: u16 = 1024;
pub const PSM_3_DSP: u16 = 33;
pub const PSM_ATT: u16 = 31;
pub const PSM_AVCTP: u16 = 23;
pub const PSM_AVCTP_BROWSE: u16 = 27;
pub const PSM_AVDTP: u16 = 25;
pub const PSM_BNEP: u16 = 15;
pub const PSM_DYNAMIC: u16 = 65535;
pub const PSM_HID_CONTROL: u16 = 17;
pub const PSM_HID_INTERRUPT: u16 = 19;
pub const PSM_LE_IPSP: u16 = 35;
pub const PSM_OTS: u16 = 37;
pub const PSM_RFCOMM: u16 = 3;
pub const PSM_SDP: u16 = 1;
pub const PSM_TCSBIN: u16 = 5;
pub const PSM_TCSBIN_CORDLESS: u16 = 7;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum A2dpDirectionPriority {
Normal = 1,
Source = 2,
Sink = 3,
}
impl A2dpDirectionPriority {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Normal),
2 => Some(Self::Source),
3 => Some(Self::Sink),
_ => 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 AudioBitsPerSample {
Bps16,
Bps24,
Bps32,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioBitsPerSampleUnknown {
() => {
_
};
}
impl AudioBitsPerSample {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Bps16),
2 => Some(Self::Bps24),
3 => Some(Self::Bps32),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Bps16,
2 => Self::Bps24,
3 => Self::Bps32,
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::Bps16 => 1,
Self::Bps24 => 2,
Self::Bps32 => 3,
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 AudioChannelMode {
Mono,
Stereo,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioChannelModeUnknown {
() => {
_
};
}
impl AudioChannelMode {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Mono),
1 => Some(Self::Stereo),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Mono,
1 => Self::Stereo,
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::Mono => 0,
Self::Stereo => 1,
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 AudioSamplingFrequency {
Hz44100,
Hz48000,
Hz88200,
Hz96000,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioSamplingFrequencyUnknown {
() => {
_
};
}
impl AudioSamplingFrequency {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Hz44100),
2 => Some(Self::Hz48000),
3 => Some(Self::Hz88200),
4 => Some(Self::Hz96000),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Hz44100,
2 => Self::Hz48000,
3 => Self::Hz88200,
4 => Self::Hz96000,
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::Hz44100 => 1,
Self::Hz48000 => 2,
Self::Hz88200 => 3,
Self::Hz96000 => 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(u8)]
pub enum DataPath {
Host = 1,
Offload = 2,
Test = 3,
}
impl DataPath {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Host),
2 => Some(Self::Offload),
3 => Some(Self::Test),
_ => 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 HfpParameterSet {
T1,
T2,
S1,
S2,
S3,
S4,
D0,
D1,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! HfpParameterSetUnknown {
() => {
_
};
}
impl HfpParameterSet {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::T1),
2 => Some(Self::T2),
3 => Some(Self::S1),
4 => Some(Self::S2),
5 => Some(Self::S3),
6 => Some(Self::S4),
7 => Some(Self::D0),
8 => Some(Self::D1),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::T1,
2 => Self::T2,
3 => Self::S1,
4 => Self::S2,
5 => Self::S3,
6 => Self::S4,
7 => Self::D0,
8 => Self::D1,
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::T1 => 1,
Self::T2 => 2,
Self::S1 => 3,
Self::S2 => 4,
Self::S3 => 5,
Self::S4 => 6,
Self::D0 => 7,
Self::D1 => 8,
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 ProtocolIdentifier {
Sdp,
Rfcomm,
Att,
Obex,
Bnep,
Hidp,
HardcopyControlChannel,
HardcopyDataChannel,
HardcopyNotification,
Avctp,
Avdtp,
McapControlChannel,
McapDataChannel,
L2Cap,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ProtocolIdentifierUnknown {
() => {
_
};
}
impl ProtocolIdentifier {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
1 => Some(Self::Sdp),
3 => Some(Self::Rfcomm),
7 => Some(Self::Att),
8 => Some(Self::Obex),
15 => Some(Self::Bnep),
17 => Some(Self::Hidp),
18 => Some(Self::HardcopyControlChannel),
20 => Some(Self::HardcopyDataChannel),
22 => Some(Self::HardcopyNotification),
23 => Some(Self::Avctp),
25 => Some(Self::Avdtp),
30 => Some(Self::McapControlChannel),
31 => Some(Self::McapDataChannel),
256 => Some(Self::L2Cap),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
1 => Self::Sdp,
3 => Self::Rfcomm,
7 => Self::Att,
8 => Self::Obex,
15 => Self::Bnep,
17 => Self::Hidp,
18 => Self::HardcopyControlChannel,
20 => Self::HardcopyDataChannel,
22 => Self::HardcopyNotification,
23 => Self::Avctp,
25 => Self::Avdtp,
30 => Self::McapControlChannel,
31 => Self::McapDataChannel,
256 => Self::L2Cap,
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::Sdp => 1,
Self::Rfcomm => 3,
Self::Att => 7,
Self::Obex => 8,
Self::Bnep => 15,
Self::Hidp => 17,
Self::HardcopyControlChannel => 18,
Self::HardcopyDataChannel => 20,
Self::HardcopyNotification => 22,
Self::Avctp => 23,
Self::Avdtp => 25,
Self::McapControlChannel => 30,
Self::McapDataChannel => 31,
Self::L2Cap => 256,
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(u8)]
pub enum RxPacketStatus {
CorrectlyReceivedData = 0,
PossiblyInvalidData = 1,
NoDataReceived = 2,
DataPartiallyLost = 3,
}
impl RxPacketStatus {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::CorrectlyReceivedData),
1 => Some(Self::PossiblyInvalidData),
2 => Some(Self::NoDataReceived),
3 => Some(Self::DataPartiallyLost),
_ => 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 ScoErrorCode {
Failure,
Cancelled,
InvalidArguments,
ParametersRejected,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! ScoErrorCodeUnknown {
() => {
_
};
}
impl ScoErrorCode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Failure),
2 => Some(Self::Cancelled),
3 => Some(Self::InvalidArguments),
4 => Some(Self::ParametersRejected),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Failure,
2 => Self::Cancelled,
3 => Self::InvalidArguments,
4 => Self::ParametersRejected,
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::Failure => 1,
Self::Cancelled => 2,
Self::InvalidArguments => 3,
Self::ParametersRejected => 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)]
pub enum ServiceClassProfileIdentifier {
SerialPort,
DialupNetworking,
ObexObjectPush,
OpexFileTransfer,
Headset,
HeadsetAudioGateway,
HeadsetHs,
AudioSource,
AudioSink,
AdvancedAudioDistribution,
AvRemoteControlTarget,
AvRemoteControl,
AvRemoteControlController,
Panu,
Nap,
Gn,
Handsfree,
HandsfreeAudioGateway,
HumanInterfaceDevice,
SimAccess,
PhonebookPce,
PhonebookPse,
Phonebook,
MessageAccessServer,
MessageNotificationServer,
MessageAccessProfile,
MpsProfile,
MpsClass,
PnpInformation,
GenericNetworking,
GenericFileTransfer,
GenericAudio,
GenericTelephony,
VideoSource,
VideoSink,
VideoDistribution,
Hdp,
HdpSource,
HdpSink,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ServiceClassProfileIdentifierUnknown {
() => {
_
};
}
impl ServiceClassProfileIdentifier {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
4353 => Some(Self::SerialPort),
4355 => Some(Self::DialupNetworking),
4357 => Some(Self::ObexObjectPush),
4358 => Some(Self::OpexFileTransfer),
4360 => Some(Self::Headset),
4370 => Some(Self::HeadsetAudioGateway),
4401 => Some(Self::HeadsetHs),
4362 => Some(Self::AudioSource),
4363 => Some(Self::AudioSink),
4365 => Some(Self::AdvancedAudioDistribution),
4364 => Some(Self::AvRemoteControlTarget),
4366 => Some(Self::AvRemoteControl),
4367 => Some(Self::AvRemoteControlController),
4373 => Some(Self::Panu),
4374 => Some(Self::Nap),
4375 => Some(Self::Gn),
4382 => Some(Self::Handsfree),
4383 => Some(Self::HandsfreeAudioGateway),
4388 => Some(Self::HumanInterfaceDevice),
4397 => Some(Self::SimAccess),
4398 => Some(Self::PhonebookPce),
4399 => Some(Self::PhonebookPse),
4400 => Some(Self::Phonebook),
4402 => Some(Self::MessageAccessServer),
4403 => Some(Self::MessageNotificationServer),
4404 => Some(Self::MessageAccessProfile),
4410 => Some(Self::MpsProfile),
4411 => Some(Self::MpsClass),
4608 => Some(Self::PnpInformation),
4609 => Some(Self::GenericNetworking),
4610 => Some(Self::GenericFileTransfer),
4611 => Some(Self::GenericAudio),
4612 => Some(Self::GenericTelephony),
4867 => Some(Self::VideoSource),
4868 => Some(Self::VideoSink),
4869 => Some(Self::VideoDistribution),
5120 => Some(Self::Hdp),
5121 => Some(Self::HdpSource),
5122 => Some(Self::HdpSink),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
4353 => Self::SerialPort,
4355 => Self::DialupNetworking,
4357 => Self::ObexObjectPush,
4358 => Self::OpexFileTransfer,
4360 => Self::Headset,
4370 => Self::HeadsetAudioGateway,
4401 => Self::HeadsetHs,
4362 => Self::AudioSource,
4363 => Self::AudioSink,
4365 => Self::AdvancedAudioDistribution,
4364 => Self::AvRemoteControlTarget,
4366 => Self::AvRemoteControl,
4367 => Self::AvRemoteControlController,
4373 => Self::Panu,
4374 => Self::Nap,
4375 => Self::Gn,
4382 => Self::Handsfree,
4383 => Self::HandsfreeAudioGateway,
4388 => Self::HumanInterfaceDevice,
4397 => Self::SimAccess,
4398 => Self::PhonebookPce,
4399 => Self::PhonebookPse,
4400 => Self::Phonebook,
4402 => Self::MessageAccessServer,
4403 => Self::MessageNotificationServer,
4404 => Self::MessageAccessProfile,
4410 => Self::MpsProfile,
4411 => Self::MpsClass,
4608 => Self::PnpInformation,
4609 => Self::GenericNetworking,
4610 => Self::GenericFileTransfer,
4611 => Self::GenericAudio,
4612 => Self::GenericTelephony,
4867 => Self::VideoSource,
4868 => Self::VideoSink,
4869 => Self::VideoDistribution,
5120 => Self::Hdp,
5121 => Self::HdpSource,
5122 => Self::HdpSink,
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::SerialPort => 4353,
Self::DialupNetworking => 4355,
Self::ObexObjectPush => 4357,
Self::OpexFileTransfer => 4358,
Self::Headset => 4360,
Self::HeadsetAudioGateway => 4370,
Self::HeadsetHs => 4401,
Self::AudioSource => 4362,
Self::AudioSink => 4363,
Self::AdvancedAudioDistribution => 4365,
Self::AvRemoteControlTarget => 4364,
Self::AvRemoteControl => 4366,
Self::AvRemoteControlController => 4367,
Self::Panu => 4373,
Self::Nap => 4374,
Self::Gn => 4375,
Self::Handsfree => 4382,
Self::HandsfreeAudioGateway => 4383,
Self::HumanInterfaceDevice => 4388,
Self::SimAccess => 4397,
Self::PhonebookPce => 4398,
Self::PhonebookPse => 4399,
Self::Phonebook => 4400,
Self::MessageAccessServer => 4402,
Self::MessageNotificationServer => 4403,
Self::MessageAccessProfile => 4404,
Self::MpsProfile => 4410,
Self::MpsClass => 4411,
Self::PnpInformation => 4608,
Self::GenericNetworking => 4609,
Self::GenericFileTransfer => 4610,
Self::GenericAudio => 4611,
Self::GenericTelephony => 4612,
Self::VideoSource => 4867,
Self::VideoSink => 4868,
Self::VideoDistribution => 4869,
Self::Hdp => 5120,
Self::HdpSource => 5121,
Self::HdpSink => 5122,
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 AudioDirectionExtSetPriorityRequest {
pub priority: A2dpDirectionPriority,
}
impl fidl::Persistable for AudioDirectionExtSetPriorityRequest {}
#[derive(Debug, PartialEq)]
pub struct AudioOffloadExtStartAudioOffloadRequest {
pub configuration: AudioOffloadConfiguration,
pub controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioOffloadExtStartAudioOffloadRequest
{
}
#[derive(Debug, PartialEq)]
pub struct ConnectionReceiverConnectedRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub channel: Channel,
pub protocol: Vec<ProtocolDescriptor>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ConnectionReceiverConnectedRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersRequest {
pub request: fidl_fuchsia_bluetooth::ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersResponse {
pub new: fidl_fuchsia_bluetooth::ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct ProfileConnectRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub connection: ConnectParameters,
}
impl fidl::Persistable for ProfileConnectRequest {}
#[derive(Debug, PartialEq)]
pub struct ProfileConnectResponse {
pub channel: Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct SearchResultsServiceFoundRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Option<Vec<ProtocolDescriptor>>,
pub attributes: Vec<Attribute>,
}
impl fidl::Persistable for SearchResultsServiceFoundRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Attribute {
pub id: Option<u16>,
pub element: Option<DataElement>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Attribute {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioAacSupport {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioAacSupport {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioOffloadConfiguration {
pub codec: Option<AudioOffloadFeatures>,
pub max_latency: Option<u16>,
pub scms_t_enable: Option<bool>,
pub sampling_frequency: Option<AudioSamplingFrequency>,
pub bits_per_sample: Option<AudioBitsPerSample>,
pub channel_mode: Option<AudioChannelMode>,
pub encoded_bit_rate: Option<u32>,
pub encoder_settings: Option<AudioEncoderSettings>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioOffloadConfiguration {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioOffloadExtGetSupportedFeaturesResponse {
pub audio_offload_features: Option<Vec<AudioOffloadFeatures>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioOffloadExtGetSupportedFeaturesResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioSbcSupport {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioSbcSupport {}
#[derive(Debug, Default, PartialEq)]
pub struct Channel {
pub socket: Option<fidl::Socket>,
pub channel_mode: Option<fidl_fuchsia_bluetooth::ChannelMode>,
pub max_tx_sdu_size: Option<u16>,
pub ext_direction: Option<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
pub flush_timeout: Option<i64>,
pub ext_l2cap: Option<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
pub ext_audio_offload: Option<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
pub connection: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Information {
pub language: Option<String>,
pub name: Option<String>,
pub description: Option<String>,
pub provider: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Information {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct L2capParameters {
pub psm: Option<u16>,
pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for L2capParameters {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileAdvertiseRequest {
pub services: Option<Vec<ServiceDefinition>>,
pub receiver: Option<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileAdvertiseRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileConnectScoRequest {
pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
pub initiator: Option<bool>,
pub params: Option<Vec<ScoConnectionParameters>>,
pub connection: Option<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectScoRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProfileDescriptor {
pub profile_id: Option<ServiceClassProfileIdentifier>,
pub major_version: Option<u8>,
pub minor_version: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProfileDescriptor {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileSearchRequest {
pub service_uuid: Option<ServiceClassProfileIdentifier>,
pub attr_ids: Option<Vec<u16>>,
pub results: Option<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
pub full_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileSearchRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProfileAdvertiseResponse {
pub services: Option<Vec<ServiceDefinition>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProfileAdvertiseResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProtocolDescriptor {
pub protocol: Option<ProtocolIdentifier>,
pub params: Option<Vec<DataElement>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProtocolDescriptor {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RfcommParameters {
pub channel: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RfcommParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionParameters {
pub parameter_set: Option<HfpParameterSet>,
pub air_coding_format: Option<fidl_fuchsia_bluetooth::AssignedCodingFormat>,
pub air_frame_size: Option<u16>,
pub io_bandwidth: Option<u32>,
pub io_coding_format: Option<fidl_fuchsia_bluetooth::AssignedCodingFormat>,
pub io_frame_size: Option<u16>,
pub io_pcm_data_format: Option<fidl_fuchsia_hardware_audio::SampleFormat>,
pub io_pcm_sample_payload_msb_position: Option<u8>,
pub path: Option<DataPath>,
pub max_tx_data_size: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionWriteRequest {
pub data: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionWriteRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionReadResponse {
pub status_flag: Option<RxPacketStatus>,
pub data: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionReadResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceDefinition {
pub service_class_uuids: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub protocol_descriptor_list: Option<Vec<ProtocolDescriptor>>,
pub additional_protocol_descriptor_lists: Option<Vec<Vec<ProtocolDescriptor>>>,
pub profile_descriptors: Option<Vec<ProfileDescriptor>>,
pub information: Option<Vec<Information>>,
pub additional_attributes: Option<Vec<Attribute>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceDefinition {}
#[derive(Clone, Debug)]
pub enum AudioEncoderSettings {
Sbc(fidl_fuchsia_media::SbcEncoderSettings),
Aac(fidl_fuchsia_media::AacEncoderSettings),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AudioEncoderSettingsUnknown {
() => {
_
};
}
impl PartialEq for AudioEncoderSettings {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Aac(x), Self::Aac(y)) => *x == *y,
_ => false,
}
}
}
impl AudioEncoderSettings {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Sbc(_) => 1,
Self::Aac(_) => 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 AudioEncoderSettings {}
#[derive(Clone, Debug)]
pub enum AudioOffloadFeatures {
Sbc(AudioSbcSupport),
Aac(AudioAacSupport),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AudioOffloadFeaturesUnknown {
() => {
_
};
}
impl PartialEq for AudioOffloadFeatures {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Aac(x), Self::Aac(y)) => *x == *y,
_ => false,
}
}
}
impl AudioOffloadFeatures {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Sbc(_) => 1,
Self::Aac(_) => 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 AudioOffloadFeatures {}
#[derive(Clone, Debug, PartialEq)]
pub enum ConnectParameters {
L2cap(L2capParameters),
Rfcomm(RfcommParameters),
}
impl ConnectParameters {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::L2cap(_) => 1,
Self::Rfcomm(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for ConnectParameters {}
#[derive(Clone, Debug)]
pub enum DataElement {
Int8(i8),
Int16(i16),
Int32(i32),
Int64(i64),
Uint8(u8),
Uint16(u16),
Uint32(u32),
Uint64(u64),
Str(Vec<u8>),
Url(String),
Uuid(fidl_fuchsia_bluetooth::Uuid),
B(bool),
Sequence(Vec<Option<Box<DataElement>>>),
Alternatives(Vec<Option<Box<DataElement>>>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! DataElementUnknown {
() => {
_
};
}
impl PartialEq for DataElement {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Int8(x), Self::Int8(y)) => *x == *y,
(Self::Int16(x), Self::Int16(y)) => *x == *y,
(Self::Int32(x), Self::Int32(y)) => *x == *y,
(Self::Int64(x), Self::Int64(y)) => *x == *y,
(Self::Uint8(x), Self::Uint8(y)) => *x == *y,
(Self::Uint16(x), Self::Uint16(y)) => *x == *y,
(Self::Uint32(x), Self::Uint32(y)) => *x == *y,
(Self::Uint64(x), Self::Uint64(y)) => *x == *y,
(Self::Str(x), Self::Str(y)) => *x == *y,
(Self::Url(x), Self::Url(y)) => *x == *y,
(Self::Uuid(x), Self::Uuid(y)) => *x == *y,
(Self::B(x), Self::B(y)) => *x == *y,
(Self::Sequence(x), Self::Sequence(y)) => *x == *y,
(Self::Alternatives(x), Self::Alternatives(y)) => *x == *y,
_ => false,
}
}
}
impl DataElement {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Int8(_) => 1,
Self::Int16(_) => 2,
Self::Int32(_) => 3,
Self::Int64(_) => 4,
Self::Uint8(_) => 5,
Self::Uint16(_) => 6,
Self::Uint32(_) => 7,
Self::Uint64(_) => 8,
Self::Str(_) => 9,
Self::Url(_) => 10,
Self::Uuid(_) => 11,
Self::B(_) => 12,
Self::Sequence(_) => 13,
Self::Alternatives(_) => 14,
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 DataElement {}
#[derive(Clone, Debug)]
pub enum ScoConnectionOnConnectionCompleteRequest {
ConnectedParams(ScoConnectionParameters),
Error(ScoErrorCode),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ScoConnectionOnConnectionCompleteRequestUnknown {
() => {
_
};
}
impl PartialEq for ScoConnectionOnConnectionCompleteRequest {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::ConnectedParams(x), Self::ConnectedParams(y)) => *x == *y,
(Self::Error(x), Self::Error(y)) => *x == *y,
_ => false,
}
}
}
impl ScoConnectionOnConnectionCompleteRequest {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::ConnectedParams(_) => 1,
Self::Error(_) => 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 ScoConnectionOnConnectionCompleteRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioDirectionExtMarker;
impl fidl::endpoints::ProtocolMarker for AudioDirectionExtMarker {
type Proxy = AudioDirectionExtProxy;
type RequestStream = AudioDirectionExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioDirectionExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioDirectionExt";
}
pub type AudioDirectionExtSetPriorityResult = Result<(), fidl_fuchsia_bluetooth::ErrorCode>;
pub trait AudioDirectionExtProxyInterface: Send + Sync {
type SetPriorityResponseFut: std::future::Future<Output = Result<AudioDirectionExtSetPriorityResult, fidl::Error>>
+ Send;
fn r#set_priority(&self, priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioDirectionExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioDirectionExtSynchronousProxy {
type Proxy = AudioDirectionExtProxy;
type Protocol = AudioDirectionExtMarker;
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 AudioDirectionExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioDirectionExtMarker 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<AudioDirectionExtEvent, fidl::Error> {
AudioDirectionExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_priority(
&self,
mut priority: A2dpDirectionPriority,
___deadline: zx::MonotonicInstant,
) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
let _response = self
.client
.send_query::<AudioDirectionExtSetPriorityRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
(priority,),
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioDirectionExtMarker>("set_priority")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct AudioDirectionExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioDirectionExtProxy {
type Protocol = AudioDirectionExtMarker;
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 AudioDirectionExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioDirectionExtEventStream {
AudioDirectionExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_priority(
&self,
mut priority: A2dpDirectionPriority,
) -> fidl::client::QueryResponseFut<
AudioDirectionExtSetPriorityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioDirectionExtProxyInterface::r#set_priority(self, priority)
}
}
impl AudioDirectionExtProxyInterface for AudioDirectionExtProxy {
type SetPriorityResponseFut = fidl::client::QueryResponseFut<
AudioDirectionExtSetPriorityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_priority(&self, mut priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x792713ef3b2bc38a,
>(_buf?)?
.into_result::<AudioDirectionExtMarker>("set_priority")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
AudioDirectionExtSetPriorityRequest,
AudioDirectionExtSetPriorityResult,
>(
(priority,),
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct AudioDirectionExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioDirectionExtEventStream {}
impl futures::stream::FusedStream for AudioDirectionExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioDirectionExtEventStream {
type Item = Result<AudioDirectionExtEvent, 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(AudioDirectionExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioDirectionExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioDirectionExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioDirectionExtEvent, 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(AudioDirectionExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioDirectionExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioDirectionExtRequestStream {}
impl futures::stream::FusedStream for AudioDirectionExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioDirectionExtRequestStream {
type Protocol = AudioDirectionExtMarker;
type ControlHandle = AudioDirectionExtControlHandle;
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 {
AudioDirectionExtControlHandle { 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 AudioDirectionExtRequestStream {
type Item = Result<AudioDirectionExtRequest, 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 AudioDirectionExtRequestStream 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 {
0x792713ef3b2bc38a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioDirectionExtSetPriorityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDirectionExtSetPriorityRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioDirectionExtControlHandle { inner: this.inner.clone() };
Ok(AudioDirectionExtRequest::SetPriority {
priority: req.priority,
responder: AudioDirectionExtSetPriorityResponder {
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(AudioDirectionExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioDirectionExtControlHandle {
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(AudioDirectionExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioDirectionExtControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioDirectionExtRequest {
SetPriority {
priority: A2dpDirectionPriority,
responder: AudioDirectionExtSetPriorityResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioDirectionExtControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioDirectionExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_priority(
self,
) -> Option<(A2dpDirectionPriority, AudioDirectionExtSetPriorityResponder)> {
if let AudioDirectionExtRequest::SetPriority { priority, responder } = self {
Some((priority, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioDirectionExtRequest::SetPriority { .. } => "set_priority",
AudioDirectionExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioDirectionExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioDirectionExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioDirectionExtControlHandle {
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 AudioDirectionExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioDirectionExtSetPriorityResponder {
control_handle: std::mem::ManuallyDrop<AudioDirectionExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioDirectionExtSetPriorityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioDirectionExtSetPriorityResponder {
type ControlHandle = AudioDirectionExtControlHandle;
fn control_handle(&self) -> &AudioDirectionExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioDirectionExtSetPriorityResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioOffloadControllerMarker;
impl fidl::endpoints::ProtocolMarker for AudioOffloadControllerMarker {
type Proxy = AudioOffloadControllerProxy;
type RequestStream = AudioOffloadControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioOffloadControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadController";
}
pub trait AudioOffloadControllerProxyInterface: Send + Sync {
type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#stop(&self) -> Self::StopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioOffloadControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioOffloadControllerSynchronousProxy {
type Proxy = AudioOffloadControllerProxy;
type Protocol = AudioOffloadControllerMarker;
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 AudioOffloadControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioOffloadControllerMarker 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<AudioOffloadControllerEvent, fidl::Error> {
AudioOffloadControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(),
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioOffloadControllerMarker>("stop")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioOffloadControllerProxy {
type Protocol = AudioOffloadControllerMarker;
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 AudioOffloadControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioOffloadControllerEventStream {
AudioOffloadControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#stop(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioOffloadControllerProxyInterface::r#stop(self)
}
}
impl AudioOffloadControllerProxyInterface for AudioOffloadControllerProxy {
type StopResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#stop(&self) -> Self::StopResponseFut {
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,
0x37845d5a47ce5e39,
>(_buf?)?
.into_result::<AudioOffloadControllerMarker>("stop")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct AudioOffloadControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioOffloadControllerEventStream {}
impl futures::stream::FusedStream for AudioOffloadControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioOffloadControllerEventStream {
type Item = Result<AudioOffloadControllerEvent, 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(AudioOffloadControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioOffloadControllerEvent {
OnStarted {},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioOffloadControllerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_started(self) -> Option<()> {
if let AudioOffloadControllerEvent::OnStarted {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioOffloadControllerEvent, 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 {
0x7b624f210570fc30 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioOffloadControllerEvent::OnStarted {}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(AudioOffloadControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioOffloadControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioOffloadControllerRequestStream {}
impl futures::stream::FusedStream for AudioOffloadControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioOffloadControllerRequestStream {
type Protocol = AudioOffloadControllerMarker;
type ControlHandle = AudioOffloadControllerControlHandle;
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 {
AudioOffloadControllerControlHandle { 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 AudioOffloadControllerRequestStream {
type Item = Result<AudioOffloadControllerRequest, 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 AudioOffloadControllerRequestStream 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 {
0x37845d5a47ce5e39 => {
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 = AudioOffloadControllerControlHandle {
inner: this.inner.clone(),
};
Ok(AudioOffloadControllerRequest::Stop {
responder: AudioOffloadControllerStopResponder {
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(AudioOffloadControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadControllerControlHandle { 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(AudioOffloadControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadControllerControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioOffloadControllerRequest {
Stop { responder: AudioOffloadControllerStopResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioOffloadControllerControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioOffloadControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(AudioOffloadControllerStopResponder)> {
if let AudioOffloadControllerRequest::Stop { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioOffloadControllerRequest::Stop { .. } => "stop",
AudioOffloadControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioOffloadControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioOffloadControllerControlHandle {
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 AudioOffloadControllerControlHandle {
pub fn send_on_started(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x7b624f210570fc30,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioOffloadControllerStopResponder {
control_handle: std::mem::ManuallyDrop<AudioOffloadControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioOffloadControllerStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioOffloadControllerStopResponder {
type ControlHandle = AudioOffloadControllerControlHandle;
fn control_handle(&self) -> &AudioOffloadControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioOffloadControllerStopResponder {
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,
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioOffloadExtMarker;
impl fidl::endpoints::ProtocolMarker for AudioOffloadExtMarker {
type Proxy = AudioOffloadExtProxy;
type RequestStream = AudioOffloadExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioOffloadExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadExt";
}
pub trait AudioOffloadExtProxyInterface: Send + Sync {
type GetSupportedFeaturesResponseFut: std::future::Future<
Output = Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error>,
> + Send;
fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut;
fn r#start_audio_offload(
&self,
configuration: &AudioOffloadConfiguration,
controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioOffloadExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioOffloadExtSynchronousProxy {
type Proxy = AudioOffloadExtProxy;
type Protocol = AudioOffloadExtMarker;
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 AudioOffloadExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioOffloadExtMarker 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<AudioOffloadExtEvent, fidl::Error> {
AudioOffloadExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_supported_features(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
>(
(),
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioOffloadExtMarker>("get_supported_features")?;
Ok(_response)
}
pub fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
(configuration, controller),
0x2172ac626202c1c9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioOffloadExtProxy {
type Protocol = AudioOffloadExtMarker;
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 AudioOffloadExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioOffloadExtEventStream {
AudioOffloadExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_supported_features(
&self,
) -> fidl::client::QueryResponseFut<
AudioOffloadExtGetSupportedFeaturesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioOffloadExtProxyInterface::r#get_supported_features(self)
}
pub fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
AudioOffloadExtProxyInterface::r#start_audio_offload(self, configuration, controller)
}
}
impl AudioOffloadExtProxyInterface for AudioOffloadExtProxy {
type GetSupportedFeaturesResponseFut = fidl::client::QueryResponseFut<
AudioOffloadExtGetSupportedFeaturesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x44ab0b88dde41f94,
>(_buf?)?
.into_result::<AudioOffloadExtMarker>("get_supported_features")?;
Ok(_response)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AudioOffloadExtGetSupportedFeaturesResponse,
>(
(),
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
(configuration, controller),
0x2172ac626202c1c9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct AudioOffloadExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioOffloadExtEventStream {}
impl futures::stream::FusedStream for AudioOffloadExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioOffloadExtEventStream {
type Item = Result<AudioOffloadExtEvent, 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(AudioOffloadExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioOffloadExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioOffloadExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioOffloadExtEvent, 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(AudioOffloadExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioOffloadExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioOffloadExtRequestStream {}
impl futures::stream::FusedStream for AudioOffloadExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioOffloadExtRequestStream {
type Protocol = AudioOffloadExtMarker;
type ControlHandle = AudioOffloadExtControlHandle;
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 {
AudioOffloadExtControlHandle { 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 AudioOffloadExtRequestStream {
type Item = Result<AudioOffloadExtRequest, 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 AudioOffloadExtRequestStream 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 {
0x44ab0b88dde41f94 => {
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 =
AudioOffloadExtControlHandle { inner: this.inner.clone() };
Ok(AudioOffloadExtRequest::GetSupportedFeatures {
responder: AudioOffloadExtGetSupportedFeaturesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2172ac626202c1c9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioOffloadExtStartAudioOffloadRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioOffloadExtControlHandle { inner: this.inner.clone() };
Ok(AudioOffloadExtRequest::StartAudioOffload {
configuration: req.configuration,
controller: req.controller,
control_handle,
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(AudioOffloadExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadExtControlHandle {
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(AudioOffloadExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadExtControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioOffloadExtRequest {
GetSupportedFeatures { responder: AudioOffloadExtGetSupportedFeaturesResponder },
StartAudioOffload {
configuration: AudioOffloadConfiguration,
controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
control_handle: AudioOffloadExtControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioOffloadExtControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioOffloadExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_supported_features(
self,
) -> Option<(AudioOffloadExtGetSupportedFeaturesResponder)> {
if let AudioOffloadExtRequest::GetSupportedFeatures { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_audio_offload(
self,
) -> Option<(
AudioOffloadConfiguration,
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
AudioOffloadExtControlHandle,
)> {
if let AudioOffloadExtRequest::StartAudioOffload {
configuration,
controller,
control_handle,
} = self
{
Some((configuration, controller, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioOffloadExtRequest::GetSupportedFeatures { .. } => "get_supported_features",
AudioOffloadExtRequest::StartAudioOffload { .. } => "start_audio_offload",
AudioOffloadExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioOffloadExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioOffloadExtControlHandle {
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 AudioOffloadExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioOffloadExtGetSupportedFeaturesResponder {
control_handle: std::mem::ManuallyDrop<AudioOffloadExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioOffloadExtGetSupportedFeaturesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioOffloadExtGetSupportedFeaturesResponder {
type ControlHandle = AudioOffloadExtControlHandle;
fn control_handle(&self) -> &AudioOffloadExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioOffloadExtGetSupportedFeaturesResponder {
pub fn send(
self,
mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> 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: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
AudioOffloadExtGetSupportedFeaturesResponse,
>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConnectionReceiverMarker;
impl fidl::endpoints::ProtocolMarker for ConnectionReceiverMarker {
type Proxy = ConnectionReceiverProxy;
type RequestStream = ConnectionReceiverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConnectionReceiverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ConnectionReceiver";
}
pub trait ConnectionReceiverProxyInterface: Send + Sync {
fn r#connected(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
channel: Channel,
protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConnectionReceiverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConnectionReceiverSynchronousProxy {
type Proxy = ConnectionReceiverProxy;
type Protocol = ConnectionReceiverMarker;
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 ConnectionReceiverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ConnectionReceiverMarker 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<ConnectionReceiverEvent, fidl::Error> {
ConnectionReceiverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
self.client.send::<ConnectionReceiverConnectedRequest>(
(peer_id, &mut channel, protocol),
0xa5251eebbccf928,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ConnectionReceiverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ConnectionReceiverProxy {
type Protocol = ConnectionReceiverMarker;
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 ConnectionReceiverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConnectionReceiverEventStream {
ConnectionReceiverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
ConnectionReceiverProxyInterface::r#connected(self, peer_id, channel, protocol)
}
}
impl ConnectionReceiverProxyInterface for ConnectionReceiverProxy {
fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
self.client.send::<ConnectionReceiverConnectedRequest>(
(peer_id, &mut channel, protocol),
0xa5251eebbccf928,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ConnectionReceiverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ConnectionReceiverEventStream {}
impl futures::stream::FusedStream for ConnectionReceiverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConnectionReceiverEventStream {
type Item = Result<ConnectionReceiverEvent, 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(ConnectionReceiverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConnectionReceiverEvent {
OnRevoke {},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ConnectionReceiverEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_revoke(self) -> Option<()> {
if let ConnectionReceiverEvent::OnRevoke {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ConnectionReceiverEvent, 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 {
0x9b35c093a0468d1 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ConnectionReceiverEvent::OnRevoke {}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ConnectionReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConnectionReceiverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ConnectionReceiverRequestStream {}
impl futures::stream::FusedStream for ConnectionReceiverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConnectionReceiverRequestStream {
type Protocol = ConnectionReceiverMarker;
type ControlHandle = ConnectionReceiverControlHandle;
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 {
ConnectionReceiverControlHandle { 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 ConnectionReceiverRequestStream {
type Item = Result<ConnectionReceiverRequest, 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 ConnectionReceiverRequestStream 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 {
0xa5251eebbccf928 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionReceiverConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ConnectionReceiverControlHandle {
inner: this.inner.clone(),
};
Ok(ConnectionReceiverRequest::Connected {peer_id: req.peer_id,
channel: req.channel,
protocol: req.protocol,
control_handle,
})
}
_ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ConnectionReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ConnectionReceiverControlHandle { 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(ConnectionReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ConnectionReceiverControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ConnectionReceiverRequest {
Connected {
peer_id: fidl_fuchsia_bluetooth::PeerId,
channel: Channel,
protocol: Vec<ProtocolDescriptor>,
control_handle: ConnectionReceiverControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ConnectionReceiverControlHandle,
method_type: fidl::MethodType,
},
}
impl ConnectionReceiverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connected(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Channel,
Vec<ProtocolDescriptor>,
ConnectionReceiverControlHandle,
)> {
if let ConnectionReceiverRequest::Connected { peer_id, channel, protocol, control_handle } =
self
{
Some((peer_id, channel, protocol, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConnectionReceiverRequest::Connected { .. } => "connected",
ConnectionReceiverRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
ConnectionReceiverRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ConnectionReceiverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ConnectionReceiverControlHandle {
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 ConnectionReceiverControlHandle {
pub fn send_on_revoke(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x9b35c093a0468d1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct L2capParametersExtMarker;
impl fidl::endpoints::ProtocolMarker for L2capParametersExtMarker {
type Proxy = L2capParametersExtProxy;
type RequestStream = L2capParametersExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = L2capParametersExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) L2capParametersExt";
}
pub trait L2capParametersExtProxyInterface: Send + Sync {
type RequestParametersResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error>>
+ Send;
fn r#request_parameters(
&self,
request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Self::RequestParametersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct L2capParametersExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for L2capParametersExtSynchronousProxy {
type Proxy = L2capParametersExtProxy;
type Protocol = L2capParametersExtMarker;
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 L2capParametersExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<L2capParametersExtMarker 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<L2capParametersExtEvent, fidl::Error> {
L2capParametersExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
let _response = self.client.send_query::<
L2capParametersExtRequestParametersRequest,
fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
>(
(request,),
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<L2capParametersExtMarker>("request_parameters")?;
Ok(_response.new)
}
}
#[derive(Debug, Clone)]
pub struct L2capParametersExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for L2capParametersExtProxy {
type Protocol = L2capParametersExtMarker;
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 L2capParametersExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> L2capParametersExtEventStream {
L2capParametersExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
L2capParametersExtProxyInterface::r#request_parameters(self, request)
}
}
impl L2capParametersExtProxyInterface for L2capParametersExtProxy {
type RequestParametersResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Self::RequestParametersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1da4d8f268e2e918,
>(_buf?)?
.into_result::<L2capParametersExtMarker>("request_parameters")?;
Ok(_response.new)
}
self.client.send_query_and_decode::<
L2capParametersExtRequestParametersRequest,
fidl_fuchsia_bluetooth::ChannelParameters,
>(
(request,),
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct L2capParametersExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for L2capParametersExtEventStream {}
impl futures::stream::FusedStream for L2capParametersExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for L2capParametersExtEventStream {
type Item = Result<L2capParametersExtEvent, 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(L2capParametersExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum L2capParametersExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl L2capParametersExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<L2capParametersExtEvent, 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(L2capParametersExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct L2capParametersExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for L2capParametersExtRequestStream {}
impl futures::stream::FusedStream for L2capParametersExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for L2capParametersExtRequestStream {
type Protocol = L2capParametersExtMarker;
type ControlHandle = L2capParametersExtControlHandle;
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 {
L2capParametersExtControlHandle { 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 L2capParametersExtRequestStream {
type Item = Result<L2capParametersExtRequest, 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 L2capParametersExtRequestStream 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 {
0x1da4d8f268e2e918 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(L2capParametersExtRequestParametersRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<L2capParametersExtRequestParametersRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = L2capParametersExtControlHandle {
inner: this.inner.clone(),
};
Ok(L2capParametersExtRequest::RequestParameters {request: req.request,
responder: L2capParametersExtRequestParametersResponder {
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(L2capParametersExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: L2capParametersExtControlHandle { 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(L2capParametersExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: L2capParametersExtControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum L2capParametersExtRequest {
RequestParameters {
request: fidl_fuchsia_bluetooth::ChannelParameters,
responder: L2capParametersExtRequestParametersResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: L2capParametersExtControlHandle,
method_type: fidl::MethodType,
},
}
impl L2capParametersExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_request_parameters(
self,
) -> Option<(
fidl_fuchsia_bluetooth::ChannelParameters,
L2capParametersExtRequestParametersResponder,
)> {
if let L2capParametersExtRequest::RequestParameters { request, responder } = self {
Some((request, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
L2capParametersExtRequest::RequestParameters { .. } => "request_parameters",
L2capParametersExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
L2capParametersExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct L2capParametersExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for L2capParametersExtControlHandle {
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 L2capParametersExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct L2capParametersExtRequestParametersResponder {
control_handle: std::mem::ManuallyDrop<L2capParametersExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for L2capParametersExtRequestParametersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for L2capParametersExtRequestParametersResponder {
type ControlHandle = L2capParametersExtControlHandle;
fn control_handle(&self) -> &L2capParametersExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl L2capParametersExtRequestParametersResponder {
pub fn send(
self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(new);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(new);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
L2capParametersExtRequestParametersResponse,
>>(
fidl::encoding::Flexible::new((new,)),
self.tx_id,
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProfileMarker;
impl fidl::endpoints::ProtocolMarker for ProfileMarker {
type Proxy = ProfileProxy;
type RequestStream = ProfileRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.bredr.Profile";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileMarker {}
pub type ProfileAdvertiseResult =
Result<ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>;
pub type ProfileConnectResult = Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>;
pub trait ProfileProxyInterface: Send + Sync {
type AdvertiseResponseFut: std::future::Future<Output = Result<ProfileAdvertiseResult, fidl::Error>>
+ Send;
fn r#advertise(&self, payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut;
fn r#search(&self, payload: ProfileSearchRequest) -> Result<(), fidl::Error>;
type ConnectResponseFut: std::future::Future<Output = Result<ProfileConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
connection: &ConnectParameters,
) -> Self::ConnectResponseFut;
fn r#connect_sco(&self, payload: ProfileConnectScoRequest) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileSynchronousProxy {
type Proxy = ProfileProxy;
type Protocol = ProfileMarker;
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 ProfileSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileMarker 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<ProfileEvent, fidl::Error> {
ProfileEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#advertise(
&self,
mut payload: ProfileAdvertiseRequest,
___deadline: zx::MonotonicInstant,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = self
.client
.send_query::<ProfileAdvertiseRequest, fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
&mut payload,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ProfileMarker>("advertise")?;
Ok(_response.map(|x| x))
}
pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileSearchRequest>(
&mut payload,
0x2c59d8580bc8ef0a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
___deadline: zx::MonotonicInstant,
) -> Result<ProfileConnectResult, fidl::Error> {
let _response = self
.client
.send_query::<ProfileConnectRequest, fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
(peer_id, connection),
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ProfileMarker>("connect")?;
Ok(_response.map(|x| x.channel))
}
pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileConnectScoRequest>(
&mut payload,
0x961976ddd116ee6,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ProfileProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProfileProxy {
type Protocol = ProfileMarker;
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 ProfileProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileEventStream {
ProfileEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#advertise(
&self,
mut payload: ProfileAdvertiseRequest,
) -> fidl::client::QueryResponseFut<
ProfileAdvertiseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProxyInterface::r#advertise(self, payload)
}
pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
ProfileProxyInterface::r#search(self, payload)
}
pub fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
) -> fidl::client::QueryResponseFut<
ProfileConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProxyInterface::r#connect(self, peer_id, connection)
}
pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
ProfileProxyInterface::r#connect_sco(self, payload)
}
}
impl ProfileProxyInterface for ProfileProxy {
type AdvertiseResponseFut = fidl::client::QueryResponseFut<
ProfileAdvertiseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#advertise(&self, mut payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x65e429c1f0205a0e,
>(_buf?)?
.into_result::<ProfileMarker>("advertise")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ProfileAdvertiseRequest, ProfileAdvertiseResult>(
&mut payload,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileSearchRequest>(
&mut payload,
0x2c59d8580bc8ef0a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
ProfileConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProfileConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xaaeefc898901fb3,
>(_buf?)?
.into_result::<ProfileMarker>("connect")?;
Ok(_response.map(|x| x.channel))
}
self.client.send_query_and_decode::<ProfileConnectRequest, ProfileConnectResult>(
(peer_id, connection),
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileConnectScoRequest>(
&mut payload,
0x961976ddd116ee6,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ProfileEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProfileEventStream {}
impl futures::stream::FusedStream for ProfileEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileEventStream {
type Item = Result<ProfileEvent, 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(ProfileEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ProfileEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProfileEvent, 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(ProfileEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileRequestStream {}
impl futures::stream::FusedStream for ProfileRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileRequestStream {
type Protocol = ProfileMarker;
type ControlHandle = ProfileControlHandle;
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 {
ProfileControlHandle { 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 ProfileRequestStream {
type Item = Result<ProfileRequest, 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 ProfileRequestStream 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 {
0x65e429c1f0205a0e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileAdvertiseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Advertise {
payload: req,
responder: ProfileAdvertiseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2c59d8580bc8ef0a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProfileSearchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileSearchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Search { payload: req, control_handle })
}
0xaaeefc898901fb3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Connect {
peer_id: req.peer_id,
connection: req.connection,
responder: ProfileConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x961976ddd116ee6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProfileConnectScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectScoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::ConnectSco { payload: req, control_handle })
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ProfileRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ProfileControlHandle { 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(ProfileRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ProfileControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProfileRequest {
Advertise { payload: ProfileAdvertiseRequest, responder: ProfileAdvertiseResponder },
Search { payload: ProfileSearchRequest, control_handle: ProfileControlHandle },
Connect {
peer_id: fidl_fuchsia_bluetooth::PeerId,
connection: ConnectParameters,
responder: ProfileConnectResponder,
},
ConnectSco { payload: ProfileConnectScoRequest, control_handle: ProfileControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ProfileControlHandle,
method_type: fidl::MethodType,
},
}
impl ProfileRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_advertise(self) -> Option<(ProfileAdvertiseRequest, ProfileAdvertiseResponder)> {
if let ProfileRequest::Advertise { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_search(self) -> Option<(ProfileSearchRequest, ProfileControlHandle)> {
if let ProfileRequest::Search { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, ConnectParameters, ProfileConnectResponder)> {
if let ProfileRequest::Connect { peer_id, connection, responder } = self {
Some((peer_id, connection, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_sco(self) -> Option<(ProfileConnectScoRequest, ProfileControlHandle)> {
if let ProfileRequest::ConnectSco { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileRequest::Advertise { .. } => "advertise",
ProfileRequest::Search { .. } => "search",
ProfileRequest::Connect { .. } => "connect",
ProfileRequest::ConnectSco { .. } => "connect_sco",
ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProfileControlHandle {
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 ProfileControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileAdvertiseResponder {
control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileAdvertiseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileAdvertiseResponder {
type ControlHandle = ProfileControlHandle;
fn control_handle(&self) -> &ProfileControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileAdvertiseResponder {
pub fn send(
self,
mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileConnectResponder {
control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileConnectResponder {
type ControlHandle = ProfileControlHandle;
fn control_handle(&self) -> &ProfileControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileConnectResponder {
pub fn send(
self,
mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(
result.as_mut().map_err(|e| *e).map(|channel| (channel,)),
),
self.tx_id,
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ScoConnectionMarker;
impl fidl::endpoints::ProtocolMarker for ScoConnectionMarker {
type Proxy = ScoConnectionProxy;
type RequestStream = ScoConnectionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ScoConnectionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ScoConnection";
}
pub trait ScoConnectionProxyInterface: Send + Sync {
type ReadResponseFut: std::future::Future<Output = Result<ScoConnectionReadResponse, fidl::Error>>
+ Send;
fn r#read(&self) -> Self::ReadResponseFut;
type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#write(&self, payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ScoConnectionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ScoConnectionSynchronousProxy {
type Proxy = ScoConnectionProxy;
type Protocol = ScoConnectionMarker;
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 ScoConnectionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ScoConnectionMarker 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<ScoConnectionEvent, fidl::Error> {
ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#read(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ScoConnectionReadResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ScoConnectionMarker>("read")?;
Ok(_response)
}
pub fn r#write(
&self,
mut payload: &ScoConnectionWriteRequest,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ScoConnectionWriteRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
payload,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ScoConnectionMarker>("write")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ScoConnectionProxy {
type Protocol = ScoConnectionMarker;
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 ScoConnectionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ScoConnectionEventStream {
ScoConnectionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#read(
&self,
) -> fidl::client::QueryResponseFut<
ScoConnectionReadResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ScoConnectionProxyInterface::r#read(self)
}
pub fn r#write(
&self,
mut payload: &ScoConnectionWriteRequest,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ScoConnectionProxyInterface::r#write(self, payload)
}
}
impl ScoConnectionProxyInterface for ScoConnectionProxy {
type ReadResponseFut = fidl::client::QueryResponseFut<
ScoConnectionReadResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read(&self) -> Self::ReadResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ScoConnectionReadResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6fb29eb1e16ac616,
>(_buf?)?
.into_result::<ScoConnectionMarker>("read")?;
Ok(_response)
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, ScoConnectionReadResponse>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#write(&self, mut payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut {
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,
0x394e1b2ff7f4a5a9,
>(_buf?)?
.into_result::<ScoConnectionMarker>("write")?;
Ok(_response)
}
self.client.send_query_and_decode::<ScoConnectionWriteRequest, ()>(
payload,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ScoConnectionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ScoConnectionEventStream {}
impl futures::stream::FusedStream for ScoConnectionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ScoConnectionEventStream {
type Item = Result<ScoConnectionEvent, 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(ScoConnectionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ScoConnectionEvent {
OnConnectionComplete {
payload: ScoConnectionOnConnectionCompleteRequest,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ScoConnectionEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_connection_complete(self) -> Option<ScoConnectionOnConnectionCompleteRequest> {
if let ScoConnectionEvent::OnConnectionComplete { payload } = self {
Some((payload))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ScoConnectionEvent, 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 {
0x193aa06408ba384d => {
let mut out = fidl::new_empty!(
ScoConnectionOnConnectionCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionOnConnectionCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ScoConnectionEvent::OnConnectionComplete { payload: out }))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ScoConnectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ScoConnectionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ScoConnectionRequestStream {}
impl futures::stream::FusedStream for ScoConnectionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ScoConnectionRequestStream {
type Protocol = ScoConnectionMarker;
type ControlHandle = ScoConnectionControlHandle;
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 {
ScoConnectionControlHandle { 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 ScoConnectionRequestStream {
type Item = Result<ScoConnectionRequest, 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 ScoConnectionRequestStream 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 {
0x6fb29eb1e16ac616 => {
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 =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Read {
responder: ScoConnectionReadResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x394e1b2ff7f4a5a9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ScoConnectionWriteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionWriteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Write {
payload: req,
responder: ScoConnectionWriteResponder {
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(ScoConnectionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ScoConnectionControlHandle {
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(ScoConnectionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ScoConnectionControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ScoConnectionRequest {
Read { responder: ScoConnectionReadResponder },
Write { payload: ScoConnectionWriteRequest, responder: ScoConnectionWriteResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ScoConnectionControlHandle,
method_type: fidl::MethodType,
},
}
impl ScoConnectionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_read(self) -> Option<(ScoConnectionReadResponder)> {
if let ScoConnectionRequest::Read { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write(self) -> Option<(ScoConnectionWriteRequest, ScoConnectionWriteResponder)> {
if let ScoConnectionRequest::Write { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ScoConnectionRequest::Read { .. } => "read",
ScoConnectionRequest::Write { .. } => "write",
ScoConnectionRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
ScoConnectionRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ScoConnectionControlHandle {
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 ScoConnectionControlHandle {
pub fn send_on_connection_complete(
&self,
mut payload: &ScoConnectionOnConnectionCompleteRequest,
) -> Result<(), fidl::Error> {
self.inner.send::<ScoConnectionOnConnectionCompleteRequest>(
payload,
0,
0x193aa06408ba384d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ScoConnectionReadResponder {
control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ScoConnectionReadResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ScoConnectionReadResponder {
type ControlHandle = ScoConnectionControlHandle;
fn control_handle(&self) -> &ScoConnectionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ScoConnectionReadResponder {
pub fn send(self, mut payload: &ScoConnectionReadResponse) -> 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: &ScoConnectionReadResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<ScoConnectionReadResponse>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ScoConnectionWriteResponder {
control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ScoConnectionWriteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ScoConnectionWriteResponder {
type ControlHandle = ScoConnectionControlHandle;
fn control_handle(&self) -> &ScoConnectionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ScoConnectionWriteResponder {
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,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SearchResultsMarker;
impl fidl::endpoints::ProtocolMarker for SearchResultsMarker {
type Proxy = SearchResultsProxy;
type RequestStream = SearchResultsRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SearchResultsSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SearchResults";
}
pub trait SearchResultsProxyInterface: Send + Sync {
type ServiceFoundResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#service_found(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
protocol: Option<&[ProtocolDescriptor]>,
attributes: &[Attribute],
) -> Self::ServiceFoundResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SearchResultsSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SearchResultsSynchronousProxy {
type Proxy = SearchResultsProxy;
type Protocol = SearchResultsMarker;
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 SearchResultsSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SearchResultsMarker 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<SearchResultsEvent, fidl::Error> {
SearchResultsEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
SearchResultsServiceFoundRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(peer_id, protocol, attributes,),
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SearchResultsMarker>("service_found")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct SearchResultsProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SearchResultsProxy {
type Protocol = SearchResultsMarker;
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 SearchResultsProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SearchResultsEventStream {
SearchResultsEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SearchResultsProxyInterface::r#service_found(self, peer_id, protocol, attributes)
}
}
impl SearchResultsProxyInterface for SearchResultsProxy {
type ServiceFoundResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
) -> Self::ServiceFoundResponseFut {
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,
0x526509a842ebd43c,
>(_buf?)?
.into_result::<SearchResultsMarker>("service_found")?;
Ok(_response)
}
self.client.send_query_and_decode::<SearchResultsServiceFoundRequest, ()>(
(peer_id, protocol, attributes),
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct SearchResultsEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SearchResultsEventStream {}
impl futures::stream::FusedStream for SearchResultsEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SearchResultsEventStream {
type Item = Result<SearchResultsEvent, 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(SearchResultsEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SearchResultsEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SearchResultsEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SearchResultsEvent, 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(SearchResultsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SearchResultsRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SearchResultsRequestStream {}
impl futures::stream::FusedStream for SearchResultsRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SearchResultsRequestStream {
type Protocol = SearchResultsMarker;
type ControlHandle = SearchResultsControlHandle;
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 {
SearchResultsControlHandle { 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 SearchResultsRequestStream {
type Item = Result<SearchResultsRequest, 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 SearchResultsRequestStream 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 {
0x526509a842ebd43c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SearchResultsServiceFoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SearchResultsServiceFoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SearchResultsControlHandle { inner: this.inner.clone() };
Ok(SearchResultsRequest::ServiceFound {
peer_id: req.peer_id,
protocol: req.protocol,
attributes: req.attributes,
responder: SearchResultsServiceFoundResponder {
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(SearchResultsRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SearchResultsControlHandle {
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(SearchResultsRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SearchResultsControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SearchResultsRequest {
ServiceFound {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Option<Vec<ProtocolDescriptor>>,
attributes: Vec<Attribute>,
responder: SearchResultsServiceFoundResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SearchResultsControlHandle,
method_type: fidl::MethodType,
},
}
impl SearchResultsRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_service_found(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Option<Vec<ProtocolDescriptor>>,
Vec<Attribute>,
SearchResultsServiceFoundResponder,
)> {
if let SearchResultsRequest::ServiceFound { peer_id, protocol, attributes, responder } =
self
{
Some((peer_id, protocol, attributes, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SearchResultsRequest::ServiceFound { .. } => "service_found",
SearchResultsRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
SearchResultsRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct SearchResultsControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SearchResultsControlHandle {
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 SearchResultsControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SearchResultsServiceFoundResponder {
control_handle: std::mem::ManuallyDrop<SearchResultsControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SearchResultsServiceFoundResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SearchResultsServiceFoundResponder {
type ControlHandle = SearchResultsControlHandle;
fn control_handle(&self) -> &SearchResultsControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SearchResultsServiceFoundResponder {
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,
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for A2dpDirectionPriority {
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 A2dpDirectionPriority {
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 A2dpDirectionPriority
{
#[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 A2dpDirectionPriority {
#[inline(always)]
fn new_empty() -> Self {
Self::Normal
}
#[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 AudioBitsPerSample {
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 AudioBitsPerSample {
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 AudioBitsPerSample
{
#[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 AudioBitsPerSample {
#[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 AudioChannelMode {
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 AudioChannelMode {
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 AudioChannelMode
{
#[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 AudioChannelMode {
#[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 AudioSamplingFrequency {
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 AudioSamplingFrequency {
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 AudioSamplingFrequency
{
#[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 AudioSamplingFrequency
{
#[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 DataPath {
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 DataPath {
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 DataPath {
#[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 DataPath {
#[inline(always)]
fn new_empty() -> Self {
Self::Host
}
#[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 HfpParameterSet {
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 HfpParameterSet {
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 HfpParameterSet
{
#[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 HfpParameterSet {
#[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 ProtocolIdentifier {
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 ProtocolIdentifier {
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 ProtocolIdentifier
{
#[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 ProtocolIdentifier {
#[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 RxPacketStatus {
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 RxPacketStatus {
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 RxPacketStatus {
#[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 RxPacketStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::CorrectlyReceivedData
}
#[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 ScoErrorCode {
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 ScoErrorCode {
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 ScoErrorCode {
#[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 ScoErrorCode {
#[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 ServiceClassProfileIdentifier {
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 ServiceClassProfileIdentifier {
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 ServiceClassProfileIdentifier
{
#[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 ServiceClassProfileIdentifier
{
#[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(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDirectionExtSetPriorityRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDirectionExtSetPriorityRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioDirectionExtSetPriorityRequest, D>
for &AudioDirectionExtSetPriorityRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDirectionExtSetPriorityRequest>(offset);
fidl::encoding::Encode::<AudioDirectionExtSetPriorityRequest, D>::encode(
(<A2dpDirectionPriority as fidl::encoding::ValueTypeMarker>::borrow(
&self.priority,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<A2dpDirectionPriority, D>,
> fidl::encoding::Encode<AudioDirectionExtSetPriorityRequest, 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::<AudioDirectionExtSetPriorityRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDirectionExtSetPriorityRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { priority: fidl::new_empty!(A2dpDirectionPriority, 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!(
A2dpDirectionPriority,
D,
&mut self.priority,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioOffloadExtStartAudioOffloadRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioOffloadExtStartAudioOffloadRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioOffloadExtStartAudioOffloadRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
fidl::encoding::Encode::<
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<AudioOffloadConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
&self.configuration,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.controller
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioOffloadExtStartAudioOffloadRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
configuration: fidl::new_empty!(
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect
),
controller: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.configuration,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectionReceiverConnectedRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectionReceiverConnectedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
ConnectionReceiverConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ConnectionReceiverConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
fidl::encoding::Encode::<ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
<fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Vector<ProtocolDescriptor, 255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ConnectionReceiverConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ConnectionReceiverConnectedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
Channel,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.protocol, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for L2capParametersExtRequestParametersRequest {
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<L2capParametersExtRequestParametersRequest, D>
for &L2capParametersExtRequestParametersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersRequest>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::ChannelParameters, D>,
> fidl::encoding::Encode<L2capParametersExtRequestParametersRequest, 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::<L2capParametersExtRequestParametersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for L2capParametersExtRequestParametersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { request: fidl::new_empty!(fidl_fuchsia_bluetooth::ChannelParameters, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::ChannelParameters,
D,
&mut self.request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for L2capParametersExtRequestParametersResponse {
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<L2capParametersExtRequestParametersResponse, D>
for &L2capParametersExtRequestParametersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersResponse>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersResponse, D>::encode(
(
<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.new),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::ChannelParameters, D>,
> fidl::encoding::Encode<L2capParametersExtRequestParametersResponse, 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::<L2capParametersExtRequestParametersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for L2capParametersExtRequestParametersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { new: fidl::new_empty!(fidl_fuchsia_bluetooth::ChannelParameters, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::ChannelParameters,
D,
&mut self.new,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileConnectRequest {
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<ProfileConnectRequest, D>
for &ProfileConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectRequest>(offset);
fidl::encoding::Encode::<ProfileConnectRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.peer_id,
),
<ConnectParameters as fidl::encoding::ValueTypeMarker>::borrow(
&self.connection,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<ConnectParameters, D>,
> fidl::encoding::Encode<ProfileConnectRequest, 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::<ProfileConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProfileConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
connection: fidl::new_empty!(ConnectParameters, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ConnectParameters, D, &mut self.connection, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileConnectResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileConnectResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
ProfileConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileConnectResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
fidl::encoding::Encode::<
ProfileConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<
ProfileConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileConnectResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Channel,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SearchResultsServiceFoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SearchResultsServiceFoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SearchResultsServiceFoundRequest, D>
for &SearchResultsServiceFoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SearchResultsServiceFoundRequest>(offset);
fidl::encoding::Encode::<SearchResultsServiceFoundRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
<fidl::encoding::Vector<Attribute, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.attributes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D,
>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<Attribute, 512>, D>,
> fidl::encoding::Encode<SearchResultsServiceFoundRequest, 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::<SearchResultsServiceFoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SearchResultsServiceFoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
protocol: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D
),
attributes: fidl::new_empty!(fidl::encoding::Vector<Attribute, 512>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D,
&mut self.protocol,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<Attribute, 512>, D, &mut self.attributes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl Attribute {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.element {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Attribute {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Attribute {
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<Attribute, D>
for &Attribute
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Attribute>(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.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::<DataElement, D>(
self.element.as_ref().map(<DataElement 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 Attribute {
#[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.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 =
<DataElement 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.element.get_or_insert_with(|| fidl::new_empty!(DataElement, D));
fidl::decode!(DataElement, 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 AudioAacSupport {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioAacSupport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioAacSupport {
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<AudioAacSupport, D>
for &AudioAacSupport
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioAacSupport>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioAacSupport {
#[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;
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 AudioOffloadConfiguration {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.encoder_settings {
return 8;
}
if let Some(_) = self.encoded_bit_rate {
return 7;
}
if let Some(_) = self.channel_mode {
return 6;
}
if let Some(_) = self.bits_per_sample {
return 5;
}
if let Some(_) = self.sampling_frequency {
return 4;
}
if let Some(_) = self.scms_t_enable {
return 3;
}
if let Some(_) = self.max_latency {
return 2;
}
if let Some(_) = self.codec {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioOffloadConfiguration {
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<AudioOffloadConfiguration, D> for &AudioOffloadConfiguration
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadConfiguration>(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::<AudioOffloadFeatures, D>(
self.codec
.as_ref()
.map(<AudioOffloadFeatures 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_latency.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::<bool, D>(
self.scms_t_enable.as_ref().map(<bool 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::<AudioSamplingFrequency, D>(
self.sampling_frequency
.as_ref()
.map(<AudioSamplingFrequency as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AudioBitsPerSample, D>(
self.bits_per_sample
.as_ref()
.map(<AudioBitsPerSample as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AudioChannelMode, D>(
self.channel_mode
.as_ref()
.map(<AudioChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.encoded_bit_rate
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AudioEncoderSettings, D>(
self.encoder_settings
.as_ref()
.map(<AudioEncoderSettings 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 AudioOffloadConfiguration
{
#[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 =
<AudioOffloadFeatures 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.get_or_insert_with(|| fidl::new_empty!(AudioOffloadFeatures, D));
fidl::decode!(
AudioOffloadFeatures,
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_latency.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 =
<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.scms_t_enable.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 < 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 =
<AudioSamplingFrequency 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
.sampling_frequency
.get_or_insert_with(|| fidl::new_empty!(AudioSamplingFrequency, D));
fidl::decode!(
AudioSamplingFrequency,
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 < 5 {
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 =
<AudioBitsPerSample 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
.bits_per_sample
.get_or_insert_with(|| fidl::new_empty!(AudioBitsPerSample, D));
fidl::decode!(AudioBitsPerSample, 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 < 6 {
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 =
<AudioChannelMode 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!(AudioChannelMode, D));
fidl::decode!(AudioChannelMode, 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 < 7 {
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 =
<u32 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.encoded_bit_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 < 8 {
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 =
<AudioEncoderSettings 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
.encoder_settings
.get_or_insert_with(|| fidl::new_empty!(AudioEncoderSettings, D));
fidl::decode!(
AudioEncoderSettings,
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 AudioOffloadExtGetSupportedFeaturesResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.audio_offload_features {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadExtGetSupportedFeaturesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioOffloadExtGetSupportedFeaturesResponse {
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<AudioOffloadExtGetSupportedFeaturesResponse, D>
for &AudioOffloadExtGetSupportedFeaturesResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadExtGetSupportedFeaturesResponse>(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::<fidl::encoding::UnboundedVector<AudioOffloadFeatures>, D>(
self.audio_offload_features.as_ref().map(<fidl::encoding::UnboundedVector<AudioOffloadFeatures> 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 AudioOffloadExtGetSupportedFeaturesResponse
{
#[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 = <fidl::encoding::UnboundedVector<AudioOffloadFeatures> 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.audio_offload_features.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<AudioOffloadFeatures>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<AudioOffloadFeatures>,
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 AudioSbcSupport {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioSbcSupport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioSbcSupport {
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<AudioSbcSupport, D>
for &AudioSbcSupport
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioSbcSupport>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSbcSupport {
#[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;
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 Channel {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.connection {
return 8;
}
if let Some(_) = self.ext_audio_offload {
return 7;
}
if let Some(_) = self.ext_l2cap {
return 6;
}
if let Some(_) = self.flush_timeout {
return 5;
}
if let Some(_) = self.ext_direction {
return 4;
}
if let Some(_) = self.max_tx_sdu_size {
return 3;
}
if let Some(_) = self.channel_mode {
return 2;
}
if let Some(_) = self.socket {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for Channel {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Channel {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut Channel
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Channel>(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::<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.socket.as_mut().map(
<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_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_fuchsia_bluetooth::ChannelMode, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.channel_mode.as_ref().map(<fidl_fuchsia_bluetooth::ChannelMode 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::<
u16,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.max_tx_sdu_size.as_ref().map(<u16 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::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.ext_direction.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
i64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.ext_l2cap.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.ext_audio_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.connection.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 = <fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> 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.socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, 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_fuchsia_bluetooth::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!(
fidl_fuchsia_bluetooth::ChannelMode,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_bluetooth::ChannelMode,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 =
<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_tx_sdu_size.get_or_insert_with(|| {
fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u16,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
> 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.ext_direction.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 < 5 {
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, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
i64,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 < 6 {
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::Endpoint<
fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
> 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.ext_l2cap.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 < 7 {
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::Endpoint<
fidl::endpoints::ClientEnd<AudioOffloadExtMarker>,
> 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.ext_audio_offload.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 < 8 {
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::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
> 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.connection.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 Information {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.provider {
return 4;
}
if let Some(_) = self.description {
return 3;
}
if let Some(_) = self.name {
return 2;
}
if let Some(_) = self.language {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Information {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Information {
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<Information, D>
for &Information
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Information>(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::<fidl::encoding::BoundedString<2>, D>(
self.language.as_ref().map(
<fidl::encoding::BoundedString<2> 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::BoundedString<1024>, D>(
self.name.as_ref().map(<fidl::encoding::BoundedString<1024> 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::<fidl::encoding::BoundedString<1024>, D>(
self.description.as_ref().map(<fidl::encoding::BoundedString<1024> 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::<fidl::encoding::BoundedString<1024>, D>(
self.provider.as_ref().map(<fidl::encoding::BoundedString<1024> 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 Information {
#[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 =
<fidl::encoding::BoundedString<2> 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
.language
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<2>, D));
fidl::decode!(
fidl::encoding::BoundedString<2>,
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::BoundedString<1024> 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.name.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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 = <fidl::encoding::BoundedString<1024> 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.description.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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 = <fidl::encoding::BoundedString<1024> 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.provider.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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 L2capParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.parameters {
return 2;
}
if let Some(_) = self.psm {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for L2capParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for L2capParameters {
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<L2capParameters, D>
for &L2capParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParameters>(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.psm.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::<fidl_fuchsia_bluetooth::ChannelParameters, D>(
self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters 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 L2capParameters {
#[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.psm.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 = <fidl_fuchsia_bluetooth::ChannelParameters 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.parameters.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::ChannelParameters, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::ChannelParameters,
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 ProfileAdvertiseRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.parameters {
return 3;
}
if let Some(_) = self.receiver {
return 2;
}
if let Some(_) = self.services {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileAdvertiseRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileAdvertiseRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
ProfileAdvertiseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileAdvertiseRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileAdvertiseRequest>(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::<fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.services.as_ref().map(<fidl::encoding::Vector<ServiceDefinition, 32> 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::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_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::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileAdvertiseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 = <fidl::encoding::Vector<ServiceDefinition, 32> 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.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, 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::Endpoint<
fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
> 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.receiver.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 = <fidl_fuchsia_bluetooth::ChannelParameters 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.parameters.get_or_insert_with(|| {
fidl::new_empty!(
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 ProfileConnectScoRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.connection {
return 4;
}
if let Some(_) = self.params {
return 3;
}
if let Some(_) = self.initiator {
return 2;
}
if let Some(_) = self.peer_id {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileConnectScoRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileConnectScoRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
ProfileConnectScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileConnectScoRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectScoRequest>(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::<
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.peer_id.as_ref().map(
<fidl_fuchsia_bluetooth::PeerId 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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.initiator.as_ref().map(<bool 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::<fidl::encoding::UnboundedVector<ScoConnectionParameters>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.params.as_ref().map(<fidl::encoding::UnboundedVector<ScoConnectionParameters> 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::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.connection.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileConnectScoRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 =
<fidl_fuchsia_bluetooth::PeerId 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.peer_id.get_or_insert_with(|| {
fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
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.initiator.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 = <fidl::encoding::UnboundedVector<ScoConnectionParameters> 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.params.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<ScoConnectionParameters>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<ScoConnectionParameters>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 = <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<ScoConnectionMarker>,
> 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.connection.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 ProfileDescriptor {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.minor_version {
return 3;
}
if let Some(_) = self.major_version {
return 2;
}
if let Some(_) = self.profile_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ProfileDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileDescriptor {
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<ProfileDescriptor, D>
for &ProfileDescriptor
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileDescriptor>(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::<ServiceClassProfileIdentifier, D>(
self.profile_id.as_ref().map(
<ServiceClassProfileIdentifier 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::<u8, D>(
self.major_version.as_ref().map(<u8 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::<u8, D>(
self.minor_version.as_ref().map(<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 ProfileDescriptor {
#[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 =
<ServiceClassProfileIdentifier 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
.profile_id
.get_or_insert_with(|| fidl::new_empty!(ServiceClassProfileIdentifier, D));
fidl::decode!(
ServiceClassProfileIdentifier,
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 =
<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.major_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(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;
_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 =
<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.minor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(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 ProfileSearchRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.full_uuid {
return 4;
}
if let Some(_) = self.results {
return 3;
}
if let Some(_) = self.attr_ids {
return 2;
}
if let Some(_) = self.service_uuid {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileSearchRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileSearchRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<ProfileSearchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ProfileSearchRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileSearchRequest>(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::<
ServiceClassProfileIdentifier,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.service_uuid.as_ref().map(
<ServiceClassProfileIdentifier 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::Vector<u16, 512>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.attr_ids.as_ref().map(
<fidl::encoding::Vector<u16, 512> 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::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.results.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_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::<
fidl_fuchsia_bluetooth::Uuid,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.full_uuid
.as_ref()
.map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileSearchRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 =
<ServiceClassProfileIdentifier 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.service_uuid.get_or_insert_with(|| {
fidl::new_empty!(
ServiceClassProfileIdentifier,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
ServiceClassProfileIdentifier,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::Vector<u16, 512> 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.attr_ids.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, 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 = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<SearchResultsMarker>,
> 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.results.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 =
<fidl_fuchsia_bluetooth::Uuid 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.full_uuid.get_or_insert_with(|| {
fidl::new_empty!(
fidl_fuchsia_bluetooth::Uuid,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 ProfileAdvertiseResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.services {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ProfileAdvertiseResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileAdvertiseResponse {
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<ProfileAdvertiseResponse, D> for &ProfileAdvertiseResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileAdvertiseResponse>(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::<fidl::encoding::Vector<ServiceDefinition, 32>, D>(
self.services.as_ref().map(<fidl::encoding::Vector<ServiceDefinition, 32> 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 ProfileAdvertiseResponse
{
#[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 = <fidl::encoding::Vector<ServiceDefinition, 32> 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.services.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<ServiceDefinition, 32>, D),
);
fidl::decode!(fidl::encoding::Vector<ServiceDefinition, 32>, 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 ProtocolDescriptor {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.params {
return 2;
}
if let Some(_) = self.protocol {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ProtocolDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProtocolDescriptor {
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<ProtocolDescriptor, D>
for &ProtocolDescriptor
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolDescriptor>(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::<ProtocolIdentifier, D>(
self.protocol
.as_ref()
.map(<ProtocolIdentifier 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::Vector<DataElement, 255>, D>(
self.params.as_ref().map(<fidl::encoding::Vector<DataElement, 255> 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 ProtocolDescriptor {
#[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 =
<ProtocolIdentifier 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.protocol.get_or_insert_with(|| fidl::new_empty!(ProtocolIdentifier, D));
fidl::decode!(ProtocolIdentifier, 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::Vector<DataElement, 255> 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.params.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<DataElement, 255>, D),
);
fidl::decode!(fidl::encoding::Vector<DataElement, 255>, 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 RfcommParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.channel {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for RfcommParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RfcommParameters {
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<RfcommParameters, D>
for &RfcommParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RfcommParameters>(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::<u8, D>(
self.channel.as_ref().map(<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 RfcommParameters {
#[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 =
<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.channel.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(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 ScoConnectionParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.max_tx_data_size {
return 10;
}
if let Some(_) = self.path {
return 9;
}
if let Some(_) = self.io_pcm_sample_payload_msb_position {
return 8;
}
if let Some(_) = self.io_pcm_data_format {
return 7;
}
if let Some(_) = self.io_frame_size {
return 6;
}
if let Some(_) = self.io_coding_format {
return 5;
}
if let Some(_) = self.io_bandwidth {
return 4;
}
if let Some(_) = self.air_frame_size {
return 3;
}
if let Some(_) = self.air_coding_format {
return 2;
}
if let Some(_) = self.parameter_set {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionParameters {
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<ScoConnectionParameters, D> for &ScoConnectionParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionParameters>(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::<HfpParameterSet, D>(
self.parameter_set
.as_ref()
.map(<HfpParameterSet 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_fuchsia_bluetooth::AssignedCodingFormat, D>(
self.air_coding_format.as_ref().map(<fidl_fuchsia_bluetooth::AssignedCodingFormat 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::<u16, D>(
self.air_frame_size.as_ref().map(<u16 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::<u32, D>(
self.io_bandwidth.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::AssignedCodingFormat, D>(
self.io_coding_format.as_ref().map(<fidl_fuchsia_bluetooth::AssignedCodingFormat as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.io_frame_size.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::SampleFormat, D>(
self.io_pcm_data_format.as_ref().map(<fidl_fuchsia_hardware_audio::SampleFormat as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u8, D>(
self.io_pcm_sample_payload_msb_position
.as_ref()
.map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<DataPath, D>(
self.path.as_ref().map(<DataPath as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 10 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (10 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.max_tx_data_size
.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 ScoConnectionParameters
{
#[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 =
<HfpParameterSet 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.parameter_set.get_or_insert_with(|| fidl::new_empty!(HfpParameterSet, D));
fidl::decode!(HfpParameterSet, 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_fuchsia_bluetooth::AssignedCodingFormat 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.air_coding_format.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::AssignedCodingFormat, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::AssignedCodingFormat,
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 =
<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.air_frame_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 < 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 =
<u32 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.io_bandwidth.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 < 5 {
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_fuchsia_bluetooth::AssignedCodingFormat 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.io_coding_format.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::AssignedCodingFormat, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::AssignedCodingFormat,
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 < 6 {
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.io_frame_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 < 7 {
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_fuchsia_hardware_audio::SampleFormat 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.io_pcm_data_format.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_hardware_audio::SampleFormat, D)
});
fidl::decode!(
fidl_fuchsia_hardware_audio::SampleFormat,
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 < 8 {
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 =
<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
.io_pcm_sample_payload_msb_position
.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
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 =
<DataPath 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.path.get_or_insert_with(|| fidl::new_empty!(DataPath, D));
fidl::decode!(DataPath, 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 < 10 {
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_tx_data_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;
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 ScoConnectionWriteRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.data {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionWriteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionWriteRequest {
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<ScoConnectionWriteRequest, D> for &ScoConnectionWriteRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionWriteRequest>(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::<fidl::encoding::UnboundedVector<u8>, D>(
self.data.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 ScoConnectionWriteRequest
{
#[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 = <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.data.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 ScoConnectionReadResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.data {
return 2;
}
if let Some(_) = self.status_flag {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionReadResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionReadResponse {
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<ScoConnectionReadResponse, D> for &ScoConnectionReadResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReadResponse>(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::<RxPacketStatus, D>(
self.status_flag
.as_ref()
.map(<RxPacketStatus 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.data.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 ScoConnectionReadResponse
{
#[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 =
<RxPacketStatus 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.status_flag.get_or_insert_with(|| fidl::new_empty!(RxPacketStatus, D));
fidl::decode!(RxPacketStatus, 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.data.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 ServiceDefinition {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.additional_attributes {
return 6;
}
if let Some(_) = self.information {
return 5;
}
if let Some(_) = self.profile_descriptors {
return 4;
}
if let Some(_) = self.additional_protocol_descriptor_lists {
return 3;
}
if let Some(_) = self.protocol_descriptor_list {
return 2;
}
if let Some(_) = self.service_class_uuids {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceDefinition {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceDefinition {
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<ServiceDefinition, D>
for &ServiceDefinition
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceDefinition>(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::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255>, D>(
self.service_class_uuids.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255> 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::Vector<ProtocolDescriptor, 255>, D>(
self.protocol_descriptor_list.as_ref().map(<fidl::encoding::Vector<ProtocolDescriptor, 255> 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::<fidl::encoding::Vector<fidl::encoding::Vector<ProtocolDescriptor, 255>, 255>, D>(
self.additional_protocol_descriptor_lists.as_ref().map(<fidl::encoding::Vector<fidl::encoding::Vector<ProtocolDescriptor, 255>, 255> 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::<fidl::encoding::Vector<ProfileDescriptor, 255>, D>(
self.profile_descriptors.as_ref().map(<fidl::encoding::Vector<ProfileDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Information, 85>, D>(
self.information.as_ref().map(<fidl::encoding::Vector<Information, 85> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Attribute, 65023>, D>(
self.additional_attributes.as_ref().map(<fidl::encoding::Vector<Attribute, 65023> 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 ServiceDefinition {
#[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 = <fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255> 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.service_class_uuids.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255>, 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::Vector<ProtocolDescriptor, 255> 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.protocol_descriptor_list.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, D),
);
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, 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 = <fidl::encoding::Vector<
fidl::encoding::Vector<ProtocolDescriptor, 255>,
255,
> 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.additional_protocol_descriptor_lists.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Vector<
fidl::encoding::Vector<ProtocolDescriptor, 255>,
255,
>,
D
)
});
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::Vector<ProtocolDescriptor, 255>, 255>,
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 = <fidl::encoding::Vector<ProfileDescriptor, 255> 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.profile_descriptors.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<ProfileDescriptor, 255>, D),
);
fidl::decode!(fidl::encoding::Vector<ProfileDescriptor, 255>, 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 < 5 {
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::Vector<Information, 85> 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.information.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<Information, 85>, D),
);
fidl::decode!(fidl::encoding::Vector<Information, 85>, 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 < 6 {
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::Vector<Attribute, 65023> 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.additional_attributes.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<Attribute, 65023>, D),
);
fidl::decode!(fidl::encoding::Vector<Attribute, 65023>, 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 AudioEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioEncoderSettings {
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<AudioEncoderSettings, D>
for &AudioEncoderSettings
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioEncoderSettings>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioEncoderSettings::Sbc(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_media::SbcEncoderSettings, D>(
<fidl_fuchsia_media::SbcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
AudioEncoderSettings::Aac(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_media::AacEncoderSettings, D>(
<fidl_fuchsia_media::AacEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
AudioEncoderSettings::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioEncoderSettings {
#[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 => <fidl_fuchsia_media::SbcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl_fuchsia_media::AacEncoderSettings 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 AudioEncoderSettings::Sbc(_) = self {
} else {
*self = AudioEncoderSettings::Sbc(fidl::new_empty!(
fidl_fuchsia_media::SbcEncoderSettings,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioEncoderSettings::Sbc(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_media::SbcEncoderSettings,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AudioEncoderSettings::Aac(_) = self {
} else {
*self = AudioEncoderSettings::Aac(fidl::new_empty!(
fidl_fuchsia_media::AacEncoderSettings,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioEncoderSettings::Aac(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_media::AacEncoderSettings,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = AudioEncoderSettings::__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(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadFeatures {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioOffloadFeatures {
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<AudioOffloadFeatures, D>
for &AudioOffloadFeatures
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadFeatures>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioOffloadFeatures::Sbc(ref val) => {
fidl::encoding::encode_in_envelope::<AudioSbcSupport, D>(
<AudioSbcSupport as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioOffloadFeatures::Aac(ref val) => {
fidl::encoding::encode_in_envelope::<AudioAacSupport, D>(
<AudioAacSupport as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioOffloadFeatures::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioOffloadFeatures {
#[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 => <AudioSbcSupport as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <AudioAacSupport 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 AudioOffloadFeatures::Sbc(_) = self {
} else {
*self = AudioOffloadFeatures::Sbc(fidl::new_empty!(AudioSbcSupport, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioOffloadFeatures::Sbc(ref mut val) = self {
fidl::decode!(AudioSbcSupport, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AudioOffloadFeatures::Aac(_) = self {
} else {
*self = AudioOffloadFeatures::Aac(fidl::new_empty!(AudioAacSupport, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioOffloadFeatures::Aac(ref mut val) = self {
fidl::decode!(AudioAacSupport, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = AudioOffloadFeatures::__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(())
}
}
impl fidl::encoding::ValueTypeMarker for ConnectParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectParameters {
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<ConnectParameters, D>
for &ConnectParameters
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectParameters>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ConnectParameters::L2cap(ref val) => {
fidl::encoding::encode_in_envelope::<L2capParameters, D>(
<L2capParameters as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ConnectParameters::Rfcomm(ref val) => {
fidl::encoding::encode_in_envelope::<RfcommParameters, D>(
<RfcommParameters as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::L2cap(fidl::new_empty!(L2capParameters, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <L2capParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <RfcommParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::L2cap(_) = self {
} else {
*self = ConnectParameters::L2cap(fidl::new_empty!(L2capParameters, D));
}
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::L2cap(ref mut val) = self {
fidl::decode!(L2capParameters, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::Rfcomm(_) = self {
} else {
*self = ConnectParameters::Rfcomm(fidl::new_empty!(RfcommParameters, D));
}
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::Rfcomm(ref mut val) = self {
fidl::decode!(RfcommParameters, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DataElement {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DataElement {
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<DataElement, D>
for &DataElement
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DataElement>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DataElement::Int8(ref val) => {
fidl::encoding::encode_in_envelope::<i8, D>(
<i8 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int16(ref val) => {
fidl::encoding::encode_in_envelope::<i16, D>(
<i16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int32(ref val) => {
fidl::encoding::encode_in_envelope::<i32, D>(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int64(ref val) => {
fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint8(ref val) => {
fidl::encoding::encode_in_envelope::<u8, D>(
<u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint16(ref val) => {
fidl::encoding::encode_in_envelope::<u16, D>(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint32(ref val) => {
fidl::encoding::encode_in_envelope::<u32, D>(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint64(ref val) => {
fidl::encoding::encode_in_envelope::<u64, D>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Str(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 1024>, D>(
<fidl::encoding::Vector<u8, 1024> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Url(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, D>(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uuid(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_bluetooth::Uuid, D>(
<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::B(ref val) => {
fidl::encoding::encode_in_envelope::<bool, D>(
<bool as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Sequence(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>, D>(
<fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Alternatives(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>, D>(
<fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DataElement {
#[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 => <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <i16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
9 => <fidl::encoding::Vector<u8, 1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
10 => <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11 => <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13 => <fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14 => <fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255> 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 DataElement::Int8(_) = self {
} else {
*self = DataElement::Int8(fidl::new_empty!(i8, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int8(ref mut val) = self {
fidl::decode!(i8, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Int16(_) = self {
} else {
*self = DataElement::Int16(fidl::new_empty!(i16, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int16(ref mut val) = self {
fidl::decode!(i16, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Int32(_) = self {
} else {
*self = DataElement::Int32(fidl::new_empty!(i32, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int32(ref mut val) = self {
fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Int64(_) = self {
} else {
*self = DataElement::Int64(fidl::new_empty!(i64, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int64(ref mut val) = self {
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint8(_) = self {
} else {
*self = DataElement::Uint8(fidl::new_empty!(u8, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint8(ref mut val) = self {
fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint16(_) = self {
} else {
*self = DataElement::Uint16(fidl::new_empty!(u16, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint16(ref mut val) = self {
fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint32(_) = self {
} else {
*self = DataElement::Uint32(fidl::new_empty!(u32, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint32(ref mut val) = self {
fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
8 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint64(_) = self {
} else {
*self = DataElement::Uint64(fidl::new_empty!(u64, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint64(ref mut val) = self {
fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
9 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Str(_) = self {
} else {
*self =
DataElement::Str(fidl::new_empty!(fidl::encoding::Vector<u8, 1024>, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Str(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 1024>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
10 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Url(_) = self {
} else {
*self = DataElement::Url(fidl::new_empty!(
fidl::encoding::BoundedString<4096>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Url(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<4096>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
11 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Uuid(_) = self {
} else {
*self =
DataElement::Uuid(fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uuid(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
12 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::B(_) = self {
} else {
*self = DataElement::B(fidl::new_empty!(bool, D));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::B(ref mut val) = self {
fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
13 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Sequence(_) = self {
} else {
*self = DataElement::Sequence(fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Sequence(ref mut val) = self {
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
14 => {
#[allow(irrefutable_let_patterns)]
if let DataElement::Alternatives(_) = self {
} else {
*self = DataElement::Alternatives(fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Alternatives(ref mut val) = self {
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = DataElement::__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(())
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionOnConnectionCompleteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionOnConnectionCompleteRequest {
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<ScoConnectionOnConnectionCompleteRequest, D>
for &ScoConnectionOnConnectionCompleteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionOnConnectionCompleteRequest>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ScoConnectionOnConnectionCompleteRequest::ConnectedParams(ref val) => {
fidl::encoding::encode_in_envelope::<ScoConnectionParameters, D>(
<ScoConnectionParameters as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ScoConnectionOnConnectionCompleteRequest::Error(ref val) => {
fidl::encoding::encode_in_envelope::<ScoErrorCode, D>(
<ScoErrorCode as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ScoConnectionOnConnectionCompleteRequest::__SourceBreaking { .. } => {
Err(fidl::Error::UnknownUnionTag)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ScoConnectionOnConnectionCompleteRequest
{
#[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 => <ScoConnectionParameters as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <ScoErrorCode 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 ScoConnectionOnConnectionCompleteRequest::ConnectedParams(_) = self {
} else {
*self = ScoConnectionOnConnectionCompleteRequest::ConnectedParams(
fidl::new_empty!(ScoConnectionParameters, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ScoConnectionOnConnectionCompleteRequest::ConnectedParams(ref mut val) =
self
{
fidl::decode!(
ScoConnectionParameters,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ScoConnectionOnConnectionCompleteRequest::Error(_) = self {
} else {
*self = ScoConnectionOnConnectionCompleteRequest::Error(fidl::new_empty!(
ScoErrorCode,
D
));
}
#[allow(irrefutable_let_patterns)]
if let ScoConnectionOnConnectionCompleteRequest::Error(ref mut val) = self {
fidl::decode!(ScoErrorCode, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ScoConnectionOnConnectionCompleteRequest::__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(())
}
}
}