#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type LocalKey = Key;
pub const MAX_PEER_SERVICES: u16 = 65535;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum BondableMode {
Bondable = 1,
NonBondable = 2,
}
impl BondableMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Bondable),
2 => Some(Self::NonBondable),
_ => 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(u32)]
pub enum BootstrapError {
InvalidHostIdentity = 1,
WriteFailure = 2,
}
impl BootstrapError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidHostIdentity),
2 => Some(Self::WriteFailure),
_ => 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(u32)]
pub enum BrEdrSecurityMode {
Mode4 = 1,
SecureConnectionsOnly = 2,
}
impl BrEdrSecurityMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Mode4),
2 => Some(Self::SecureConnectionsOnly),
_ => 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(u32)]
pub enum Error {
Failed = 1,
PeerNotFound = 2,
TimedOut = 3,
Canceled = 4,
InProgress = 5,
NotSupported = 6,
InvalidArguments = 7,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Failed),
2 => Some(Self::PeerNotFound),
3 => Some(Self::TimedOut),
4 => Some(Self::Canceled),
5 => Some(Self::InProgress),
6 => Some(Self::NotSupported),
7 => Some(Self::InvalidArguments),
_ => 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(u32)]
pub enum InputCapability {
None = 1,
Confirmation = 2,
Keyboard = 3,
}
impl InputCapability {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::None),
2 => Some(Self::Confirmation),
3 => Some(Self::Keyboard),
_ => 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(u32)]
pub enum LeSecurityMode {
Mode1 = 1,
SecureConnectionsOnly = 2,
}
impl LeSecurityMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Mode1),
2 => Some(Self::SecureConnectionsOnly),
_ => 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(u32)]
pub enum OutputCapability {
None = 1,
Display = 2,
}
impl OutputCapability {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::None),
2 => Some(Self::Display),
_ => 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(u32)]
pub enum PairingKeypress {
DigitEntered = 1,
DigitErased = 2,
PasskeyCleared = 3,
PasskeyEntered = 4,
}
impl PairingKeypress {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DigitEntered),
2 => Some(Self::DigitErased),
3 => Some(Self::PasskeyCleared),
4 => Some(Self::PasskeyEntered),
_ => 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(u32)]
pub enum PairingMethod {
Consent = 1,
PasskeyDisplay = 2,
PasskeyComparison = 3,
PasskeyEntry = 4,
}
impl PairingMethod {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Consent),
2 => Some(Self::PasskeyDisplay),
3 => Some(Self::PasskeyComparison),
4 => Some(Self::PasskeyEntry),
_ => 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(u32)]
pub enum PairingSecurityLevel {
Encrypted = 1,
Authenticated = 2,
}
impl PairingSecurityLevel {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Encrypted),
2 => Some(Self::Authenticated),
_ => 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(u32)]
pub enum TechnologyType {
LowEnergy = 1,
Classic = 2,
DualMode = 3,
}
impl TechnologyType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::LowEnergy),
2 => Some(Self::Classic),
3 => Some(Self::DualMode),
_ => 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(Clone, Debug, PartialEq)]
pub struct AccessConnectRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for AccessConnectRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct AccessDisconnectRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for AccessDisconnectRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct AccessForgetRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for AccessForgetRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AccessMakeDiscoverableRequest {
pub token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessMakeDiscoverableRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct AccessPairRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub options: PairingOptions,
}
impl fidl::Persistable for AccessPairRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct AccessSetDeviceClassRequest {
pub device_class: fidl_fuchsia_bluetooth::DeviceClass,
}
impl fidl::Persistable for AccessSetDeviceClassRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AccessSetLocalNameRequest {
pub name: String,
}
impl fidl::Persistable for AccessSetLocalNameRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AccessSetPairingDelegateRequest {
pub input: InputCapability,
pub output: OutputCapability,
pub delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessSetPairingDelegateRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AccessStartDiscoveryRequest {
pub token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessStartDiscoveryRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct AccessWatchPeersResponse {
pub updated: Vec<Peer>,
pub removed: Vec<fidl_fuchsia_bluetooth::PeerId>,
}
impl fidl::Persistable for AccessWatchPeersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct BootstrapAddIdentitiesRequest {
pub identities: Vec<Identity>,
}
impl fidl::Persistable for BootstrapAddIdentitiesRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ConfigurationUpdateRequest {
pub settings: Settings,
}
impl fidl::Persistable for ConfigurationUpdateRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ConfigurationUpdateResponse {
pub result: Settings,
}
impl fidl::Persistable for ConfigurationUpdateResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Consent;
impl fidl::Persistable for Consent {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostWatcherSetActiveRequest {
pub id: fidl_fuchsia_bluetooth::HostId,
}
impl fidl::Persistable for HostWatcherSetActiveRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostWatcherWatchResponse {
pub hosts: Vec<HostInfo>,
}
impl fidl::Persistable for HostWatcherWatchResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Key {
pub value: [u8; 16],
}
impl fidl::Persistable for Key {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LeConnectionParameters {
pub connection_interval: u16,
pub connection_latency: u16,
pub supervision_timeout: u16,
}
impl fidl::Persistable for LeConnectionParameters {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Ltk {
pub key: PeerKey,
pub ediv: u16,
pub rand: u64,
}
impl fidl::Persistable for Ltk {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingDelegate2RequestCompleteRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub success: bool,
}
impl fidl::Persistable for PairingDelegate2RequestCompleteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingDelegateOnLocalKeypressRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub keypress: PairingKeypress,
}
impl fidl::Persistable for PairingDelegateOnLocalKeypressRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingDelegateOnPairingCompleteRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub success: bool,
}
impl fidl::Persistable for PairingDelegateOnPairingCompleteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingDelegateOnPairingRequestRequest {
pub peer: Peer,
pub method: PairingMethod,
pub displayed_passkey: u32,
}
impl fidl::Persistable for PairingDelegateOnPairingRequestRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingDelegateOnPairingRequestResponse {
pub accept: bool,
pub entered_passkey: u32,
}
impl fidl::Persistable for PairingDelegateOnPairingRequestResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingDelegateOnRemoteKeypressRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub keypress: PairingKeypress,
}
impl fidl::Persistable for PairingDelegateOnRemoteKeypressRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingRequestKeypressRequest {
pub keypress: PairingKeypress,
}
impl fidl::Persistable for PairingRequestKeypressRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingRequestOnCompleteRequest {
pub success: bool,
}
impl fidl::Persistable for PairingRequestOnCompleteRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingRequestOnKeypressRequest {
pub keypress: PairingKeypress,
}
impl fidl::Persistable for PairingRequestOnKeypressRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingSetDelegateRequest {
pub input: InputCapability,
pub output: OutputCapability,
pub delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PairingSetDelegateRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PairingSetPairingDelegateRequest {
pub input: InputCapability,
pub output: OutputCapability,
pub delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PairingSetPairingDelegateRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PasskeyEntry;
impl fidl::Persistable for PasskeyEntry {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerKey {
pub security: SecurityProperties,
pub data: Key,
}
impl fidl::Persistable for PeerKey {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SecurityProperties {
pub authenticated: bool,
pub secure_connections: bool,
pub encryption_key_size: u8,
}
impl fidl::Persistable for SecurityProperties {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BondingData {
pub identifier: Option<fidl_fuchsia_bluetooth::PeerId>,
pub local_address: Option<fidl_fuchsia_bluetooth::Address>,
pub name: Option<String>,
pub address: Option<fidl_fuchsia_bluetooth::Address>,
pub le_bond: Option<LeBondData>,
pub bredr_bond: Option<BredrBondData>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for BondingData {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BredrBondData {
pub role_preference: Option<fidl_fuchsia_bluetooth::ConnectionRole>,
pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub link_key: Option<PeerKey>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for BredrBondData {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HostData {
pub irk: Option<Key>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for HostData {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HostInfo {
pub id: Option<fidl_fuchsia_bluetooth::HostId>,
pub technology: Option<TechnologyType>,
pub active: Option<bool>,
pub local_name: Option<String>,
pub discoverable: Option<bool>,
pub discovering: Option<bool>,
pub addresses: Option<Vec<fidl_fuchsia_bluetooth::Address>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for HostInfo {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Identity {
pub host: Option<HostData>,
pub bonds: Option<Vec<BondingData>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Identity {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LeBondData {
pub connection_parameters: Option<LeConnectionParameters>,
pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub irk: Option<PeerKey>,
pub csrk: Option<PeerKey>,
pub peer_ltk: Option<Ltk>,
pub local_ltk: Option<Ltk>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LeBondData {}
#[derive(Debug, Default, PartialEq)]
pub struct PairingDelegate2StartRequestRequest {
pub peer: Option<Peer>,
pub info: Option<PairingProperties>,
pub request: Option<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PairingDelegate2StartRequestRequest
{
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PairingOptions {
pub le_security_level: Option<PairingSecurityLevel>,
pub bondable_mode: Option<BondableMode>,
pub transport: Option<TechnologyType>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PairingOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PairingRequestAcceptRequest {
pub entered_passkey: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PairingRequestAcceptRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Peer {
pub id: Option<fidl_fuchsia_bluetooth::PeerId>,
pub address: Option<fidl_fuchsia_bluetooth::Address>,
pub technology: Option<TechnologyType>,
pub connected: Option<bool>,
pub bonded: Option<bool>,
pub name: Option<String>,
pub appearance: Option<fidl_fuchsia_bluetooth::Appearance>,
pub device_class: Option<fidl_fuchsia_bluetooth::DeviceClass>,
pub rssi: Option<i8>,
pub tx_power: Option<i8>,
pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub le_services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub bredr_services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Peer {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Settings {
pub le_privacy: Option<bool>,
pub le_background_scan: Option<bool>,
pub bredr_connectable_mode: Option<bool>,
pub le_security_mode: Option<LeSecurityMode>,
pub bredr_security_mode: Option<BrEdrSecurityMode>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Settings {}
#[derive(Clone, Debug)]
pub enum PairingProperties {
Consent(Consent),
PasskeyDisplay(u32),
PasskeyConfirmation(u32),
PasskeyEntry(PasskeyEntry),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! PairingPropertiesUnknown {
() => {
_
};
}
impl PartialEq for PairingProperties {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Consent(x), Self::Consent(y)) => *x == *y,
(Self::PasskeyDisplay(x), Self::PasskeyDisplay(y)) => *x == *y,
(Self::PasskeyConfirmation(x), Self::PasskeyConfirmation(y)) => *x == *y,
(Self::PasskeyEntry(x), Self::PasskeyEntry(y)) => *x == *y,
_ => false,
}
}
}
impl PairingProperties {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Consent(_) => 1,
Self::PasskeyDisplay(_) => 2,
Self::PasskeyConfirmation(_) => 3,
Self::PasskeyEntry(_) => 4,
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 PairingProperties {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AccessMarker;
impl fidl::endpoints::ProtocolMarker for AccessMarker {
type Proxy = AccessProxy;
type RequestStream = AccessRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AccessSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Access";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AccessMarker {}
pub type AccessMakeDiscoverableResult = Result<(), Error>;
pub type AccessStartDiscoveryResult = Result<(), Error>;
pub type AccessConnectResult = Result<(), Error>;
pub type AccessDisconnectResult = Result<(), Error>;
pub type AccessPairResult = Result<(), Error>;
pub type AccessForgetResult = Result<(), Error>;
pub trait AccessProxyInterface: Send + Sync {
fn r#set_pairing_delegate(
&self,
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error>;
fn r#set_local_name(&self, name: &str) -> Result<(), fidl::Error>;
fn r#set_device_class(
&self,
device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Result<(), fidl::Error>;
type MakeDiscoverableResponseFut: std::future::Future<Output = Result<AccessMakeDiscoverableResult, fidl::Error>>
+ Send;
fn r#make_discoverable(
&self,
token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> Self::MakeDiscoverableResponseFut;
type StartDiscoveryResponseFut: std::future::Future<Output = Result<AccessStartDiscoveryResult, fidl::Error>>
+ Send;
fn r#start_discovery(
&self,
token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> Self::StartDiscoveryResponseFut;
type WatchPeersResponseFut: std::future::Future<
Output = Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error>,
> + Send;
fn r#watch_peers(&self) -> Self::WatchPeersResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<AccessConnectResult, fidl::Error>>
+ Send;
fn r#connect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut;
type DisconnectResponseFut: std::future::Future<Output = Result<AccessDisconnectResult, fidl::Error>>
+ Send;
fn r#disconnect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut;
type PairResponseFut: std::future::Future<Output = Result<AccessPairResult, fidl::Error>> + Send;
fn r#pair(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
options: &PairingOptions,
) -> Self::PairResponseFut;
type ForgetResponseFut: std::future::Future<Output = Result<AccessForgetResult, fidl::Error>>
+ Send;
fn r#forget(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AccessSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AccessSynchronousProxy {
type Proxy = AccessProxy;
type Protocol = AccessMarker;
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 AccessSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<AccessEvent, fidl::Error> {
AccessEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AccessSetPairingDelegateRequest>(
(input, output, delegate),
0x4af398e1f4cdb40b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<AccessSetLocalNameRequest>(
(name,),
0x7d12cd2d902206eb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Result<(), fidl::Error> {
self.client.send::<AccessSetDeviceClassRequest>(
(device_class,),
0x58dd8f65f589035d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#make_discoverable(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
let _response = self.client.send_query::<
AccessMakeDiscoverableRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(token,),
0x747cadf609c96fb1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#start_discovery(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<AccessStartDiscoveryResult, fidl::Error> {
let _response = self.client.send_query::<
AccessStartDiscoveryRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(token,),
0x6907100d9b99439,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#watch_peers(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, AccessWatchPeersResponse>(
(),
0x1921fe1ed8e6eb7c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.updated, _response.removed))
}
pub fn r#connect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<AccessConnectResult, fidl::Error> {
let _response = self.client.send_query::<AccessConnectRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
(id,),
0x1734199789fe7667,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#disconnect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<AccessDisconnectResult, fidl::Error> {
let _response = self.client.send_query::<
AccessDisconnectRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(id,),
0x3a4e06d0c6185a5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &PairingOptions,
___deadline: zx::MonotonicInstant,
) -> Result<AccessPairResult, fidl::Error> {
let _response = self.client.send_query::<AccessPairRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
(id, options),
0x1d08ea19db327779,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#forget(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<AccessForgetResult, fidl::Error> {
let _response = self.client.send_query::<AccessForgetRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
(id,),
0x1fd8e27202854c0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct AccessProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AccessProxy {
type Protocol = AccessMarker;
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 AccessProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AccessEventStream {
AccessEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
AccessProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
}
pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
AccessProxyInterface::r#set_local_name(self, name)
}
pub fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Result<(), fidl::Error> {
AccessProxyInterface::r#set_device_class(self, device_class)
}
pub fn r#make_discoverable(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> fidl::client::QueryResponseFut<
AccessMakeDiscoverableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#make_discoverable(self, token)
}
pub fn r#start_discovery(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> fidl::client::QueryResponseFut<
AccessStartDiscoveryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#start_discovery(self, token)
}
pub fn r#watch_peers(
&self,
) -> fidl::client::QueryResponseFut<
(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#watch_peers(self)
}
pub fn r#connect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
AccessConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#connect(self, id)
}
pub fn r#disconnect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
AccessDisconnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#disconnect(self, id)
}
pub fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &PairingOptions,
) -> fidl::client::QueryResponseFut<
AccessPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#pair(self, id, options)
}
pub fn r#forget(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
AccessForgetResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AccessProxyInterface::r#forget(self, id)
}
}
impl AccessProxyInterface for AccessProxy {
fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AccessSetPairingDelegateRequest>(
(input, output, delegate),
0x4af398e1f4cdb40b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<AccessSetLocalNameRequest>(
(name,),
0x7d12cd2d902206eb,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Result<(), fidl::Error> {
self.client.send::<AccessSetDeviceClassRequest>(
(device_class,),
0x58dd8f65f589035d,
fidl::encoding::DynamicFlags::empty(),
)
}
type MakeDiscoverableResponseFut = fidl::client::QueryResponseFut<
AccessMakeDiscoverableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#make_discoverable(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> Self::MakeDiscoverableResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x747cadf609c96fb1,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<AccessMakeDiscoverableRequest, AccessMakeDiscoverableResult>(
(token,),
0x747cadf609c96fb1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartDiscoveryResponseFut = fidl::client::QueryResponseFut<
AccessStartDiscoveryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start_discovery(
&self,
mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
) -> Self::StartDiscoveryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessStartDiscoveryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6907100d9b99439,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<AccessStartDiscoveryRequest, AccessStartDiscoveryResult>(
(token,),
0x6907100d9b99439,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchPeersResponseFut = fidl::client::QueryResponseFut<
(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_peers(&self) -> Self::WatchPeersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AccessWatchPeersResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1921fe1ed8e6eb7c,
>(_buf?)?;
Ok((_response.updated, _response.removed))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
>(
(),
0x1921fe1ed8e6eb7c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
AccessConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1734199789fe7667,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AccessConnectRequest, AccessConnectResult>(
(id,),
0x1734199789fe7667,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DisconnectResponseFut = fidl::client::QueryResponseFut<
AccessDisconnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessDisconnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3a4e06d0c6185a5,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AccessDisconnectRequest, AccessDisconnectResult>(
(id,),
0x3a4e06d0c6185a5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PairResponseFut = fidl::client::QueryResponseFut<
AccessPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &PairingOptions,
) -> Self::PairResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessPairResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1d08ea19db327779,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AccessPairRequest, AccessPairResult>(
(id, options),
0x1d08ea19db327779,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ForgetResponseFut = fidl::client::QueryResponseFut<
AccessForgetResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AccessForgetResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1fd8e27202854c0,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AccessForgetRequest, AccessForgetResult>(
(id,),
0x1fd8e27202854c0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AccessEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AccessEventStream {}
impl futures::stream::FusedStream for AccessEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AccessEventStream {
type Item = Result<AccessEvent, 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(AccessEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AccessEvent {}
impl AccessEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AccessEvent, 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: <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AccessRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AccessRequestStream {}
impl futures::stream::FusedStream for AccessRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AccessRequestStream {
type Protocol = AccessMarker;
type ControlHandle = AccessControlHandle;
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 {
AccessControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for AccessRequestStream {
type Item = Result<AccessRequest, 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 AccessRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4af398e1f4cdb40b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AccessSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::SetPairingDelegate {
input: req.input,
output: req.output,
delegate: req.delegate,
control_handle,
})
}
0x7d12cd2d902206eb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AccessSetLocalNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::SetLocalName { name: req.name, control_handle })
}
0x58dd8f65f589035d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AccessSetDeviceClassRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::SetDeviceClass {
device_class: req.device_class,
control_handle,
})
}
0x747cadf609c96fb1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessMakeDiscoverableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessMakeDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::MakeDiscoverable {
token: req.token,
responder: AccessMakeDiscoverableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6907100d9b99439 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessStartDiscoveryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::StartDiscovery {
token: req.token,
responder: AccessStartDiscoveryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1921fe1ed8e6eb7c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::WatchPeers {
responder: AccessWatchPeersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1734199789fe7667 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::Connect {
id: req.id,
responder: AccessConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a4e06d0c6185a5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessDisconnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::Disconnect {
id: req.id,
responder: AccessDisconnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1d08ea19db327779 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessPairRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPairRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::Pair {
id: req.id,
options: req.options,
responder: AccessPairResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1fd8e27202854c0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AccessForgetRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessForgetRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AccessControlHandle { inner: this.inner.clone() };
Ok(AccessRequest::Forget {
id: req.id,
responder: AccessForgetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AccessRequest {
SetPairingDelegate {
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
control_handle: AccessControlHandle,
},
SetLocalName { name: String, control_handle: AccessControlHandle },
SetDeviceClass {
device_class: fidl_fuchsia_bluetooth::DeviceClass,
control_handle: AccessControlHandle,
},
MakeDiscoverable {
token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
responder: AccessMakeDiscoverableResponder,
},
StartDiscovery {
token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
responder: AccessStartDiscoveryResponder,
},
WatchPeers { responder: AccessWatchPeersResponder },
Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessConnectResponder },
Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessDisconnectResponder },
Pair {
id: fidl_fuchsia_bluetooth::PeerId,
options: PairingOptions,
responder: AccessPairResponder,
},
Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessForgetResponder },
}
impl AccessRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_pairing_delegate(
self,
) -> Option<(
InputCapability,
OutputCapability,
fidl::endpoints::ClientEnd<PairingDelegateMarker>,
AccessControlHandle,
)> {
if let AccessRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
{
Some((input, output, delegate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_local_name(self) -> Option<(String, AccessControlHandle)> {
if let AccessRequest::SetLocalName { name, control_handle } = self {
Some((name, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_device_class(
self,
) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, AccessControlHandle)> {
if let AccessRequest::SetDeviceClass { device_class, control_handle } = self {
Some((device_class, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_make_discoverable(
self,
) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessMakeDiscoverableResponder)>
{
if let AccessRequest::MakeDiscoverable { token, responder } = self {
Some((token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_discovery(
self,
) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessStartDiscoveryResponder)>
{
if let AccessRequest::StartDiscovery { token, responder } = self {
Some((token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_peers(self) -> Option<(AccessWatchPeersResponder)> {
if let AccessRequest::WatchPeers { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessConnectResponder)> {
if let AccessRequest::Connect { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_disconnect(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessDisconnectResponder)> {
if let AccessRequest::Disconnect { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pair(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingOptions, AccessPairResponder)> {
if let AccessRequest::Pair { id, options, responder } = self {
Some((id, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessForgetResponder)> {
if let AccessRequest::Forget { id, responder } = self {
Some((id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AccessRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
AccessRequest::SetLocalName { .. } => "set_local_name",
AccessRequest::SetDeviceClass { .. } => "set_device_class",
AccessRequest::MakeDiscoverable { .. } => "make_discoverable",
AccessRequest::StartDiscovery { .. } => "start_discovery",
AccessRequest::WatchPeers { .. } => "watch_peers",
AccessRequest::Connect { .. } => "connect",
AccessRequest::Disconnect { .. } => "disconnect",
AccessRequest::Pair { .. } => "pair",
AccessRequest::Forget { .. } => "forget",
}
}
}
#[derive(Debug, Clone)]
pub struct AccessControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AccessControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl AccessControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessMakeDiscoverableResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessMakeDiscoverableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessMakeDiscoverableResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessMakeDiscoverableResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x747cadf609c96fb1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessStartDiscoveryResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessStartDiscoveryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessStartDiscoveryResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessStartDiscoveryResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x6907100d9b99439,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessWatchPeersResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessWatchPeersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessWatchPeersResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessWatchPeersResponder {
pub fn send(
self,
mut updated: &[Peer],
mut removed: &[fidl_fuchsia_bluetooth::PeerId],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(updated, removed);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut updated: &[Peer],
mut removed: &[fidl_fuchsia_bluetooth::PeerId],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(updated, removed);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut updated: &[Peer],
mut removed: &[fidl_fuchsia_bluetooth::PeerId],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AccessWatchPeersResponse>(
(updated, removed),
self.tx_id,
0x1921fe1ed8e6eb7c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessConnectResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessConnectResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessConnectResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x1734199789fe7667,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessDisconnectResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessDisconnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessDisconnectResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessDisconnectResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x3a4e06d0c6185a5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessPairResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessPairResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessPairResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessPairResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x1d08ea19db327779,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AccessForgetResponder {
control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AccessForgetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AccessForgetResponder {
type ControlHandle = AccessControlHandle;
fn control_handle(&self) -> &AccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AccessForgetResponder {
pub fn send(self, mut result: Result<(), Error>) -> 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<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x1fd8e27202854c0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BootstrapMarker;
impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
type Proxy = BootstrapProxy;
type RequestStream = BootstrapRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BootstrapSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Bootstrap";
}
impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
pub type BootstrapCommitResult = Result<(), BootstrapError>;
pub trait BootstrapProxyInterface: Send + Sync {
fn r#add_identities(&self, identities: &[Identity]) -> Result<(), fidl::Error>;
type CommitResponseFut: std::future::Future<Output = Result<BootstrapCommitResult, fidl::Error>>
+ Send;
fn r#commit(&self) -> Self::CommitResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BootstrapSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
type Proxy = BootstrapProxy;
type Protocol = BootstrapMarker;
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 BootstrapSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<BootstrapEvent, fidl::Error> {
BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
self.client.send::<BootstrapAddIdentitiesRequest>(
(identities,),
0x92d7c849de29bb0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#commit(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<BootstrapCommitResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
>(
(),
0x5288006c9c7db6b7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct BootstrapProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for BootstrapProxy {
type Protocol = BootstrapMarker;
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 BootstrapProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BootstrapEventStream {
BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
BootstrapProxyInterface::r#add_identities(self, identities)
}
pub fn r#commit(
&self,
) -> fidl::client::QueryResponseFut<
BootstrapCommitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BootstrapProxyInterface::r#commit(self)
}
}
impl BootstrapProxyInterface for BootstrapProxy {
fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
self.client.send::<BootstrapAddIdentitiesRequest>(
(identities,),
0x92d7c849de29bb0,
fidl::encoding::DynamicFlags::empty(),
)
}
type CommitResponseFut = fidl::client::QueryResponseFut<
BootstrapCommitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#commit(&self) -> Self::CommitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<BootstrapCommitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5288006c9c7db6b7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BootstrapCommitResult>(
(),
0x5288006c9c7db6b7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BootstrapEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for BootstrapEventStream {}
impl futures::stream::FusedStream for BootstrapEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BootstrapEventStream {
type Item = Result<BootstrapEvent, 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(BootstrapEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BootstrapEvent {}
impl BootstrapEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<BootstrapEvent, 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: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BootstrapRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for BootstrapRequestStream {}
impl futures::stream::FusedStream for BootstrapRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BootstrapRequestStream {
type Protocol = BootstrapMarker;
type ControlHandle = BootstrapControlHandle;
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 {
BootstrapControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BootstrapRequestStream {
type Item = Result<BootstrapRequest, 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 BootstrapRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x92d7c849de29bb0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
BootstrapAddIdentitiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapAddIdentitiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
Ok(BootstrapRequest::AddIdentities {
identities: req.identities,
control_handle,
})
}
0x5288006c9c7db6b7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
Ok(BootstrapRequest::Commit {
responder: BootstrapCommitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum BootstrapRequest {
AddIdentities { identities: Vec<Identity>, control_handle: BootstrapControlHandle },
Commit { responder: BootstrapCommitResponder },
}
impl BootstrapRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_identities(self) -> Option<(Vec<Identity>, BootstrapControlHandle)> {
if let BootstrapRequest::AddIdentities { identities, control_handle } = self {
Some((identities, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_commit(self) -> Option<(BootstrapCommitResponder)> {
if let BootstrapRequest::Commit { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BootstrapRequest::AddIdentities { .. } => "add_identities",
BootstrapRequest::Commit { .. } => "commit",
}
}
}
#[derive(Debug, Clone)]
pub struct BootstrapControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl BootstrapControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BootstrapCommitResponder {
control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BootstrapCommitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BootstrapCommitResponder {
type ControlHandle = BootstrapControlHandle;
fn control_handle(&self) -> &BootstrapControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BootstrapCommitResponder {
pub fn send(self, mut result: Result<(), BootstrapError>) -> 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<(), BootstrapError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BootstrapError,
>>(
result,
self.tx_id,
0x5288006c9c7db6b7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConfigurationMarker;
impl fidl::endpoints::ProtocolMarker for ConfigurationMarker {
type Proxy = ConfigurationProxy;
type RequestStream = ConfigurationRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConfigurationSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Configuration";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurationMarker {}
pub trait ConfigurationProxyInterface: Send + Sync {
type UpdateResponseFut: std::future::Future<Output = Result<Settings, fidl::Error>> + Send;
fn r#update(&self, settings: &Settings) -> Self::UpdateResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConfigurationSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConfigurationSynchronousProxy {
type Proxy = ConfigurationProxy;
type Protocol = ConfigurationMarker;
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 ConfigurationSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ConfigurationEvent, fidl::Error> {
ConfigurationEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#update(
&self,
mut settings: &Settings,
___deadline: zx::MonotonicInstant,
) -> Result<Settings, fidl::Error> {
let _response =
self.client.send_query::<ConfigurationUpdateRequest, ConfigurationUpdateResponse>(
(settings,),
0x27e9cfb72e7c6d01,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.result)
}
}
#[derive(Debug, Clone)]
pub struct ConfigurationProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ConfigurationProxy {
type Protocol = ConfigurationMarker;
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 ConfigurationProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConfigurationEventStream {
ConfigurationEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#update(
&self,
mut settings: &Settings,
) -> fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>
{
ConfigurationProxyInterface::r#update(self, settings)
}
}
impl ConfigurationProxyInterface for ConfigurationProxy {
type UpdateResponseFut =
fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#update(&self, mut settings: &Settings) -> Self::UpdateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Settings, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ConfigurationUpdateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x27e9cfb72e7c6d01,
>(_buf?)?;
Ok(_response.result)
}
self.client.send_query_and_decode::<ConfigurationUpdateRequest, Settings>(
(settings,),
0x27e9cfb72e7c6d01,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ConfigurationEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ConfigurationEventStream {}
impl futures::stream::FusedStream for ConfigurationEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConfigurationEventStream {
type Item = Result<ConfigurationEvent, 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(ConfigurationEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConfigurationEvent {}
impl ConfigurationEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ConfigurationEvent, 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: <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConfigurationRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ConfigurationRequestStream {}
impl futures::stream::FusedStream for ConfigurationRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConfigurationRequestStream {
type Protocol = ConfigurationMarker;
type ControlHandle = ConfigurationControlHandle;
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 {
ConfigurationControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ConfigurationRequestStream {
type Item = Result<ConfigurationRequest, 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 ConfigurationRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x27e9cfb72e7c6d01 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ConfigurationUpdateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigurationUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ConfigurationControlHandle { inner: this.inner.clone() };
Ok(ConfigurationRequest::Update {
settings: req.settings,
responder: ConfigurationUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ConfigurationRequest {
Update { settings: Settings, responder: ConfigurationUpdateResponder },
}
impl ConfigurationRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_update(self) -> Option<(Settings, ConfigurationUpdateResponder)> {
if let ConfigurationRequest::Update { settings, responder } = self {
Some((settings, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConfigurationRequest::Update { .. } => "update",
}
}
}
#[derive(Debug, Clone)]
pub struct ConfigurationControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ConfigurationControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ConfigurationControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ConfigurationUpdateResponder {
control_handle: std::mem::ManuallyDrop<ConfigurationControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ConfigurationUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ConfigurationUpdateResponder {
type ControlHandle = ConfigurationControlHandle;
fn control_handle(&self) -> &ConfigurationControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ConfigurationUpdateResponder {
pub fn send(self, mut result: &Settings) -> 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: &Settings) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: &Settings) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ConfigurationUpdateResponse>(
(result,),
self.tx_id,
0x27e9cfb72e7c6d01,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostWatcherMarker;
impl fidl::endpoints::ProtocolMarker for HostWatcherMarker {
type Proxy = HostWatcherProxy;
type RequestStream = HostWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.HostWatcher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HostWatcherMarker {}
pub type HostWatcherSetActiveResult = Result<(), i32>;
pub trait HostWatcherProxyInterface: Send + Sync {
type WatchResponseFut: std::future::Future<Output = Result<Vec<HostInfo>, fidl::Error>> + Send;
fn r#watch(&self) -> Self::WatchResponseFut;
type SetActiveResponseFut: std::future::Future<Output = Result<HostWatcherSetActiveResult, fidl::Error>>
+ Send;
fn r#set_active(&self, id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostWatcherSynchronousProxy {
type Proxy = HostWatcherProxy;
type Protocol = HostWatcherMarker;
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 HostWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<HostWatcherEvent, fidl::Error> {
HostWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<HostInfo>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, HostWatcherWatchResponse>(
(),
0x4e2c2972a5b16f9c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.hosts)
}
pub fn r#set_active(
&self,
mut id: &fidl_fuchsia_bluetooth::HostId,
___deadline: zx::MonotonicInstant,
) -> Result<HostWatcherSetActiveResult, fidl::Error> {
let _response = self.client.send_query::<
HostWatcherSetActiveRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(id,),
0x83f311ecaf0ddf3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct HostWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostWatcherProxy {
type Protocol = HostWatcherMarker;
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 HostWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostWatcherEventStream {
HostWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch(
&self,
) -> fidl::client::QueryResponseFut<Vec<HostInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
HostWatcherProxyInterface::r#watch(self)
}
pub fn r#set_active(
&self,
mut id: &fidl_fuchsia_bluetooth::HostId,
) -> fidl::client::QueryResponseFut<
HostWatcherSetActiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostWatcherProxyInterface::r#set_active(self, id)
}
}
impl HostWatcherProxyInterface for HostWatcherProxy {
type WatchResponseFut = fidl::client::QueryResponseFut<
Vec<HostInfo>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch(&self) -> Self::WatchResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<HostInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
HostWatcherWatchResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e2c2972a5b16f9c,
>(_buf?)?;
Ok(_response.hosts)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostInfo>>(
(),
0x4e2c2972a5b16f9c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetActiveResponseFut = fidl::client::QueryResponseFut<
HostWatcherSetActiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_active(&self, mut id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostWatcherSetActiveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x83f311ecaf0ddf3,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HostWatcherSetActiveRequest, HostWatcherSetActiveResult>(
(id,),
0x83f311ecaf0ddf3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HostWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostWatcherEventStream {}
impl futures::stream::FusedStream for HostWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostWatcherEventStream {
type Item = Result<HostWatcherEvent, 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(HostWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostWatcherEvent {}
impl HostWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostWatcherEvent, 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: <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostWatcherRequestStream {}
impl futures::stream::FusedStream for HostWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostWatcherRequestStream {
type Protocol = HostWatcherMarker;
type ControlHandle = HostWatcherControlHandle;
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 {
HostWatcherControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HostWatcherRequestStream {
type Item = Result<HostWatcherRequest, 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 HostWatcherRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4e2c2972a5b16f9c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
Ok(HostWatcherRequest::Watch {
responder: HostWatcherWatchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x83f311ecaf0ddf3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostWatcherSetActiveRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostWatcherSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
Ok(HostWatcherRequest::SetActive {
id: req.id,
responder: HostWatcherSetActiveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostWatcherRequest {
Watch { responder: HostWatcherWatchResponder },
SetActive { id: fidl_fuchsia_bluetooth::HostId, responder: HostWatcherSetActiveResponder },
}
impl HostWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch(self) -> Option<(HostWatcherWatchResponder)> {
if let HostWatcherRequest::Watch { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_active(
self,
) -> Option<(fidl_fuchsia_bluetooth::HostId, HostWatcherSetActiveResponder)> {
if let HostWatcherRequest::SetActive { id, responder } = self {
Some((id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostWatcherRequest::Watch { .. } => "watch",
HostWatcherRequest::SetActive { .. } => "set_active",
}
}
}
#[derive(Debug, Clone)]
pub struct HostWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostWatcherControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl HostWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostWatcherWatchResponder {
control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostWatcherWatchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostWatcherWatchResponder {
type ControlHandle = HostWatcherControlHandle;
fn control_handle(&self) -> &HostWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostWatcherWatchResponder {
pub fn send(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(hosts);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(hosts);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<HostWatcherWatchResponse>(
(hosts,),
self.tx_id,
0x4e2c2972a5b16f9c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostWatcherSetActiveResponder {
control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostWatcherSetActiveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostWatcherSetActiveResponder {
type ControlHandle = HostWatcherControlHandle;
fn control_handle(&self) -> &HostWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostWatcherSetActiveResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x83f311ecaf0ddf3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PairingMarker;
impl fidl::endpoints::ProtocolMarker for PairingMarker {
type Proxy = PairingProxy;
type RequestStream = PairingRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PairingSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Pairing";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PairingMarker {}
pub trait PairingProxyInterface: Send + Sync {
fn r#set_pairing_delegate(
&self,
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error>;
fn r#set_delegate(
&self,
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PairingSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PairingSynchronousProxy {
type Proxy = PairingProxy;
type Protocol = PairingMarker;
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 PairingSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PairingEvent, fidl::Error> {
PairingEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PairingSetPairingDelegateRequest>(
(input, output, delegate),
0x19721a12cb80212c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<PairingSetDelegateRequest>(
(input, output, delegate),
0x1da0568d2582a9a5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PairingProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PairingProxy {
type Protocol = PairingMarker;
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 PairingProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PairingEventStream {
PairingEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
PairingProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
}
pub fn r#set_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
) -> Result<(), fidl::Error> {
PairingProxyInterface::r#set_delegate(self, input, output, delegate)
}
}
impl PairingProxyInterface for PairingProxy {
fn r#set_pairing_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PairingSetPairingDelegateRequest>(
(input, output, delegate),
0x19721a12cb80212c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_delegate(
&self,
mut input: InputCapability,
mut output: OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<PairingSetDelegateRequest>(
(input, output, delegate),
0x1da0568d2582a9a5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PairingEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PairingEventStream {}
impl futures::stream::FusedStream for PairingEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PairingEventStream {
type Item = Result<PairingEvent, 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(PairingEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PairingEvent {}
impl PairingEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PairingEvent, 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: <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PairingRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PairingRequestStream {}
impl futures::stream::FusedStream for PairingRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PairingRequestStream {
type Protocol = PairingMarker;
type ControlHandle = PairingControlHandle;
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 {
PairingControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PairingRequestStream {
type Item = Result<PairingRequest, 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 PairingRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x19721a12cb80212c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PairingControlHandle { inner: this.inner.clone() };
Ok(PairingRequest::SetPairingDelegate {
input: req.input,
output: req.output,
delegate: req.delegate,
control_handle,
})
}
0x1da0568d2582a9a5 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingSetDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PairingControlHandle { inner: this.inner.clone() };
Ok(PairingRequest::SetDelegate {
input: req.input,
output: req.output,
delegate: req.delegate,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PairingRequest {
SetPairingDelegate {
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
control_handle: PairingControlHandle,
},
SetDelegate {
input: InputCapability,
output: OutputCapability,
delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
control_handle: PairingControlHandle,
},
}
impl PairingRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_pairing_delegate(
self,
) -> Option<(
InputCapability,
OutputCapability,
fidl::endpoints::ClientEnd<PairingDelegateMarker>,
PairingControlHandle,
)> {
if let PairingRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
{
Some((input, output, delegate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_delegate(
self,
) -> Option<(
InputCapability,
OutputCapability,
fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
PairingControlHandle,
)> {
if let PairingRequest::SetDelegate { input, output, delegate, control_handle } = self {
Some((input, output, delegate, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PairingRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
PairingRequest::SetDelegate { .. } => "set_delegate",
}
}
}
#[derive(Debug, Clone)]
pub struct PairingControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PairingControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PairingControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PairingDelegateMarker;
impl fidl::endpoints::ProtocolMarker for PairingDelegateMarker {
type Proxy = PairingDelegateProxy;
type RequestStream = PairingDelegateRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PairingDelegateSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate";
}
pub trait PairingDelegateProxyInterface: Send + Sync {
type OnPairingRequestResponseFut: std::future::Future<Output = Result<(bool, u32), fidl::Error>>
+ Send;
fn r#on_pairing_request(
&self,
peer: &Peer,
method: PairingMethod,
displayed_passkey: u32,
) -> Self::OnPairingRequestResponseFut;
fn r#on_pairing_complete(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
success: bool,
) -> Result<(), fidl::Error>;
fn r#on_remote_keypress(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
keypress: PairingKeypress,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PairingDelegateSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PairingDelegateSynchronousProxy {
type Proxy = PairingDelegateProxy;
type Protocol = PairingDelegateMarker;
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 PairingDelegateSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PairingDelegateEvent, fidl::Error> {
PairingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_pairing_request(
&self,
mut peer: &Peer,
mut method: PairingMethod,
mut displayed_passkey: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(bool, u32), fidl::Error> {
let _response = self.client.send_query::<
PairingDelegateOnPairingRequestRequest,
PairingDelegateOnPairingRequestResponse,
>(
(peer, method, displayed_passkey,),
0x5c483a8f97b226b3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.accept, _response.entered_passkey))
}
pub fn r#on_pairing_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegateOnPairingCompleteRequest>(
(id, success),
0x5ad8fc9864eba757,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#on_remote_keypress(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut keypress: PairingKeypress,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
(id, keypress),
0x4e341e41c604c724,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PairingDelegateProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PairingDelegateProxy {
type Protocol = PairingDelegateMarker;
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 PairingDelegateProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PairingDelegateEventStream {
PairingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_pairing_request(
&self,
mut peer: &Peer,
mut method: PairingMethod,
mut displayed_passkey: u32,
) -> fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
PairingDelegateProxyInterface::r#on_pairing_request(self, peer, method, displayed_passkey)
}
pub fn r#on_pairing_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
PairingDelegateProxyInterface::r#on_pairing_complete(self, id, success)
}
pub fn r#on_remote_keypress(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut keypress: PairingKeypress,
) -> Result<(), fidl::Error> {
PairingDelegateProxyInterface::r#on_remote_keypress(self, id, keypress)
}
}
impl PairingDelegateProxyInterface for PairingDelegateProxy {
type OnPairingRequestResponseFut =
fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_pairing_request(
&self,
mut peer: &Peer,
mut method: PairingMethod,
mut displayed_passkey: u32,
) -> Self::OnPairingRequestResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(bool, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PairingDelegateOnPairingRequestResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5c483a8f97b226b3,
>(_buf?)?;
Ok((_response.accept, _response.entered_passkey))
}
self.client.send_query_and_decode::<PairingDelegateOnPairingRequestRequest, (bool, u32)>(
(peer, method, displayed_passkey),
0x5c483a8f97b226b3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#on_pairing_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegateOnPairingCompleteRequest>(
(id, success),
0x5ad8fc9864eba757,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#on_remote_keypress(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut keypress: PairingKeypress,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
(id, keypress),
0x4e341e41c604c724,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PairingDelegateEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PairingDelegateEventStream {}
impl futures::stream::FusedStream for PairingDelegateEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PairingDelegateEventStream {
type Item = Result<PairingDelegateEvent, 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(PairingDelegateEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PairingDelegateEvent {
OnLocalKeypress { id: fidl_fuchsia_bluetooth::PeerId, keypress: PairingKeypress },
}
impl PairingDelegateEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_local_keypress(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress)> {
if let PairingDelegateEvent::OnLocalKeypress { id, keypress } = self {
Some((id, keypress))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PairingDelegateEvent, 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 {
0x1a764c0428878889 => {
let mut out = fidl::new_empty!(
PairingDelegateOnLocalKeypressRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnLocalKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PairingDelegateEvent::OnLocalKeypress { id: out.id, keypress: out.keypress }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PairingDelegateRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PairingDelegateRequestStream {}
impl futures::stream::FusedStream for PairingDelegateRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PairingDelegateRequestStream {
type Protocol = PairingDelegateMarker;
type ControlHandle = PairingDelegateControlHandle;
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 {
PairingDelegateControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PairingDelegateRequestStream {
type Item = Result<PairingDelegateRequest, 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 PairingDelegateRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5c483a8f97b226b3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PairingDelegateOnPairingRequestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingRequestRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingDelegateControlHandle { inner: this.inner.clone() };
Ok(PairingDelegateRequest::OnPairingRequest {
peer: req.peer,
method: req.method,
displayed_passkey: req.displayed_passkey,
responder: PairingDelegateOnPairingRequestResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5ad8fc9864eba757 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingDelegateOnPairingCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingDelegateControlHandle { inner: this.inner.clone() };
Ok(PairingDelegateRequest::OnPairingComplete {
id: req.id,
success: req.success,
control_handle,
})
}
0x4e341e41c604c724 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingDelegateOnRemoteKeypressRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnRemoteKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingDelegateControlHandle { inner: this.inner.clone() };
Ok(PairingDelegateRequest::OnRemoteKeypress {
id: req.id,
keypress: req.keypress,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PairingDelegateRequest {
OnPairingRequest {
peer: Peer,
method: PairingMethod,
displayed_passkey: u32,
responder: PairingDelegateOnPairingRequestResponder,
},
OnPairingComplete {
id: fidl_fuchsia_bluetooth::PeerId,
success: bool,
control_handle: PairingDelegateControlHandle,
},
OnRemoteKeypress {
id: fidl_fuchsia_bluetooth::PeerId,
keypress: PairingKeypress,
control_handle: PairingDelegateControlHandle,
},
}
impl PairingDelegateRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_pairing_request(
self,
) -> Option<(Peer, PairingMethod, u32, PairingDelegateOnPairingRequestResponder)> {
if let PairingDelegateRequest::OnPairingRequest {
peer,
method,
displayed_passkey,
responder,
} = self
{
Some((peer, method, displayed_passkey, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_pairing_complete(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegateControlHandle)> {
if let PairingDelegateRequest::OnPairingComplete { id, success, control_handle } = self {
Some((id, success, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_remote_keypress(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress, PairingDelegateControlHandle)>
{
if let PairingDelegateRequest::OnRemoteKeypress { id, keypress, control_handle } = self {
Some((id, keypress, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PairingDelegateRequest::OnPairingRequest { .. } => "on_pairing_request",
PairingDelegateRequest::OnPairingComplete { .. } => "on_pairing_complete",
PairingDelegateRequest::OnRemoteKeypress { .. } => "on_remote_keypress",
}
}
}
#[derive(Debug, Clone)]
pub struct PairingDelegateControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PairingDelegateControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PairingDelegateControlHandle {
pub fn send_on_local_keypress(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut keypress: PairingKeypress,
) -> Result<(), fidl::Error> {
self.inner.send::<PairingDelegateOnLocalKeypressRequest>(
(id, keypress),
0,
0x1a764c0428878889,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PairingDelegateOnPairingRequestResponder {
control_handle: std::mem::ManuallyDrop<PairingDelegateControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PairingDelegateOnPairingRequestResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PairingDelegateOnPairingRequestResponder {
type ControlHandle = PairingDelegateControlHandle;
fn control_handle(&self) -> &PairingDelegateControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PairingDelegateOnPairingRequestResponder {
pub fn send(self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(accept, entered_passkey);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut accept: bool,
mut entered_passkey: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(accept, entered_passkey);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PairingDelegateOnPairingRequestResponse>(
(accept, entered_passkey),
self.tx_id,
0x5c483a8f97b226b3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PairingDelegate2Marker;
impl fidl::endpoints::ProtocolMarker for PairingDelegate2Marker {
type Proxy = PairingDelegate2Proxy;
type RequestStream = PairingDelegate2RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PairingDelegate2SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate2";
}
pub trait PairingDelegate2ProxyInterface: Send + Sync {
fn r#start_request(
&self,
payload: PairingDelegate2StartRequestRequest,
) -> Result<(), fidl::Error>;
fn r#request_complete(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
success: bool,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PairingDelegate2SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PairingDelegate2SynchronousProxy {
type Proxy = PairingDelegate2Proxy;
type Protocol = PairingDelegate2Marker;
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 PairingDelegate2SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PairingDelegate2Event, fidl::Error> {
PairingDelegate2Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start_request(
&self,
mut payload: PairingDelegate2StartRequestRequest,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegate2StartRequestRequest>(
&mut payload,
0x2a5ab8092a961a01,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#request_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegate2RequestCompleteRequest>(
(id, success),
0x4b63b44d5dbca192,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PairingDelegate2Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PairingDelegate2Proxy {
type Protocol = PairingDelegate2Marker;
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 PairingDelegate2Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PairingDelegate2EventStream {
PairingDelegate2EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start_request(
&self,
mut payload: PairingDelegate2StartRequestRequest,
) -> Result<(), fidl::Error> {
PairingDelegate2ProxyInterface::r#start_request(self, payload)
}
pub fn r#request_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
PairingDelegate2ProxyInterface::r#request_complete(self, id, success)
}
}
impl PairingDelegate2ProxyInterface for PairingDelegate2Proxy {
fn r#start_request(
&self,
mut payload: PairingDelegate2StartRequestRequest,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegate2StartRequestRequest>(
&mut payload,
0x2a5ab8092a961a01,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#request_complete(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut success: bool,
) -> Result<(), fidl::Error> {
self.client.send::<PairingDelegate2RequestCompleteRequest>(
(id, success),
0x4b63b44d5dbca192,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PairingDelegate2EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PairingDelegate2EventStream {}
impl futures::stream::FusedStream for PairingDelegate2EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PairingDelegate2EventStream {
type Item = Result<PairingDelegate2Event, 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(PairingDelegate2Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PairingDelegate2Event {}
impl PairingDelegate2Event {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PairingDelegate2Event, 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:
<PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PairingDelegate2RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PairingDelegate2RequestStream {}
impl futures::stream::FusedStream for PairingDelegate2RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PairingDelegate2RequestStream {
type Protocol = PairingDelegate2Marker;
type ControlHandle = PairingDelegate2ControlHandle;
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 {
PairingDelegate2ControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PairingDelegate2RequestStream {
type Item = Result<PairingDelegate2Request, 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 PairingDelegate2RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2a5ab8092a961a01 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingDelegate2StartRequestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2StartRequestRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingDelegate2ControlHandle { inner: this.inner.clone() };
Ok(PairingDelegate2Request::StartRequest { payload: req, control_handle })
}
0x4b63b44d5dbca192 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingDelegate2RequestCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2RequestCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingDelegate2ControlHandle { inner: this.inner.clone() };
Ok(PairingDelegate2Request::RequestComplete {
id: req.id,
success: req.success,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PairingDelegate2Request {
StartRequest {
payload: PairingDelegate2StartRequestRequest,
control_handle: PairingDelegate2ControlHandle,
},
RequestComplete {
id: fidl_fuchsia_bluetooth::PeerId,
success: bool,
control_handle: PairingDelegate2ControlHandle,
},
}
impl PairingDelegate2Request {
#[allow(irrefutable_let_patterns)]
pub fn into_start_request(
self,
) -> Option<(PairingDelegate2StartRequestRequest, PairingDelegate2ControlHandle)> {
if let PairingDelegate2Request::StartRequest { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_complete(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegate2ControlHandle)> {
if let PairingDelegate2Request::RequestComplete { id, success, control_handle } = self {
Some((id, success, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PairingDelegate2Request::StartRequest { .. } => "start_request",
PairingDelegate2Request::RequestComplete { .. } => "request_complete",
}
}
}
#[derive(Debug, Clone)]
pub struct PairingDelegate2ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PairingDelegate2ControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PairingDelegate2ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PairingRequestMarker;
impl fidl::endpoints::ProtocolMarker for PairingRequestMarker {
type Proxy = PairingRequestProxy;
type RequestStream = PairingRequestRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PairingRequestSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PairingRequest";
}
pub trait PairingRequestProxyInterface: Send + Sync {
fn r#accept(&self, payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error>;
fn r#reject(&self) -> Result<(), fidl::Error>;
type KeypressResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#keypress(&self, keypress: PairingKeypress) -> Self::KeypressResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PairingRequestSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PairingRequestSynchronousProxy {
type Proxy = PairingRequestProxy;
type Protocol = PairingRequestMarker;
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 PairingRequestSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PairingRequestEvent, fidl::Error> {
PairingRequestEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
self.client.send::<PairingRequestAcceptRequest>(
payload,
0x67278857ae043a5,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#reject(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x550414aec8155cf5,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#keypress(
&self,
mut keypress: PairingKeypress,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<PairingRequestKeypressRequest, fidl::encoding::EmptyPayload>(
(keypress,),
0x53948ecc921fbe9b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct PairingRequestProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PairingRequestProxy {
type Protocol = PairingRequestMarker;
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 PairingRequestProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PairingRequestEventStream {
PairingRequestEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
PairingRequestProxyInterface::r#accept(self, payload)
}
pub fn r#reject(&self) -> Result<(), fidl::Error> {
PairingRequestProxyInterface::r#reject(self)
}
pub fn r#keypress(
&self,
mut keypress: PairingKeypress,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PairingRequestProxyInterface::r#keypress(self, keypress)
}
}
impl PairingRequestProxyInterface for PairingRequestProxy {
fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
self.client.send::<PairingRequestAcceptRequest>(
payload,
0x67278857ae043a5,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#reject(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x550414aec8155cf5,
fidl::encoding::DynamicFlags::empty(),
)
}
type KeypressResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#keypress(&self, mut keypress: PairingKeypress) -> Self::KeypressResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x53948ecc921fbe9b,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<PairingRequestKeypressRequest, ()>(
(keypress,),
0x53948ecc921fbe9b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PairingRequestEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PairingRequestEventStream {}
impl futures::stream::FusedStream for PairingRequestEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PairingRequestEventStream {
type Item = Result<PairingRequestEvent, 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(PairingRequestEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PairingRequestEvent {
OnKeypress { keypress: PairingKeypress },
OnComplete { success: bool },
}
impl PairingRequestEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_keypress(self) -> Option<PairingKeypress> {
if let PairingRequestEvent::OnKeypress { keypress } = self {
Some((keypress))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_complete(self) -> Option<bool> {
if let PairingRequestEvent::OnComplete { success } = self {
Some((success))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PairingRequestEvent, 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 {
0x71a4802e6a5d1aca => {
let mut out = fidl::new_empty!(
PairingRequestOnKeypressRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PairingRequestEvent::OnKeypress { keypress: out.keypress }))
}
0xd38d3220987bc79 => {
let mut out = fidl::new_empty!(
PairingRequestOnCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PairingRequestEvent::OnComplete { success: out.success }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PairingRequestRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PairingRequestRequestStream {}
impl futures::stream::FusedStream for PairingRequestRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PairingRequestRequestStream {
type Protocol = PairingRequestMarker;
type ControlHandle = PairingRequestControlHandle;
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 {
PairingRequestControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PairingRequestRequestStream {
type Item = Result<PairingRequestRequest, 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 PairingRequestRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x67278857ae043a5 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PairingRequestAcceptRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingRequestControlHandle { inner: this.inner.clone() };
Ok(PairingRequestRequest::Accept { payload: req, control_handle })
}
0x550414aec8155cf5 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingRequestControlHandle { inner: this.inner.clone() };
Ok(PairingRequestRequest::Reject { control_handle })
}
0x53948ecc921fbe9b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PairingRequestKeypressRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PairingRequestControlHandle { inner: this.inner.clone() };
Ok(PairingRequestRequest::Keypress {
keypress: req.keypress,
responder: PairingRequestKeypressResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PairingRequestRequest {
Accept { payload: PairingRequestAcceptRequest, control_handle: PairingRequestControlHandle },
Reject { control_handle: PairingRequestControlHandle },
Keypress { keypress: PairingKeypress, responder: PairingRequestKeypressResponder },
}
impl PairingRequestRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_accept(self) -> Option<(PairingRequestAcceptRequest, PairingRequestControlHandle)> {
if let PairingRequestRequest::Accept { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reject(self) -> Option<(PairingRequestControlHandle)> {
if let PairingRequestRequest::Reject { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_keypress(self) -> Option<(PairingKeypress, PairingRequestKeypressResponder)> {
if let PairingRequestRequest::Keypress { keypress, responder } = self {
Some((keypress, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PairingRequestRequest::Accept { .. } => "accept",
PairingRequestRequest::Reject { .. } => "reject",
PairingRequestRequest::Keypress { .. } => "keypress",
}
}
}
#[derive(Debug, Clone)]
pub struct PairingRequestControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PairingRequestControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PairingRequestControlHandle {
pub fn send_on_keypress(&self, mut keypress: PairingKeypress) -> Result<(), fidl::Error> {
self.inner.send::<PairingRequestOnKeypressRequest>(
(keypress,),
0,
0x71a4802e6a5d1aca,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_complete(&self, mut success: bool) -> Result<(), fidl::Error> {
self.inner.send::<PairingRequestOnCompleteRequest>(
(success,),
0,
0xd38d3220987bc79,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PairingRequestKeypressResponder {
control_handle: std::mem::ManuallyDrop<PairingRequestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PairingRequestKeypressResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PairingRequestKeypressResponder {
type ControlHandle = PairingRequestControlHandle;
fn control_handle(&self) -> &PairingRequestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PairingRequestKeypressResponder {
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,
0x53948ecc921fbe9b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProcedureTokenMarker;
impl fidl::endpoints::ProtocolMarker for ProcedureTokenMarker {
type Proxy = ProcedureTokenProxy;
type RequestStream = ProcedureTokenRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProcedureTokenSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ProcedureToken";
}
pub trait ProcedureTokenProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProcedureTokenSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProcedureTokenSynchronousProxy {
type Proxy = ProcedureTokenProxy;
type Protocol = ProcedureTokenMarker;
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 ProcedureTokenSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ProcedureTokenEvent, fidl::Error> {
ProcedureTokenEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct ProcedureTokenProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProcedureTokenProxy {
type Protocol = ProcedureTokenMarker;
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 ProcedureTokenProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProcedureTokenEventStream {
ProcedureTokenEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl ProcedureTokenProxyInterface for ProcedureTokenProxy {}
pub struct ProcedureTokenEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProcedureTokenEventStream {}
impl futures::stream::FusedStream for ProcedureTokenEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProcedureTokenEventStream {
type Item = Result<ProcedureTokenEvent, 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(ProcedureTokenEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProcedureTokenEvent {}
impl ProcedureTokenEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProcedureTokenEvent, 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:
<ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProcedureTokenRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProcedureTokenRequestStream {}
impl futures::stream::FusedStream for ProcedureTokenRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProcedureTokenRequestStream {
type Protocol = ProcedureTokenMarker;
type ControlHandle = ProcedureTokenControlHandle;
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 {
ProcedureTokenControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ProcedureTokenRequestStream {
type Item = Result<ProcedureTokenRequest, 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 ProcedureTokenRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProcedureTokenRequest {}
impl ProcedureTokenRequest {
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct ProcedureTokenControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProcedureTokenControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ProcedureTokenControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for BondableMode {
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 BondableMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BondableMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BondableMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Bondable
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BootstrapError {
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 BootstrapError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BootstrapError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BootstrapError {
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidHostIdentity
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BrEdrSecurityMode {
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 BrEdrSecurityMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for BrEdrSecurityMode
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrEdrSecurityMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Mode4
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
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 Error {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self::Failed
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InputCapability {
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 InputCapability {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for InputCapability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputCapability {
#[inline(always)]
fn new_empty() -> Self {
Self::None
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for LeSecurityMode {
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 LeSecurityMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LeSecurityMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeSecurityMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Mode1
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for OutputCapability {
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 OutputCapability {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for OutputCapability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputCapability {
#[inline(always)]
fn new_empty() -> Self {
Self::None
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PairingKeypress {
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 PairingKeypress {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for PairingKeypress
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingKeypress {
#[inline(always)]
fn new_empty() -> Self {
Self::DigitEntered
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PairingMethod {
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 PairingMethod {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PairingMethod {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingMethod {
#[inline(always)]
fn new_empty() -> Self {
Self::Consent
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PairingSecurityLevel {
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 PairingSecurityLevel {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for PairingSecurityLevel
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingSecurityLevel {
#[inline(always)]
fn new_empty() -> Self {
Self::Encrypted
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TechnologyType {
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 TechnologyType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TechnologyType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TechnologyType {
#[inline(always)]
fn new_empty() -> Self {
Self::LowEnergy
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessConnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessConnectRequest, D>
for &AccessConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessConnectRequest>(offset);
fidl::encoding::Encode::<AccessConnectRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<AccessConnectRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessDisconnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessDisconnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AccessDisconnectRequest, D> for &AccessDisconnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
fidl::encoding::Encode::<AccessDisconnectRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<AccessDisconnectRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AccessDisconnectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessForgetRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessForgetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessForgetRequest, D>
for &AccessForgetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessForgetRequest>(offset);
fidl::encoding::Encode::<AccessForgetRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<AccessForgetRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessForgetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessForgetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AccessMakeDiscoverableRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessMakeDiscoverableRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
AccessMakeDiscoverableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AccessMakeDiscoverableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
fidl::encoding::Encode::<AccessMakeDiscoverableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AccessMakeDiscoverableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessMakeDiscoverableRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
token: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.token,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessPairRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessPairRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessPairRequest, D>
for &AccessPairRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessPairRequest>(offset);
fidl::encoding::Encode::<AccessPairRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),
<PairingOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<PairingOptions, D>,
> fidl::encoding::Encode<AccessPairRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessPairRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessPairRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
options: fidl::new_empty!(PairingOptions, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(PairingOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessSetDeviceClassRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessSetDeviceClassRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for &AccessSetDeviceClassRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
fidl::encoding::Encode::<AccessSetDeviceClassRequest, D>::encode(
(<fidl_fuchsia_bluetooth::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow(
&self.device_class,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::DeviceClass, D>,
> fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AccessSetDeviceClassRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { device_class: fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::DeviceClass,
D,
&mut self.device_class,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessSetLocalNameRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessSetLocalNameRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AccessSetLocalNameRequest, D> for &AccessSetLocalNameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
fidl::encoding::Encode::<AccessSetLocalNameRequest, D>::encode(
(<fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<248>, D>,
> fidl::encoding::Encode<AccessSetLocalNameRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AccessSetLocalNameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<248>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<248>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AccessSetPairingDelegateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessSetPairingDelegateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl
fidl::encoding::Encode<
AccessSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AccessSetPairingDelegateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
fidl::encoding::Encode::<AccessSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
<OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AccessSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessSetPairingDelegateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
input: fidl::new_empty!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
output: fidl::new_empty!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.output,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AccessStartDiscoveryRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessStartDiscoveryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
AccessStartDiscoveryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AccessStartDiscoveryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
fidl::encoding::Encode::<AccessStartDiscoveryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AccessStartDiscoveryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AccessStartDiscoveryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
token: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.token,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AccessWatchPeersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AccessWatchPeersResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AccessWatchPeersResponse, D> for &AccessWatchPeersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
fidl::encoding::Encode::<AccessWatchPeersResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<Peer> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Peer>, D>,
T1: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D,
>,
> fidl::encoding::Encode<AccessWatchPeersResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AccessWatchPeersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
updated: fidl::new_empty!(fidl::encoding::UnboundedVector<Peer>, D),
removed: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Peer>,
D,
&mut self.updated,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D,
&mut self.removed,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BootstrapAddIdentitiesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BootstrapAddIdentitiesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D>
for &BootstrapAddIdentitiesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
fidl::encoding::Encode::<BootstrapAddIdentitiesRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<Identity> as fidl::encoding::ValueTypeMarker>::borrow(&self.identities),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Identity>, D>,
> fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BootstrapAddIdentitiesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { identities: fidl::new_empty!(fidl::encoding::UnboundedVector<Identity>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Identity>,
D,
&mut self.identities,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ConfigurationUpdateRequest, D> for &ConfigurationUpdateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
fidl::encoding::Encode::<ConfigurationUpdateRequest, D>::encode(
(<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
fidl::encoding::Encode<ConfigurationUpdateRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ConfigurationUpdateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { settings: fidl::new_empty!(Settings, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Settings, D, &mut self.settings, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ConfigurationUpdateResponse, D> for &ConfigurationUpdateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
fidl::encoding::Encode::<ConfigurationUpdateResponse, D>::encode(
(<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
fidl::encoding::Encode<ConfigurationUpdateResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ConfigurationUpdateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { result: fidl::new_empty!(Settings, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Settings, D, &mut self.result, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Consent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Consent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Consent, D> for &Consent {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Consent>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Consent {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for HostWatcherSetActiveRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostWatcherSetActiveRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for &HostWatcherSetActiveRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
fidl::encoding::Encode::<HostWatcherSetActiveRequest, D>::encode(
(<fidl_fuchsia_bluetooth::HostId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::HostId, D>,
> fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostWatcherSetActiveRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::HostId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::HostId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostWatcherWatchResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostWatcherWatchResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostWatcherWatchResponse, D> for &HostWatcherWatchResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
fidl::encoding::Encode::<HostWatcherWatchResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<HostInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.hosts),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<HostInfo>, D>,
> fidl::encoding::Encode<HostWatcherWatchResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostWatcherWatchResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { hosts: fidl::new_empty!(fidl::encoding::UnboundedVector<HostInfo>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<HostInfo>,
D,
&mut self.hosts,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Key {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Key {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Key, D> for &Key {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Key>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Key).write_unaligned((self as *const Key).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
> fidl::encoding::Encode<Key, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Key>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Key {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LeConnectionParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LeConnectionParameters {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
6
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LeConnectionParameters, D> for &LeConnectionParameters
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LeConnectionParameters>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LeConnectionParameters)
.write_unaligned((self as *const LeConnectionParameters).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<LeConnectionParameters, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LeConnectionParameters>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LeConnectionParameters
{
#[inline(always)]
fn new_empty() -> Self {
Self {
connection_interval: fidl::new_empty!(u16, D),
connection_latency: fidl::new_empty!(u16, D),
supervision_timeout: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 6);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ltk {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ltk {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ltk, D> for &Ltk {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ltk>(offset);
fidl::encoding::Encode::<Ltk, D>::encode(
(
<PeerKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.ediv),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.rand),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<PeerKey, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<Ltk, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ltk>(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 + 20, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ltk {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(PeerKey, D),
ediv: fidl::new_empty!(u16, D),
rand: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffff0000ff000000u64;
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!(PeerKey, D, &mut self.key, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.ediv, decoder, offset + 20, _depth)?;
fidl::decode!(u64, D, &mut self.rand, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegate2RequestCompleteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegate2RequestCompleteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D>
for &PairingDelegate2RequestCompleteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
fidl::encoding::Encode::<PairingDelegate2RequestCompleteRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegate2RequestCompleteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
success: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegateOnLocalKeypressRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnLocalKeypressRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D>
for &PairingDelegateOnLocalKeypressRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
fidl::encoding::Encode::<PairingDelegateOnLocalKeypressRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),
<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<PairingKeypress, D>,
> fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegateOnLocalKeypressRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
keypress: fidl::new_empty!(PairingKeypress, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingCompleteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingCompleteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D>
for &PairingDelegateOnPairingCompleteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
fidl::encoding::Encode::<PairingDelegateOnPairingCompleteRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegateOnPairingCompleteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
success: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D>
for &PairingDelegateOnPairingRequestRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
fidl::encoding::Encode::<PairingDelegateOnPairingRequestRequest, D>::encode(
(
<Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
<PairingMethod as fidl::encoding::ValueTypeMarker>::borrow(&self.method),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.displayed_passkey),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Peer, D>,
T1: fidl::encoding::Encode<PairingMethod, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegateOnPairingRequestRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer: fidl::new_empty!(Peer, D),
method: fidl::new_empty!(PairingMethod, D),
displayed_passkey: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Peer, D, &mut self.peer, decoder, offset + 0, _depth)?;
fidl::decode!(PairingMethod, D, &mut self.method, decoder, offset + 16, _depth)?;
fidl::decode!(u32, D, &mut self.displayed_passkey, decoder, offset + 20, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D>
for &PairingDelegateOnPairingRequestResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingRequestResponse>(offset);
fidl::encoding::Encode::<PairingDelegateOnPairingRequestResponse, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.accept),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.entered_passkey),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnPairingRequestResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegateOnPairingRequestResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { accept: fidl::new_empty!(bool, D), entered_passkey: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
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!(bool, D, &mut self.accept, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.entered_passkey, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingDelegateOnRemoteKeypressRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnRemoteKeypressRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D>
for &PairingDelegateOnRemoteKeypressRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
fidl::encoding::Encode::<PairingDelegateOnRemoteKeypressRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),
<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<PairingKeypress, D>,
> fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingDelegateOnRemoteKeypressRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
keypress: fidl::new_empty!(PairingKeypress, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingRequestKeypressRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingRequestKeypressRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingRequestKeypressRequest, D>
for &PairingRequestKeypressRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
fidl::encoding::Encode::<PairingRequestKeypressRequest, D>::encode(
(<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
fidl::encoding::Encode<PairingRequestKeypressRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingRequestKeypressRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { keypress: fidl::new_empty!(PairingKeypress, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingRequestOnCompleteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingRequestOnCompleteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingRequestOnCompleteRequest, D>
for &PairingRequestOnCompleteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
fidl::encoding::Encode::<PairingRequestOnCompleteRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<PairingRequestOnCompleteRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingRequestOnCompleteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { success: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.success, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingRequestOnKeypressRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingRequestOnKeypressRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingRequestOnKeypressRequest, D>
for &PairingRequestOnKeypressRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
fidl::encoding::Encode::<PairingRequestOnKeypressRequest, D>::encode(
(<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
fidl::encoding::Encode<PairingRequestOnKeypressRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingRequestOnKeypressRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { keypress: fidl::new_empty!(PairingKeypress, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PairingSetDelegateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingSetDelegateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl
fidl::encoding::Encode<
PairingSetDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PairingSetDelegateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
fidl::encoding::Encode::<PairingSetDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
<OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PairingSetDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PairingSetDelegateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
input: fidl::new_empty!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
output: fidl::new_empty!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.output,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PairingSetPairingDelegateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingSetPairingDelegateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl
fidl::encoding::Encode<
PairingSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PairingSetPairingDelegateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
fidl::encoding::Encode::<PairingSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
<OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PairingSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PairingSetPairingDelegateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
input: fidl::new_empty!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
output: fidl::new_empty!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.output,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PasskeyEntry {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PasskeyEntry {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PasskeyEntry, D>
for &PasskeyEntry
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PasskeyEntry>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PasskeyEntry {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for PeerKey {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerKey {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
19
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerKey, D> for &PeerKey {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerKey>(offset);
fidl::encoding::Encode::<PeerKey, D>::encode(
(
<SecurityProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.security),
<Key as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SecurityProperties, D>,
T1: fidl::encoding::Encode<Key, D>,
> fidl::encoding::Encode<PeerKey, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerKey>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 3, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerKey {
#[inline(always)]
fn new_empty() -> Self {
Self {
security: fidl::new_empty!(SecurityProperties, D),
data: fidl::new_empty!(Key, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SecurityProperties, D, &mut self.security, decoder, offset + 0, _depth)?;
fidl::decode!(Key, D, &mut self.data, decoder, offset + 3, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SecurityProperties {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SecurityProperties {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
3
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityProperties, D>
for &SecurityProperties
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityProperties>(offset);
fidl::encoding::Encode::<SecurityProperties, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authenticated),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.secure_connections),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_key_size),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<SecurityProperties, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityProperties>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityProperties {
#[inline(always)]
fn new_empty() -> Self {
Self {
authenticated: fidl::new_empty!(bool, D),
secure_connections: fidl::new_empty!(bool, D),
encryption_key_size: fidl::new_empty!(u8, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.authenticated, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.secure_connections, decoder, offset + 1, _depth)?;
fidl::decode!(u8, D, &mut self.encryption_key_size, decoder, offset + 2, _depth)?;
Ok(())
}
}
impl BondingData {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.bredr_bond {
return 8;
}
if let Some(_) = self.le_bond {
return 7;
}
if let Some(_) = self.address {
return 6;
}
if let Some(_) = self.name {
return 3;
}
if let Some(_) = self.local_address {
return 2;
}
if let Some(_) = self.identifier {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for BondingData {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BondingData {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BondingData, D>
for &BondingData
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingData>(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, D>(
self.identifier.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::<fidl_fuchsia_bluetooth::Address, D>(
self.local_address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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<248>, D>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<248> 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_fuchsia_bluetooth::Address, D>(
self.address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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::<LeBondData, D>(
self.le_bond.as_ref().map(<LeBondData 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::<BredrBondData, D>(
self.bredr_bond
.as_ref()
.map(<BredrBondData as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BondingData {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_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
.identifier
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::Address 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
.local_address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<248> 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<248>, D));
fidl::decode!(
fidl::encoding::BoundedString<248>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::Address 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
.address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<LeBondData 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.le_bond.get_or_insert_with(|| fidl::new_empty!(LeBondData, D));
fidl::decode!(LeBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<BredrBondData 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.bredr_bond.get_or_insert_with(|| fidl::new_empty!(BredrBondData, D));
fidl::decode!(BredrBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl BredrBondData {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.link_key {
return 3;
}
if let Some(_) = self.services {
return 2;
}
if let Some(_) = self.role_preference {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for BredrBondData {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BredrBondData {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BredrBondData, D>
for &BredrBondData
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BredrBondData>(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::ConnectionRole, D>(
self.role_preference.as_ref().map(<fidl_fuchsia_bluetooth::ConnectionRole 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<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> 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::<PeerKey, D>(
self.link_key.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BredrBondData {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_bluetooth::ConnectionRole 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.role_preference.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::ConnectionRole, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::ConnectionRole,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<
fidl_fuchsia_bluetooth::Uuid,
65535,
> 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<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PeerKey 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.link_key.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl HostData {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.irk {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for HostData {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostData {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostData, D> for &HostData {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostData>(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::<Key, D>(
self.irk.as_ref().map(<Key as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostData {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Key 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.irk.get_or_insert_with(|| fidl::new_empty!(Key, D));
fidl::decode!(Key, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl HostInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.addresses {
return 8;
}
if let Some(_) = self.discovering {
return 7;
}
if let Some(_) = self.discoverable {
return 6;
}
if let Some(_) = self.local_name {
return 5;
}
if let Some(_) = self.active {
return 4;
}
if let Some(_) = self.technology {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for HostInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostInfo, D> for &HostInfo {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostInfo>(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::HostId, D>(
self.id.as_ref().map(
<fidl_fuchsia_bluetooth::HostId 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::<TechnologyType, D>(
self.technology
.as_ref()
.map(<TechnologyType 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::<bool, D>(
self.active.as_ref().map(<bool 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::BoundedString<248>, D>(
self.local_name.as_ref().map(
<fidl::encoding::BoundedString<248> 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::<bool, D>(
self.discoverable.as_ref().map(<bool 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::<bool, D>(
self.discovering.as_ref().map(<bool 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::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>, D>(
self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostInfo {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::HostId as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.id
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::HostId, D));
fidl::decode!(
fidl_fuchsia_bluetooth::HostId,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<TechnologyType 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.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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.active.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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::BoundedString<248> 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
.local_name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
fidl::decode!(
fidl::encoding::BoundedString<248>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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.discoverable.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<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.discovering.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<
fidl_fuchsia_bluetooth::Address,
> 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.addresses.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>,
D
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Identity {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.bonds {
return 2;
}
if let Some(_) = self.host {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Identity {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Identity {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Identity, D> for &Identity {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Identity>(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::<HostData, D>(
self.host.as_ref().map(<HostData as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<BondingData>, D>(
self.bonds.as_ref().map(<fidl::encoding::UnboundedVector<BondingData> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Identity {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<HostData 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.host.get_or_insert_with(|| fidl::new_empty!(HostData, D));
fidl::decode!(HostData, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<BondingData> 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.bonds.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<BondingData>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<BondingData>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl LeBondData {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.local_ltk {
return 6;
}
if let Some(_) = self.peer_ltk {
return 5;
}
if let Some(_) = self.csrk {
return 4;
}
if let Some(_) = self.irk {
return 3;
}
if let Some(_) = self.services {
return 2;
}
if let Some(_) = self.connection_parameters {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LeBondData {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LeBondData {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LeBondData, D>
for &LeBondData
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LeBondData>(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::<LeConnectionParameters, D>(
self.connection_parameters
.as_ref()
.map(<LeConnectionParameters 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<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> 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::<PeerKey, D>(
self.irk.as_ref().map(<PeerKey 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::<PeerKey, D>(
self.csrk.as_ref().map(<PeerKey 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::<Ltk, D>(
self.peer_ltk.as_ref().map(<Ltk 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::<Ltk, D>(
self.local_ltk.as_ref().map(<Ltk as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeBondData {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<LeConnectionParameters as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.connection_parameters
.get_or_insert_with(|| fidl::new_empty!(LeConnectionParameters, D));
fidl::decode!(
LeConnectionParameters,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<
fidl_fuchsia_bluetooth::Uuid,
65535,
> 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<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PeerKey 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.irk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PeerKey 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.csrk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Ltk 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_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Ltk 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.local_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PairingDelegate2StartRequestRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.request {
return 3;
}
if let Some(_) = self.info {
return 2;
}
if let Some(_) = self.peer {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PairingDelegate2StartRequestRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingDelegate2StartRequestRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PairingDelegate2StartRequestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PairingDelegate2StartRequestRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingDelegate2StartRequestRequest>(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::<
Peer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.peer.as_ref().map(<Peer 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::<
PairingProperties,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.info
.as_ref()
.map(<PairingProperties 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<PairingRequestMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.request.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PairingDelegate2StartRequestRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Peer 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.get_or_insert_with(|| {
fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
Peer,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PairingProperties 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.info.get_or_insert_with(|| {
fidl::new_empty!(
PairingProperties,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
PairingProperties,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<PairingRequestMarker>,
> 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.request.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PairingOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.transport {
return 3;
}
if let Some(_) = self.bondable_mode {
return 2;
}
if let Some(_) = self.le_security_level {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PairingOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingOptions, D>
for &PairingOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingOptions>(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::<PairingSecurityLevel, D>(
self.le_security_level
.as_ref()
.map(<PairingSecurityLevel 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::<BondableMode, D>(
self.bondable_mode
.as_ref()
.map(<BondableMode 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::<TechnologyType, D>(
self.transport
.as_ref()
.map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PairingSecurityLevel 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
.le_security_level
.get_or_insert_with(|| fidl::new_empty!(PairingSecurityLevel, D));
fidl::decode!(
PairingSecurityLevel,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<BondableMode 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.bondable_mode.get_or_insert_with(|| fidl::new_empty!(BondableMode, D));
fidl::decode!(BondableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<TechnologyType 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.transport.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PairingRequestAcceptRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.entered_passkey {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PairingRequestAcceptRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingRequestAcceptRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PairingRequestAcceptRequest, D> for &PairingRequestAcceptRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingRequestAcceptRequest>(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::<u32, D>(
self.entered_passkey.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingRequestAcceptRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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.entered_passkey.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 Peer {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.bredr_services {
return 13;
}
if let Some(_) = self.le_services {
return 12;
}
if let Some(_) = self.services {
return 11;
}
if let Some(_) = self.tx_power {
return 10;
}
if let Some(_) = self.rssi {
return 9;
}
if let Some(_) = self.device_class {
return 8;
}
if let Some(_) = self.appearance {
return 7;
}
if let Some(_) = self.name {
return 6;
}
if let Some(_) = self.bonded {
return 5;
}
if let Some(_) = self.connected {
return 4;
}
if let Some(_) = self.technology {
return 3;
}
if let Some(_) = self.address {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Peer {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Peer {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peer>(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, D>(
self.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::<fidl_fuchsia_bluetooth::Address, D>(
self.address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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::<TechnologyType, D>(
self.technology
.as_ref()
.map(<TechnologyType 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::<bool, D>(
self.connected.as_ref().map(<bool 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::<bool, D>(
self.bonded.as_ref().map(<bool 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::BoundedString<248>, D>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<248> 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_bluetooth::Appearance, D>(
self.appearance.as_ref().map(
<fidl_fuchsia_bluetooth::Appearance 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::<fidl_fuchsia_bluetooth::DeviceClass, D>(
self.device_class.as_ref().map(<fidl_fuchsia_bluetooth::DeviceClass 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::<i8, D>(
self.rssi.as_ref().map(<i8 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::<i8, D>(
self.tx_power.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 11 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (11 - 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, 65535>, D>(
self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 12 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (12 - 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, 65535>, D>(
self.le_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 13 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (13 - 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, 65535>, D>(
self.bredr_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_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
.id
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::Address 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
.address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<TechnologyType 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.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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.connected.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<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.bonded.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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::BoundedString<248> 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<248>, D));
fidl::decode!(
fidl::encoding::BoundedString<248>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::Appearance 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
.appearance
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Appearance, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Appearance,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_bluetooth::DeviceClass 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.device_class.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::DeviceClass,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i8 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.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 10 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i8 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.tx_power.get_or_insert_with(|| fidl::new_empty!(i8, D));
fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 11 {
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,
65535,
> 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<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 12 {
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,
65535,
> 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.le_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 13 {
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,
65535,
> 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.bredr_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Settings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.bredr_security_mode {
return 5;
}
if let Some(_) = self.le_security_mode {
return 4;
}
if let Some(_) = self.bredr_connectable_mode {
return 3;
}
if let Some(_) = self.le_background_scan {
return 2;
}
if let Some(_) = self.le_privacy {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Settings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Settings {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Settings, D> for &Settings {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Settings>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.le_privacy.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.le_background_scan
.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::<bool, D>(
self.bredr_connectable_mode
.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::<LeSecurityMode, D>(
self.le_security_mode
.as_ref()
.map(<LeSecurityMode 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::<BrEdrSecurityMode, D>(
self.bredr_security_mode
.as_ref()
.map(<BrEdrSecurityMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Settings {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.le_privacy.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.le_background_scan.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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.bredr_connectable_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<LeSecurityMode 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
.le_security_mode
.get_or_insert_with(|| fidl::new_empty!(LeSecurityMode, D));
fidl::decode!(LeSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<BrEdrSecurityMode 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
.bredr_security_mode
.get_or_insert_with(|| fidl::new_empty!(BrEdrSecurityMode, D));
fidl::decode!(BrEdrSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingProperties {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingProperties {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingProperties, D>
for &PairingProperties
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingProperties>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
PairingProperties::Consent(ref val) => {
fidl::encoding::encode_in_envelope::<Consent, D>(
<Consent as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
PairingProperties::PasskeyDisplay(ref val) => {
fidl::encoding::encode_in_envelope::<u32, D>(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
PairingProperties::PasskeyConfirmation(ref val) => {
fidl::encoding::encode_in_envelope::<u32, D>(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
PairingProperties::PasskeyEntry(ref val) => {
fidl::encoding::encode_in_envelope::<PasskeyEntry, D>(
<PasskeyEntry as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
PairingProperties::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingProperties {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <Consent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <PasskeyEntry 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 PairingProperties::Consent(_) = self {
} else {
*self = PairingProperties::Consent(fidl::new_empty!(Consent, D));
}
#[allow(irrefutable_let_patterns)]
if let PairingProperties::Consent(ref mut val) = self {
fidl::decode!(Consent, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyDisplay(_) = self {
} else {
*self = PairingProperties::PasskeyDisplay(fidl::new_empty!(u32, D));
}
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyDisplay(ref mut val) = self {
fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyConfirmation(_) = self {
} else {
*self = PairingProperties::PasskeyConfirmation(fidl::new_empty!(u32, D));
}
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyConfirmation(ref mut val) = self {
fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyEntry(_) = self {
} else {
*self = PairingProperties::PasskeyEntry(fidl::new_empty!(PasskeyEntry, D));
}
#[allow(irrefutable_let_patterns)]
if let PairingProperties::PasskeyEntry(ref mut val) = self {
fidl::decode!(PasskeyEntry, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = PairingProperties::__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(())
}
}
}