#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
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)]
#[repr(u8)]
pub enum AudioBitsPerSample {
Bps16 = 1,
Bps24 = 2,
Bps32 = 3,
}
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 const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum AudioChannelMode {
Mono = 0,
Stereo = 1,
}
impl AudioChannelMode {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Mono),
1 => Some(Self::Stereo),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum AudioSamplingFrequency {
Hz44100 = 1,
Hz48000 = 2,
Hz88200 = 3,
Hz96000 = 4,
}
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 const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ChannelMode {
Basic = 1,
EnhancedRetransmission = 2,
}
impl ChannelMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Basic),
2 => Some(Self::EnhancedRetransmission),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum CodingFormat {
Mulaw = 1,
Alaw = 2,
Cvsd = 3,
Transparent = 4,
LinearPcm = 5,
Msbc = 6,
Lc3 = 7,
G729A = 8,
}
impl CodingFormat {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Mulaw),
2 => Some(Self::Alaw),
3 => Some(Self::Cvsd),
4 => Some(Self::Transparent),
5 => Some(Self::LinearPcm),
6 => Some(Self::Msbc),
7 => Some(Self::Lc3),
8 => Some(Self::G729A),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(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)]
#[repr(u8)]
pub enum HfpParameterSet {
T1 = 1,
T2 = 2,
S1 = 3,
S2 = 4,
S3 = 5,
S4 = 6,
D0 = 7,
D1 = 8,
}
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 const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u16)]
pub enum ProtocolIdentifier {
Sdp = 1,
Rfcomm = 3,
Att = 7,
Obex = 8,
Bnep = 15,
Hidp = 17,
HardcopyControlChannel = 18,
HardcopyDataChannel = 20,
HardcopyNotification = 22,
Avctp = 23,
Avdtp = 25,
McapControlChannel = 30,
McapDataChannel = 31,
L2Cap = 256,
}
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 const fn into_primitive(self) -> u16 {
self as u16
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum 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)]
#[repr(u32)]
pub enum ScoErrorCode {
Failure = 1,
Cancelled = 2,
InvalidArguments = 3,
ParametersRejected = 4,
}
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 const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u16)]
pub enum ServiceClassProfileIdentifier {
SerialPort = 4353,
DialupNetworking = 4355,
ObexObjectPush = 4357,
OpexFileTransfer = 4358,
Headset = 4360,
HeadsetAudioGateway = 4370,
HeadsetHs = 4401,
AudioSource = 4362,
AudioSink = 4363,
AdvancedAudioDistribution = 4365,
AvRemoteControlTarget = 4364,
AvRemoteControl = 4366,
AvRemoteControlController = 4367,
Panu = 4373,
Nap = 4374,
Gn = 4375,
Handsfree = 4382,
HandsfreeAudioGateway = 4383,
HumanInterfaceDevice = 4388,
SimAccess = 4397,
PhonebookPce = 4398,
PhonebookPse = 4399,
Phonebook = 4400,
MessageAccessServer = 4402,
MessageNotificationServer = 4403,
MessageAccessProfile = 4404,
MpsProfile = 4410,
MpsClass = 4411,
PnpInformation = 4608,
GenericNetworking = 4609,
GenericFileTransfer = 4610,
GenericAudio = 4611,
GenericTelephony = 4612,
VideoSource = 4867,
VideoSink = 4868,
VideoDistribution = 4869,
Hdp = 5120,
HdpSource = 5121,
HdpSink = 5122,
}
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 const fn into_primitive(self) -> u16 {
self as u16
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct Attribute {
pub id: u16,
pub element: DataElement,
}
impl fidl::Persistable for Attribute {}
#[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 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 for ConnectionReceiverConnectedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersRequest {
pub request: ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersResponse {
pub new: ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MockPeerConnectProxyRequest {
pub interface: fidl::endpoints::ServerEnd<ProfileMarker>,
}
impl fidl::Standalone for MockPeerConnectProxyRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerObserverPeerConnectedRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Vec<ProtocolDescriptor>,
}
impl fidl::Persistable for PeerObserverPeerConnectedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerObserverServiceFoundRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Option<Vec<ProtocolDescriptor>>,
pub attributes: Vec<Attribute>,
}
impl fidl::Persistable for PeerObserverServiceFoundRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ProfileConnectRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub connection: ConnectParameters,
}
impl fidl::Persistable for ProfileConnectRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileDescriptor {
pub profile_id: ServiceClassProfileIdentifier,
pub major_version: u8,
pub minor_version: u8,
}
impl fidl::Persistable for ProfileDescriptor {}
#[derive(Debug, PartialEq)]
pub struct ProfileTestRegisterPeerRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
pub observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
}
impl fidl::Standalone for ProfileTestRegisterPeerRequest {}
#[derive(Debug, PartialEq)]
pub struct ProfileConnectResponse {
pub channel: Channel,
}
impl fidl::Standalone for ProfileConnectResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct ProtocolDescriptor {
pub protocol: ProtocolIdentifier,
pub params: Vec<DataElement>,
}
impl fidl::Persistable for ProtocolDescriptor {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ScoConnectionReadResponse {
pub status_flag: RxPacketStatus,
pub data: Vec<u8>,
}
impl fidl::Persistable for ScoConnectionReadResponse {}
#[derive(Debug, PartialEq)]
pub struct ScoConnectionReceiverConnectedRequest {
pub connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
pub params: ScoConnectionParameters,
}
impl fidl::Standalone for ScoConnectionReceiverConnectedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ScoConnectionReceiverErrorRequest {
pub error: ScoErrorCode,
}
impl fidl::Persistable for ScoConnectionReceiverErrorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ScoConnectionWriteRequest {
pub data: Vec<u8>,
}
impl fidl::Persistable for ScoConnectionWriteRequest {}
#[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 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<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>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for Channel {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ChannelParameters {
pub channel_mode: Option<ChannelMode>,
pub max_rx_sdu_size: Option<u16>,
pub security_requirements: Option<SecurityRequirements>,
pub flush_timeout: Option<i64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ChannelParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct 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<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<ChannelParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone 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 receiver: Option<fidl::endpoints::ClientEnd<ScoConnectionReceiverMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for ProfileConnectScoRequest {}
#[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>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for ProfileSearchRequest {}
#[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<CodingFormat>,
pub air_frame_size: Option<u16>,
pub io_bandwidth: Option<u32>,
pub io_coding_format: Option<CodingFormat>,
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 SecurityRequirements {
pub authentication_required: Option<bool>,
pub secure_connections_required: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SecurityRequirements {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct 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, PartialEq)]
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>>>),
}
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,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for DataElement {}
#[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::Time,
) -> Result<AudioDirectionExtEvent, fidl::Error> {
AudioDirectionExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_priority(
&self,
mut priority: A2dpDirectionPriority,
___deadline: zx::Time,
) -> 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,
}
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> {
AudioDirectionExtProxyInterface::r#set_priority(self, priority)
}
}
impl AudioDirectionExtProxyInterface for AudioDirectionExtProxy {
type SetPriorityResponseFut =
fidl::client::QueryResponseFut<AudioDirectionExtSetPriorityResult>;
fn r#set_priority(&self, mut priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>,
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,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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>,
}
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()
}
}
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::Time,
) -> Result<AudioOffloadControllerEvent, fidl::Error> {
AudioOffloadControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#stop(&self, ___deadline: zx::Time) -> 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,
}
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<()> {
AudioOffloadControllerProxyInterface::r#stop(self)
}
}
impl AudioOffloadControllerProxyInterface for AudioOffloadControllerProxy {
type StopResponseFut = fidl::client::QueryResponseFut<()>;
fn r#stop(&self) -> Self::StopResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
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,
}
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::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::Decoder::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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>,
}
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()
}
}
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::Time) -> Result<AudioOffloadExtEvent, fidl::Error> {
AudioOffloadExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_supported_features(
&self,
___deadline: zx::Time,
) -> 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,
}
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> {
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>;
fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
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,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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::Decoder::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>,
}
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()
}
}
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::Time,
) -> 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,
}
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,
}
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::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::Decoder::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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>,
}
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()
}
}
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<ChannelParameters, fidl::Error>>
+ Send;
fn r#request_parameters(
&self,
request: &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::Time,
) -> Result<L2capParametersExtEvent, fidl::Error> {
L2capParametersExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#request_parameters(
&self,
mut request: &ChannelParameters,
___deadline: zx::Time,
) -> Result<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,
}
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: &ChannelParameters,
) -> fidl::client::QueryResponseFut<ChannelParameters> {
L2capParametersExtProxyInterface::r#request_parameters(self, request)
}
}
impl L2capParametersExtProxyInterface for L2capParametersExtProxy {
type RequestParametersResponseFut = fidl::client::QueryResponseFut<ChannelParameters>;
fn r#request_parameters(
&self,
mut request: &ChannelParameters,
) -> Self::RequestParametersResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ChannelParameters, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
0x1da4d8f268e2e918,
>(_buf?)?
.into_result::<L2capParametersExtMarker>("request_parameters")?;
Ok(_response.new)
}
self.client
.send_query_and_decode::<L2capParametersExtRequestParametersRequest, ChannelParameters>(
(request,),
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct L2capParametersExtEventStream {
event_receiver: fidl::client::EventReceiver,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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: 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<(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>,
}
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()
}
}
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: &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: &ChannelParameters) -> Result<(), fidl::Error> {
let _result = self.send_raw(new);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut new: &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 MockPeerMarker;
impl fidl::endpoints::ProtocolMarker for MockPeerMarker {
type Proxy = MockPeerProxy;
type RequestStream = MockPeerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MockPeerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MockPeer";
}
pub trait MockPeerProxyInterface: Send + Sync {
type ConnectProxy_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#connect_proxy_(
&self,
interface: fidl::endpoints::ServerEnd<ProfileMarker>,
) -> Self::ConnectProxy_ResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MockPeerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MockPeerSynchronousProxy {
type Proxy = MockPeerProxy;
type Protocol = MockPeerMarker;
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 MockPeerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <MockPeerMarker 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::Time) -> Result<MockPeerEvent, fidl::Error> {
MockPeerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<ProfileMarker>,
___deadline: zx::Time,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<MockPeerConnectProxyRequest, fidl::encoding::EmptyPayload>(
(interface,),
0x387e84a8b70c92e7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct MockPeerProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for MockPeerProxy {
type Protocol = MockPeerMarker;
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 MockPeerProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MockPeerEventStream {
MockPeerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<ProfileMarker>,
) -> fidl::client::QueryResponseFut<()> {
MockPeerProxyInterface::r#connect_proxy_(self, interface)
}
}
impl MockPeerProxyInterface for MockPeerProxy {
type ConnectProxy_ResponseFut = fidl::client::QueryResponseFut<()>;
fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<ProfileMarker>,
) -> Self::ConnectProxy_ResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x387e84a8b70c92e7,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<MockPeerConnectProxyRequest, ()>(
(interface,),
0x387e84a8b70c92e7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MockPeerEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for MockPeerEventStream {}
impl futures::stream::FusedStream for MockPeerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MockPeerEventStream {
type Item = Result<MockPeerEvent, 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(MockPeerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MockPeerEvent {}
impl MockPeerEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<MockPeerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MockPeerRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for MockPeerRequestStream {}
impl futures::stream::FusedStream for MockPeerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MockPeerRequestStream {
type Protocol = MockPeerMarker;
type ControlHandle = MockPeerControlHandle;
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 {
MockPeerControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for MockPeerRequestStream {
type Item = Result<MockPeerRequest, 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 MockPeerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x387e84a8b70c92e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(MockPeerConnectProxyRequest);
fidl::encoding::Decoder::decode_into::<MockPeerConnectProxyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = MockPeerControlHandle { inner: this.inner.clone() };
Ok(MockPeerRequest::ConnectProxy_ {
interface: req.interface,
responder: MockPeerConnectProxy_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum MockPeerRequest {
ConnectProxy_ {
interface: fidl::endpoints::ServerEnd<ProfileMarker>,
responder: MockPeerConnectProxy_Responder,
},
}
impl MockPeerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_proxy_(
self,
) -> Option<(fidl::endpoints::ServerEnd<ProfileMarker>, MockPeerConnectProxy_Responder)> {
if let MockPeerRequest::ConnectProxy_ { interface, responder } = self {
Some((interface, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MockPeerRequest::ConnectProxy_ { .. } => "connect_proxy_",
}
}
}
#[derive(Debug, Clone)]
pub struct MockPeerControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for MockPeerControlHandle {
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()
}
}
impl MockPeerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MockPeerConnectProxy_Responder {
control_handle: std::mem::ManuallyDrop<MockPeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MockPeerConnectProxy_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MockPeerConnectProxy_Responder {
type ControlHandle = MockPeerControlHandle;
fn control_handle(&self) -> &MockPeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MockPeerConnectProxy_Responder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x387e84a8b70c92e7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerObserverMarker;
impl fidl::endpoints::ProtocolMarker for PeerObserverMarker {
type Proxy = PeerObserverProxy;
type RequestStream = PeerObserverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerObserverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PeerObserver";
}
pub trait PeerObserverProxyInterface: 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;
type PeerConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#peer_connected(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
protocol: &[ProtocolDescriptor],
) -> Self::PeerConnectedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerObserverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerObserverSynchronousProxy {
type Proxy = PeerObserverProxy;
type Protocol = PeerObserverMarker;
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 PeerObserverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerObserverMarker 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::Time) -> Result<PeerObserverEvent, fidl::Error> {
PeerObserverEvent::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::Time,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<PeerObserverServiceFoundRequest, fidl::encoding::EmptyPayload>(
(peer_id, protocol, attributes),
0x7fbb3e9098897652,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[ProtocolDescriptor],
___deadline: zx::Time,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<PeerObserverPeerConnectedRequest, fidl::encoding::EmptyPayload>(
(peer_id, protocol),
0x246458675e95e325,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct PeerObserverProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for PeerObserverProxy {
type Protocol = PeerObserverMarker;
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 PeerObserverProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerObserverEventStream {
PeerObserverEventStream { 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<()> {
PeerObserverProxyInterface::r#service_found(self, peer_id, protocol, attributes)
}
pub fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[ProtocolDescriptor],
) -> fidl::client::QueryResponseFut<()> {
PeerObserverProxyInterface::r#peer_connected(self, peer_id, protocol)
}
}
impl PeerObserverProxyInterface for PeerObserverProxy {
type ServiceFoundResponseFut = fidl::client::QueryResponseFut<()>;
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::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x7fbb3e9098897652,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerObserverServiceFoundRequest, ()>(
(peer_id, protocol, attributes),
0x7fbb3e9098897652,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PeerConnectedResponseFut = fidl::client::QueryResponseFut<()>;
fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[ProtocolDescriptor],
) -> Self::PeerConnectedResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x246458675e95e325,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerObserverPeerConnectedRequest, ()>(
(peer_id, protocol),
0x246458675e95e325,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PeerObserverEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for PeerObserverEventStream {}
impl futures::stream::FusedStream for PeerObserverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerObserverEventStream {
type Item = Result<PeerObserverEvent, 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(PeerObserverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerObserverEvent {}
impl PeerObserverEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<PeerObserverEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerObserverRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerObserverRequestStream {}
impl futures::stream::FusedStream for PeerObserverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerObserverRequestStream {
type Protocol = PeerObserverMarker;
type ControlHandle = PeerObserverControlHandle;
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 {
PeerObserverControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PeerObserverRequestStream {
type Item = Result<PeerObserverRequest, 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 PeerObserverRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7fbb3e9098897652 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(PeerObserverServiceFoundRequest);
fidl::encoding::Decoder::decode_into::<PeerObserverServiceFoundRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PeerObserverControlHandle { inner: this.inner.clone() };
Ok(PeerObserverRequest::ServiceFound {
peer_id: req.peer_id,
protocol: req.protocol,
attributes: req.attributes,
responder: PeerObserverServiceFoundResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x246458675e95e325 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(PeerObserverPeerConnectedRequest);
fidl::encoding::Decoder::decode_into::<PeerObserverPeerConnectedRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PeerObserverControlHandle { inner: this.inner.clone() };
Ok(PeerObserverRequest::PeerConnected {
peer_id: req.peer_id,
protocol: req.protocol,
responder: PeerObserverPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum PeerObserverRequest {
ServiceFound {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Option<Vec<ProtocolDescriptor>>,
attributes: Vec<Attribute>,
responder: PeerObserverServiceFoundResponder,
},
PeerConnected {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Vec<ProtocolDescriptor>,
responder: PeerObserverPeerConnectedResponder,
},
}
impl PeerObserverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_service_found(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Option<Vec<ProtocolDescriptor>>,
Vec<Attribute>,
PeerObserverServiceFoundResponder,
)> {
if let PeerObserverRequest::ServiceFound { peer_id, protocol, attributes, responder } = self
{
Some((peer_id, protocol, attributes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_peer_connected(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Vec<ProtocolDescriptor>,
PeerObserverPeerConnectedResponder,
)> {
if let PeerObserverRequest::PeerConnected { peer_id, protocol, responder } = self {
Some((peer_id, protocol, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerObserverRequest::ServiceFound { .. } => "service_found",
PeerObserverRequest::PeerConnected { .. } => "peer_connected",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerObserverControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for PeerObserverControlHandle {
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()
}
}
impl PeerObserverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerObserverServiceFoundResponder {
control_handle: std::mem::ManuallyDrop<PeerObserverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerObserverServiceFoundResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerObserverServiceFoundResponder {
type ControlHandle = PeerObserverControlHandle;
fn control_handle(&self) -> &PeerObserverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerObserverServiceFoundResponder {
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::EmptyPayload>(
(),
self.tx_id,
0x7fbb3e9098897652,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerObserverPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop<PeerObserverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerObserverPeerConnectedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerObserverPeerConnectedResponder {
type ControlHandle = PeerObserverControlHandle;
fn control_handle(&self) -> &PeerObserverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerObserverPeerConnectedResponder {
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::EmptyPayload>(
(),
self.tx_id,
0x246458675e95e325,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[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<(), 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::Time) -> Result<ProfileEvent, fidl::Error> {
ProfileEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#advertise(
&self,
mut payload: ProfileAdvertiseRequest,
___deadline: zx::Time,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = self
.client
.send_query::<ProfileAdvertiseRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
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::Time,
) -> 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,
}
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> {
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> {
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>;
fn r#advertise(&self, mut payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>,
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>;
fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ProfileConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>,
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,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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::Decoder::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::Decoder::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::Decoder::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>,
}
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()
}
}
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<(), 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,
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 ProfileTestMarker;
impl fidl::endpoints::ProtocolMarker for ProfileTestMarker {
type Proxy = ProfileTestProxy;
type RequestStream = ProfileTestRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileTestSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.bredr.ProfileTest";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileTestMarker {}
pub trait ProfileTestProxyInterface: Send + Sync {
type RegisterPeerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#register_peer(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> Self::RegisterPeerResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileTestSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileTestSynchronousProxy {
type Proxy = ProfileTestProxy;
type Protocol = ProfileTestMarker;
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 ProfileTestSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileTestMarker 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::Time) -> Result<ProfileTestEvent, fidl::Error> {
ProfileTestEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
___deadline: zx::Time,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ProfileTestRegisterPeerRequest, fidl::encoding::EmptyPayload>(
(peer_id, peer, observer),
0x4436c0a4f4e50217,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ProfileTestProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ProfileTestProxy {
type Protocol = ProfileTestMarker;
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 ProfileTestProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileTestEventStream {
ProfileTestEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> fidl::client::QueryResponseFut<()> {
ProfileTestProxyInterface::r#register_peer(self, peer_id, peer, observer)
}
}
impl ProfileTestProxyInterface for ProfileTestProxy {
type RegisterPeerResponseFut = fidl::client::QueryResponseFut<()>;
fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> Self::RegisterPeerResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x4436c0a4f4e50217,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ProfileTestRegisterPeerRequest, ()>(
(peer_id, peer, observer),
0x4436c0a4f4e50217,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProfileTestEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ProfileTestEventStream {}
impl futures::stream::FusedStream for ProfileTestEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileTestEventStream {
type Item = Result<ProfileTestEvent, 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(ProfileTestEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileTestEvent {}
impl ProfileTestEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ProfileTestEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileTestRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileTestRequestStream {}
impl futures::stream::FusedStream for ProfileTestRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileTestRequestStream {
type Protocol = ProfileTestMarker;
type ControlHandle = ProfileTestControlHandle;
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 {
ProfileTestControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ProfileTestRequestStream {
type Item = Result<ProfileTestRequest, 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 ProfileTestRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4436c0a4f4e50217 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ProfileTestRegisterPeerRequest);
fidl::encoding::Decoder::decode_into::<ProfileTestRegisterPeerRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ProfileTestControlHandle { inner: this.inner.clone() };
Ok(ProfileTestRequest::RegisterPeer {
peer_id: req.peer_id,
peer: req.peer,
observer: req.observer,
responder: ProfileTestRegisterPeerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ProfileTestRequest {
RegisterPeer {
peer_id: fidl_fuchsia_bluetooth::PeerId,
peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
responder: ProfileTestRegisterPeerResponder,
},
}
impl ProfileTestRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_peer(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
fidl::endpoints::ServerEnd<MockPeerMarker>,
fidl::endpoints::ClientEnd<PeerObserverMarker>,
ProfileTestRegisterPeerResponder,
)> {
if let ProfileTestRequest::RegisterPeer { peer_id, peer, observer, responder } = self {
Some((peer_id, peer, observer, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileTestRequest::RegisterPeer { .. } => "register_peer",
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileTestControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ProfileTestControlHandle {
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()
}
}
impl ProfileTestControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileTestRegisterPeerResponder {
control_handle: std::mem::ManuallyDrop<ProfileTestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileTestRegisterPeerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileTestRegisterPeerResponder {
type ControlHandle = ProfileTestControlHandle;
fn control_handle(&self) -> &ProfileTestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileTestRegisterPeerResponder {
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::EmptyPayload>(
(),
self.tx_id,
0x4436c0a4f4e50217,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[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<(RxPacketStatus, Vec<u8>), fidl::Error>>
+ Send;
fn r#read(&self) -> Self::ReadResponseFut;
type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#write(&self, data: &[u8]) -> 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::Time) -> Result<ScoConnectionEvent, fidl::Error> {
ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#read(&self, ___deadline: zx::Time) -> Result<(RxPacketStatus, Vec<u8>), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, ScoConnectionReadResponse>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status_flag, _response.data))
}
pub fn r#write(&self, mut data: &[u8], ___deadline: zx::Time) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<ScoConnectionWriteRequest, fidl::encoding::EmptyPayload>(
(data,),
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionProxy {
client: fidl::client::Client,
}
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<(RxPacketStatus, Vec<u8>)> {
ScoConnectionProxyInterface::r#read(self)
}
pub fn r#write(&self, mut data: &[u8]) -> fidl::client::QueryResponseFut<()> {
ScoConnectionProxyInterface::r#write(self, data)
}
}
impl ScoConnectionProxyInterface for ScoConnectionProxy {
type ReadResponseFut = fidl::client::QueryResponseFut<(RxPacketStatus, Vec<u8>)>;
fn r#read(&self) -> Self::ReadResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(RxPacketStatus, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ScoConnectionReadResponse,
0x6fb29eb1e16ac616,
>(_buf?)?;
Ok((_response.status_flag, _response.data))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, (RxPacketStatus, Vec<u8>)>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteResponseFut = fidl::client::QueryResponseFut<()>;
fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x394e1b2ff7f4a5a9,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ScoConnectionWriteRequest, ()>(
(data,),
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ScoConnectionEventStream {
event_receiver: fidl::client::EventReceiver,
}
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 {}
impl ScoConnectionEvent {
fn decode(mut buf: fidl::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 {
_ => 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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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::Decoder::decode_into::<ScoConnectionWriteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Write {
data: req.data,
responder: ScoConnectionWriteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => 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 { data: Vec<u8>, responder: ScoConnectionWriteResponder },
}
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<(Vec<u8>, ScoConnectionWriteResponder)> {
if let ScoConnectionRequest::Write { data, responder } = self {
Some((data, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ScoConnectionRequest::Read { .. } => "read",
ScoConnectionRequest::Write { .. } => "write",
}
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
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()
}
}
impl ScoConnectionControlHandle {}
#[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 status_flag: RxPacketStatus, mut data: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(status_flag, data);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status_flag: RxPacketStatus,
mut data: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status_flag, data);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status_flag: RxPacketStatus,
mut data: &[u8],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ScoConnectionReadResponse>(
(status_flag, data),
self.tx_id,
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[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::EmptyPayload>(
(),
self.tx_id,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ScoConnectionReceiverMarker;
impl fidl::endpoints::ProtocolMarker for ScoConnectionReceiverMarker {
type Proxy = ScoConnectionReceiverProxy;
type RequestStream = ScoConnectionReceiverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ScoConnectionReceiverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ScoConnectionReceiver";
}
pub trait ScoConnectionReceiverProxyInterface: Send + Sync {
fn r#connected(
&self,
connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
params: &ScoConnectionParameters,
) -> Result<(), fidl::Error>;
fn r#error(&self, error: ScoErrorCode) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ScoConnectionReceiverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ScoConnectionReceiverSynchronousProxy {
type Proxy = ScoConnectionReceiverProxy;
type Protocol = ScoConnectionReceiverMarker;
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 ScoConnectionReceiverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ScoConnectionReceiverMarker 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::Time,
) -> Result<ScoConnectionReceiverEvent, fidl::Error> {
ScoConnectionReceiverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connected(
&self,
mut connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
mut params: &ScoConnectionParameters,
) -> Result<(), fidl::Error> {
self.client.send::<ScoConnectionReceiverConnectedRequest>(
(connection, params),
0x541c04b988fe37c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#error(&self, mut error: ScoErrorCode) -> Result<(), fidl::Error> {
self.client.send::<ScoConnectionReceiverErrorRequest>(
(error,),
0x3896fc906ff09692,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionReceiverProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ScoConnectionReceiverProxy {
type Protocol = ScoConnectionReceiverMarker;
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 ScoConnectionReceiverProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<ScoConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ScoConnectionReceiverEventStream {
ScoConnectionReceiverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connected(
&self,
mut connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
mut params: &ScoConnectionParameters,
) -> Result<(), fidl::Error> {
ScoConnectionReceiverProxyInterface::r#connected(self, connection, params)
}
pub fn r#error(&self, mut error: ScoErrorCode) -> Result<(), fidl::Error> {
ScoConnectionReceiverProxyInterface::r#error(self, error)
}
}
impl ScoConnectionReceiverProxyInterface for ScoConnectionReceiverProxy {
fn r#connected(
&self,
mut connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
mut params: &ScoConnectionParameters,
) -> Result<(), fidl::Error> {
self.client.send::<ScoConnectionReceiverConnectedRequest>(
(connection, params),
0x541c04b988fe37c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#error(&self, mut error: ScoErrorCode) -> Result<(), fidl::Error> {
self.client.send::<ScoConnectionReceiverErrorRequest>(
(error,),
0x3896fc906ff09692,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ScoConnectionReceiverEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ScoConnectionReceiverEventStream {}
impl futures::stream::FusedStream for ScoConnectionReceiverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ScoConnectionReceiverEventStream {
type Item = Result<ScoConnectionReceiverEvent, 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(ScoConnectionReceiverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ScoConnectionReceiverEvent {}
impl ScoConnectionReceiverEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ScoConnectionReceiverEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ScoConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ScoConnectionReceiverRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ScoConnectionReceiverRequestStream {}
impl futures::stream::FusedStream for ScoConnectionReceiverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ScoConnectionReceiverRequestStream {
type Protocol = ScoConnectionReceiverMarker;
type ControlHandle = ScoConnectionReceiverControlHandle;
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 {
ScoConnectionReceiverControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ScoConnectionReceiverRequestStream {
type Item = Result<ScoConnectionReceiverRequest, 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 ScoConnectionReceiverRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x541c04b988fe37c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ScoConnectionReceiverConnectedRequest);
fidl::encoding::Decoder::decode_into::<ScoConnectionReceiverConnectedRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
ScoConnectionReceiverControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionReceiverRequest::Connected {
connection: req.connection,
params: req.params,
control_handle,
})
}
0x3896fc906ff09692 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ScoConnectionReceiverErrorRequest);
fidl::encoding::Decoder::decode_into::<ScoConnectionReceiverErrorRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
ScoConnectionReceiverControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionReceiverRequest::Error { error: req.error, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ScoConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ScoConnectionReceiverRequest {
Connected {
connection: fidl::endpoints::ClientEnd<ScoConnectionMarker>,
params: ScoConnectionParameters,
control_handle: ScoConnectionReceiverControlHandle,
},
Error { error: ScoErrorCode, control_handle: ScoConnectionReceiverControlHandle },
}
impl ScoConnectionReceiverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connected(
self,
) -> Option<(
fidl::endpoints::ClientEnd<ScoConnectionMarker>,
ScoConnectionParameters,
ScoConnectionReceiverControlHandle,
)> {
if let ScoConnectionReceiverRequest::Connected { connection, params, control_handle } = self
{
Some((connection, params, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_error(self) -> Option<(ScoErrorCode, ScoConnectionReceiverControlHandle)> {
if let ScoConnectionReceiverRequest::Error { error, control_handle } = self {
Some((error, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ScoConnectionReceiverRequest::Connected { .. } => "connected",
ScoConnectionReceiverRequest::Error { .. } => "error",
}
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionReceiverControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ScoConnectionReceiverControlHandle {
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()
}
}
impl ScoConnectionReceiverControlHandle {}
#[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::Time) -> 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::Time,
) -> 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,
}
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<()> {
SearchResultsProxyInterface::r#service_found(self, peer_id, protocol, attributes)
}
}
impl SearchResultsProxyInterface for SearchResultsProxy {
type ServiceFoundResponseFut = fidl::client::QueryResponseFut<()>;
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::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
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,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
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::Decoder::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>,
}
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()
}
}
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<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for A2dpDirectionPriority {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for A2dpDirectionPriority {
#[inline(always)]
fn new_empty() -> Self {
Self::Normal
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioBitsPerSample {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AudioBitsPerSample {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioBitsPerSample {
#[inline(always)]
fn new_empty() -> Self {
Self::Bps16
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioChannelMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AudioChannelMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Mono
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioSamplingFrequency {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AudioSamplingFrequency {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioSamplingFrequency {
#[inline(always)]
fn new_empty() -> Self {
Self::Hz44100
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 ChannelMode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ChannelMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ChannelMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Basic
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 CodingFormat {
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 CodingFormat {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for CodingFormat {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CodingFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::Mulaw
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 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<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for DataPath {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DataPath {
#[inline(always)]
fn new_empty() -> Self {
Self::Host
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for HfpParameterSet {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for HfpParameterSet {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HfpParameterSet {
#[inline(always)]
fn new_empty() -> Self {
Self::T1
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ProtocolIdentifier {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ProtocolIdentifier {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProtocolIdentifier {
#[inline(always)]
fn new_empty() -> Self {
Self::Sdp
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
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<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for RxPacketStatus {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RxPacketStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::CorrectlyReceivedData
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoErrorCode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ScoErrorCode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoErrorCode {
#[inline(always)]
fn new_empty() -> Self {
Self::Failure
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ServiceClassProfileIdentifier {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ServiceClassProfileIdentifier {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ServiceClassProfileIdentifier {
#[inline(always)]
fn new_empty() -> Self {
Self::SerialPort
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
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 {
24
}
}
impl fidl::encoding::ValueTypeMarker for Attribute {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Attribute> for &Attribute {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Attribute>(offset);
fidl::encoding::Encode::<Attribute>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<DataElement as fidl::encoding::ValueTypeMarker>::borrow(&self.element),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<u16>, T1: fidl::encoding::Encode<DataElement>>
fidl::encoding::Encode<Attribute> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Attribute>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Attribute {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u16), element: fidl::new_empty!(DataElement) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(DataElement, &mut self.element, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioDirectionExtSetPriorityRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioDirectionExtSetPriorityRequest>
for &AudioDirectionExtSetPriorityRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDirectionExtSetPriorityRequest>(offset);
fidl::encoding::Encode::<AudioDirectionExtSetPriorityRequest>::encode(
(<A2dpDirectionPriority as fidl::encoding::ValueTypeMarker>::borrow(
&self.priority,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<A2dpDirectionPriority>>
fidl::encoding::Encode<AudioDirectionExtSetPriorityRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDirectionExtSetPriorityRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioDirectionExtSetPriorityRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { priority: fidl::new_empty!(A2dpDirectionPriority) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(A2dpDirectionPriority, &mut self.priority, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
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::Encode<AudioOffloadExtStartAudioOffloadRequest>
for &mut AudioOffloadExtStartAudioOffloadRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
fidl::encoding::Encode::<AudioOffloadExtStartAudioOffloadRequest>::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>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
>,
> fidl::encoding::Encode<AudioOffloadExtStartAudioOffloadRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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> for AudioOffloadExtStartAudioOffloadRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
configuration: fidl::new_empty!(AudioOffloadConfiguration),
controller: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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,
&mut self.configuration,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
&mut self.controller,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
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
}
}
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::Encode<ConnectionReceiverConnectedRequest>
for &mut ConnectionReceiverConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
fidl::encoding::Encode::<ConnectionReceiverConnectedRequest>::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>,
T1: fidl::encoding::Encode<Channel>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
> fidl::encoding::Encode<ConnectionReceiverConnectedRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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> for ConnectionReceiverConnectedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
channel: fidl::new_empty!(Channel),
protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Channel, &mut self.channel, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, &mut self.protocol, decoder, offset + 24, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<L2capParametersExtRequestParametersRequest>
for &L2capParametersExtRequestParametersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersRequest>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersRequest>::encode(
(<ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.request),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<ChannelParameters>>
fidl::encoding::Encode<L2capParametersExtRequestParametersRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for L2capParametersExtRequestParametersRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { request: fidl::new_empty!(ChannelParameters) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ChannelParameters, &mut self.request, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<L2capParametersExtRequestParametersResponse>
for &L2capParametersExtRequestParametersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersResponse>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersResponse>::encode(
(<ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.new),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<ChannelParameters>>
fidl::encoding::Encode<L2capParametersExtRequestParametersResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for L2capParametersExtRequestParametersResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { new: fidl::new_empty!(ChannelParameters) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ChannelParameters, &mut self.new, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MockPeerConnectProxyRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for MockPeerConnectProxyRequest {
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::Encode<MockPeerConnectProxyRequest>
for &mut MockPeerConnectProxyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MockPeerConnectProxyRequest>(offset);
fidl::encoding::Encode::<MockPeerConnectProxyRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProfileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProfileMarker>>,
>,
> fidl::encoding::Encode<MockPeerConnectProxyRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MockPeerConnectProxyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MockPeerConnectProxyRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
interface: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProfileMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProfileMarker>>,
&mut self.interface,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PeerObserverPeerConnectedRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for PeerObserverPeerConnectedRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<PeerObserverPeerConnectedRequest>
for &PeerObserverPeerConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverPeerConnectedRequest>(offset);
fidl::encoding::Encode::<PeerObserverPeerConnectedRequest>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<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>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
> fidl::encoding::Encode<PeerObserverPeerConnectedRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverPeerConnectedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PeerObserverPeerConnectedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, &mut self.protocol, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PeerObserverServiceFoundRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for PeerObserverServiceFoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<PeerObserverServiceFoundRequest>
for &PeerObserverServiceFoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverServiceFoundRequest>(offset);
fidl::encoding::Encode::<PeerObserverServiceFoundRequest>::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<
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<Attribute, 512>>,
> fidl::encoding::Encode<PeerObserverServiceFoundRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverServiceFoundRequest>(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> for PeerObserverServiceFoundRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
protocol: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>
),
attributes: fidl::new_empty!(fidl::encoding::Vector<Attribute, 512>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
&mut self.protocol,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<Attribute, 512>, &mut self.attributes, decoder, offset + 24, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for ProfileConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ProfileConnectRequest> for &ProfileConnectRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectRequest>(offset);
fidl::encoding::Encode::<ProfileConnectRequest>::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<
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId>,
T1: fidl::encoding::Encode<ConnectParameters>,
> fidl::encoding::Encode<ProfileConnectRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for ProfileConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
connection: fidl::new_empty!(ConnectParameters),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ConnectParameters, &mut self.connection, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for ProfileDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ProfileDescriptor> for &ProfileDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileDescriptor>(offset);
fidl::encoding::Encode::<ProfileDescriptor>::encode(
(
<ServiceClassProfileIdentifier as fidl::encoding::ValueTypeMarker>::borrow(
&self.profile_id,
),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.major_version),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.minor_version),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ServiceClassProfileIdentifier>,
T1: fidl::encoding::Encode<u8>,
T2: fidl::encoding::Encode<u8>,
> fidl::encoding::Encode<ProfileDescriptor> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileDescriptor>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 3, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProfileDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
profile_id: fidl::new_empty!(ServiceClassProfileIdentifier),
major_version: fidl::new_empty!(u8),
minor_version: fidl::new_empty!(u8),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
ServiceClassProfileIdentifier,
&mut self.profile_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u8, &mut self.major_version, decoder, offset + 2, _depth)?;
fidl::decode!(u8, &mut self.minor_version, decoder, offset + 3, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileTestRegisterPeerRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileTestRegisterPeerRequest {
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::Encode<ProfileTestRegisterPeerRequest>
for &mut ProfileTestRegisterPeerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileTestRegisterPeerRequest>(offset);
fidl::encoding::Encode::<ProfileTestRegisterPeerRequest>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.peer),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.observer),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>,
>,
> fidl::encoding::Encode<ProfileTestRegisterPeerRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileTestRegisterPeerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProfileTestRegisterPeerRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
peer: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>
),
observer: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>,
&mut self.peer,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>,
&mut self.observer,
decoder,
offset + 12,
_depth
)?;
Ok(())
}
}
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
}
}
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::Encode<ProfileConnectResponse> for &mut ProfileConnectResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
fidl::encoding::Encode::<ProfileConnectResponse>::encode(
(<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Channel>> fidl::encoding::Encode<ProfileConnectResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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> for ProfileConnectResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { channel: fidl::new_empty!(Channel) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Channel, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
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 {
24
}
}
impl fidl::encoding::ValueTypeMarker for ProtocolDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ProtocolDescriptor> for &ProtocolDescriptor {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolDescriptor>(offset);
fidl::encoding::Encode::<ProtocolDescriptor>::encode(
(
<ProtocolIdentifier as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
<fidl::encoding::Vector<DataElement, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProtocolIdentifier>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<DataElement, 255>>,
> fidl::encoding::Encode<ProtocolDescriptor> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolDescriptor>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProtocolDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
protocol: fidl::new_empty!(ProtocolIdentifier),
params: fidl::new_empty!(fidl::encoding::Vector<DataElement, 255>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(ProtocolIdentifier, &mut self.protocol, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<DataElement, 255>, &mut self.params, decoder, offset + 8, _depth)?;
Ok(())
}
}
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 {
24
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionReadResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ScoConnectionReadResponse> for &ScoConnectionReadResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReadResponse>(offset);
fidl::encoding::Encode::<ScoConnectionReadResponse>::encode(
(
<RxPacketStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status_flag),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<RxPacketStatus>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>>,
> fidl::encoding::Encode<ScoConnectionReadResponse> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReadResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoConnectionReadResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
status_flag: fidl::new_empty!(RxPacketStatus),
data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(RxPacketStatus, &mut self.status_flag, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
&mut self.data,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionReceiverConnectedRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for ScoConnectionReceiverConnectedRequest {
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::Encode<ScoConnectionReceiverConnectedRequest>
for &mut ScoConnectionReceiverConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReceiverConnectedRequest>(offset);
fidl::encoding::Encode::<ScoConnectionReceiverConnectedRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
<ScoConnectionParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ScoConnectionMarker>>,
>,
T1: fidl::encoding::Encode<ScoConnectionParameters>,
> fidl::encoding::Encode<ScoConnectionReceiverConnectedRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReceiverConnectedRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoConnectionReceiverConnectedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
connection: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ScoConnectionMarker>>
),
params: fidl::new_empty!(ScoConnectionParameters),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ScoConnectionMarker>>,
&mut self.connection,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ScoConnectionParameters, &mut self.params, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoConnectionReceiverErrorRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionReceiverErrorRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ScoConnectionReceiverErrorRequest>
for &ScoConnectionReceiverErrorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReceiverErrorRequest>(offset);
fidl::encoding::Encode::<ScoConnectionReceiverErrorRequest>::encode(
(<ScoErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.error),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<ScoErrorCode>>
fidl::encoding::Encode<ScoConnectionReceiverErrorRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionReceiverErrorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoConnectionReceiverErrorRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(ScoErrorCode) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ScoErrorCode, &mut self.error, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionWriteRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ScoConnectionWriteRequest> for &ScoConnectionWriteRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionWriteRequest>(offset);
fidl::encoding::Encode::<ScoConnectionWriteRequest>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>>>
fidl::encoding::Encode<ScoConnectionWriteRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoConnectionWriteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoConnectionWriteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for SearchResultsServiceFoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SearchResultsServiceFoundRequest>
for &SearchResultsServiceFoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SearchResultsServiceFoundRequest>(offset);
fidl::encoding::Encode::<SearchResultsServiceFoundRequest>::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<
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<Attribute, 512>>,
> fidl::encoding::Encode<SearchResultsServiceFoundRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for SearchResultsServiceFoundRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId),
protocol: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>
),
attributes: fidl::new_empty!(fidl::encoding::Vector<Attribute, 512>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
&mut self.protocol,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<Attribute, 512>, &mut self.attributes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl AudioAacSupport {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioAacSupport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioAacSupport> for &AudioAacSupport {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for AudioAacSupport {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioOffloadConfiguration> for &AudioOffloadConfiguration {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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>(
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>(
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>(
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>(
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>(
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>(
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>(
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 fidl::encoding::Decode<Self> for AudioOffloadConfiguration {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
fidl::decode!(AudioOffloadFeatures, 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));
fidl::decode!(u16, 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));
fidl::decode!(bool, 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));
fidl::decode!(AudioSamplingFrequency, 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));
fidl::decode!(AudioBitsPerSample, 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));
fidl::decode!(AudioChannelMode, 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));
fidl::decode!(u32, 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));
fidl::decode!(AudioEncoderSettings, 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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadExtGetSupportedFeaturesResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioOffloadExtGetSupportedFeaturesResponse>
for &AudioOffloadExtGetSupportedFeaturesResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>>(
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 fidl::encoding::Decode<Self> for AudioOffloadExtGetSupportedFeaturesResponse {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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>)
});
fidl::decode!(
fidl::encoding::UnboundedVector<AudioOffloadFeatures>,
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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioSbcSupport {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioSbcSupport> for &AudioSbcSupport {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for AudioSbcSupport {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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.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
}
}
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
}
}
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::Encode<Channel> for &mut Channel {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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,
>,
>(
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::<ChannelMode>(
self.channel_mode
.as_ref()
.map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 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>(
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>>>(
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>(
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>>>(
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>>>(
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;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Channel {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, 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 =
<ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode));
fidl::decode!(ChannelMode, 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::decode!(u16, 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::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
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::decode!(i64, 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::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
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::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
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 ChannelParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flush_timeout {
return 4;
}
if let Some(_) = self.security_requirements {
return 3;
}
if let Some(_) = self.max_rx_sdu_size {
return 2;
}
if let Some(_) = self.channel_mode {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelParameters {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ChannelParameters {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChannelParameters> for &ChannelParameters {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelParameters>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ChannelMode>(
self.channel_mode
.as_ref()
.map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16>(
self.max_rx_sdu_size.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<SecurityRequirements>(
self.security_requirements
.as_ref()
.map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64>(
self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ChannelParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode));
fidl::decode!(ChannelMode, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.max_rx_sdu_size.get_or_insert_with(|| fidl::new_empty!(u16));
fidl::decode!(u16, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.security_requirements
.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements));
fidl::decode!(SecurityRequirements, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(i64));
fidl::decode!(i64, 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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for Information {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Information> for &Information {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>>(
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>>(
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>>(
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>>(
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 fidl::encoding::Decode<Self> for Information {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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>));
fidl::decode!(
fidl::encoding::BoundedString<2>,
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>));
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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>));
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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>));
fidl::decode!(
fidl::encoding::BoundedString<1024>,
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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for L2capParameters {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<L2capParameters> for &L2capParameters {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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::<ChannelParameters>(
self.parameters
.as_ref()
.map(<ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for L2capParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
fidl::decode!(u16, 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 =
<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!(ChannelParameters));
fidl::decode!(ChannelParameters, 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
}
}
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
}
}
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::Encode<ProfileAdvertiseRequest> for &mut ProfileAdvertiseRequest {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>>(
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>>>(
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::<ChannelParameters>(
self.parameters
.as_ref()
.map(<ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProfileAdvertiseRequest {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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::decode!(fidl::encoding::Vector<ServiceDefinition, 32>, 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::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
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 =
<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!(ChannelParameters));
fidl::decode!(ChannelParameters, 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.receiver {
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
}
}
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
}
}
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::Encode<ProfileConnectScoRequest> for &mut ProfileConnectScoRequest {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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>(
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>>(
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::ClientEnd<ScoConnectionReceiverMarker>>,
>(
self.receiver.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ScoConnectionReceiverMarker>,
> 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> for ProfileConnectScoRequest {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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::decode!(
fidl_fuchsia_bluetooth::PeerId,
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::decode!(bool, 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::decode!(
fidl::encoding::UnboundedVector<ScoConnectionParameters>,
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<ScoConnectionReceiverMarker>,
> 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<ScoConnectionReceiverMarker>,
>
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ScoConnectionReceiverMarker>,
>,
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.results {
return 3;
}
if let Some(_) = self.attr_ids {
return 2;
}
if let Some(_) = self.service_uuid {
return 1;
}
0
}
}
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
}
}
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::Encode<ProfileSearchRequest> for &mut ProfileSearchRequest {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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>>(
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>>>(
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;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProfileSearchRequest {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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::decode!(
ServiceClassProfileIdentifier,
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::decode!(fidl::encoding::Vector<u16, 512>, 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::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for RfcommParameters {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RfcommParameters> for &RfcommParameters {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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 fidl::encoding::Decode<Self> for RfcommParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
fidl::decode!(u8, 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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for ScoConnectionParameters {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ScoConnectionParameters> for &ScoConnectionParameters {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
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::<CodingFormat>(
self.air_coding_format
.as_ref()
.map(<CodingFormat 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>(
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>(
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::<CodingFormat>(
self.io_coding_format
.as_ref()
.map(<CodingFormat 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>(
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>(
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>(
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>(
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>(
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 fidl::encoding::Decode<Self> for ScoConnectionParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
fidl::decode!(HfpParameterSet, 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 =
<CodingFormat 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!(CodingFormat));
fidl::decode!(CodingFormat, 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));
fidl::decode!(u16, 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));
fidl::decode!(u32, 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 =
<CodingFormat 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!(CodingFormat));
fidl::decode!(CodingFormat, 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));
fidl::decode!(u16, 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)
});
fidl::decode!(
fidl_fuchsia_hardware_audio::SampleFormat,
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));
fidl::decode!(u8, 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));
fidl::decode!(DataPath, 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));
fidl::decode!(u16, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl SecurityRequirements {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.secure_connections_required {
return 2;
}
if let Some(_) = self.authentication_required {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SecurityRequirements> for &SecurityRequirements {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityRequirements>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.authentication_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.secure_connections_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SecurityRequirements {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.secure_connections_required.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, 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
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for ServiceDefinition {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ServiceDefinition> for &ServiceDefinition {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>>(
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>>(
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>>(
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>>(
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>>(
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>>(
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 fidl::encoding::Decode<Self> for ServiceDefinition {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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>),
);
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 255>, 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>),
);
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, 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,
>
)
});
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::Vector<ProtocolDescriptor, 255>, 255>,
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>),
);
fidl::decode!(fidl::encoding::Vector<ProfileDescriptor, 255>, 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>),
);
fidl::decode!(fidl::encoding::Vector<Information, 85>, 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>),
);
fidl::decode!(fidl::encoding::Vector<Attribute, 65023>, 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(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioEncoderSettings> for &AudioEncoderSettings {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
<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>(
<fidl_fuchsia_media::AacEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
AudioEncoderSettings::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for AudioEncoderSettings {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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
));
}
#[allow(irrefutable_let_patterns)]
if let AudioEncoderSettings::Sbc(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_media::SbcEncoderSettings,
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
));
}
#[allow(irrefutable_let_patterns)]
if let AudioEncoderSettings::Aac(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_media::AacEncoderSettings,
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(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for AudioOffloadFeatures {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioOffloadFeatures> for &AudioOffloadFeatures {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
<AudioSbcSupport as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioOffloadFeatures::Aac(ref val) => {
fidl::encoding::encode_in_envelope::<AudioAacSupport>(
<AudioAacSupport as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioOffloadFeatures::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for AudioOffloadFeatures {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
}
#[allow(irrefutable_let_patterns)]
if let AudioOffloadFeatures::Sbc(ref mut val) = self {
fidl::decode!(AudioSbcSupport, 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));
}
#[allow(irrefutable_let_patterns)]
if let AudioOffloadFeatures::Aac(ref mut val) = self {
fidl::decode!(AudioAacSupport, 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(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for ConnectParameters {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ConnectParameters> for &ConnectParameters {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
<L2capParameters as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ConnectParameters::Rfcomm(ref val) => {
fidl::encoding::encode_in_envelope::<RfcommParameters>(
<RfcommParameters as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl fidl::encoding::Decode<Self> for ConnectParameters {
#[inline(always)]
fn new_empty() -> Self {
Self::L2cap(fidl::new_empty!(L2capParameters))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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));
}
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::L2cap(ref mut val) = self {
fidl::decode!(L2capParameters, 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));
}
#[allow(irrefutable_let_patterns)]
if let ConnectParameters::Rfcomm(ref mut val) = self {
fidl::decode!(RfcommParameters, 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(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for DataElement {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DataElement> for &DataElement {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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>(
<i8 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int16(ref val) => {
fidl::encoding::encode_in_envelope::<i16>(
<i16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int32(ref val) => {
fidl::encoding::encode_in_envelope::<i32>(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Int64(ref val) => {
fidl::encoding::encode_in_envelope::<i64>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint8(ref val) => {
fidl::encoding::encode_in_envelope::<u8>(
<u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint16(ref val) => {
fidl::encoding::encode_in_envelope::<u16>(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint32(ref val) => {
fidl::encoding::encode_in_envelope::<u32>(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::Uint64(ref val) => {
fidl::encoding::encode_in_envelope::<u64>(
<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>>(
<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>>(
<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>(
<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataElement::B(ref val) => {
fidl::encoding::encode_in_envelope::<bool>(
<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>>(
<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>>(
<fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl fidl::encoding::Decode<Self> for DataElement {
#[inline(always)]
fn new_empty() -> Self {
Self::Int8(fidl::new_empty!(i8))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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),
_ => 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 DataElement::Int8(_) = self {
} else {
*self = DataElement::Int8(fidl::new_empty!(i8));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int8(ref mut val) = self {
fidl::decode!(i8, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int16(ref mut val) = self {
fidl::decode!(i16, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int32(ref mut val) = self {
fidl::decode!(i32, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Int64(ref mut val) = self {
fidl::decode!(i64, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint8(ref mut val) = self {
fidl::decode!(u8, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint16(ref mut val) = self {
fidl::decode!(u16, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint32(ref mut val) = self {
fidl::decode!(u32, 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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uint64(ref mut val) = self {
fidl::decode!(u64, 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>));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Str(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 1024>, 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>));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Url(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<4096>,
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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Uuid(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
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));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::B(ref mut val) = self {
fidl::decode!(bool, 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>
));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Sequence(ref mut val) = self {
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
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>
));
}
#[allow(irrefutable_let_patterns)]
if let DataElement::Alternatives(ref mut val) = self {
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::OptionalUnion<DataElement>, 255>,
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(())
}
}
}