#![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 const INITIAL_VALUE_CHANGED_CREDITS: u32 = 10;
pub const MAX_ATTRIBUTE_COUNT: u16 = 65535;
pub const MAX_CHARACTERISTIC_COUNT: u16 = 32767;
pub const MAX_DESCRIPTOR_COUNT: u16 = 65532;
pub const MAX_SERVICE_COUNT: u16 = MAX_ATTRIBUTE_COUNT as u16;
pub const MAX_VALUE_LENGTH: u16 = 512;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CharacteristicPropertyBits: u16 {
const BROADCAST = 1;
const READ = 2;
const WRITE_WITHOUT_RESPONSE = 4;
const WRITE = 8;
const NOTIFY = 16;
const INDICATE = 32;
const AUTHENTICATED_SIGNED_WRITES = 64;
const RELIABLE_WRITE = 256;
const WRITABLE_AUXILIARIES = 512;
}
}
impl CharacteristicPropertyBits {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u16 {
0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
InvalidHandle = 1,
ReadNotPermitted = 2,
WriteNotPermitted = 3,
InvalidPdu = 4,
InsufficientAuthentication = 5,
InvalidOffset = 7,
InsufficientAuthorization = 8,
InsufficientEncryptionKeySize = 12,
InvalidAttributeValueLength = 13,
UnlikelyError = 14,
InsufficientEncryption = 15,
InsufficientResources = 17,
ValueNotAllowed = 19,
ApplicationError80 = 128,
ApplicationError81 = 129,
ApplicationError82 = 130,
ApplicationError83 = 131,
ApplicationError84 = 132,
ApplicationError85 = 133,
ApplicationError86 = 134,
ApplicationError87 = 135,
ApplicationError88 = 136,
ApplicationError89 = 137,
ApplicationError8A = 138,
ApplicationError8B = 139,
ApplicationError8C = 140,
ApplicationError8D = 141,
ApplicationError8E = 142,
ApplicationError8F = 143,
ApplicationError90 = 144,
ApplicationError91 = 145,
ApplicationError92 = 146,
ApplicationError93 = 147,
ApplicationError94 = 148,
ApplicationError95 = 149,
ApplicationError96 = 150,
ApplicationError97 = 151,
ApplicationError98 = 152,
ApplicationError99 = 153,
ApplicationError9A = 154,
ApplicationError9B = 155,
ApplicationError9C = 156,
ApplicationError9D = 157,
ApplicationError9E = 158,
ApplicationError9F = 159,
WriteRequestRejected = 252,
CccDescriptorImproperlyConfigured = 253,
ProcedureAlreadyInProgress = 254,
OutOfRange = 255,
InvalidParameters = 257,
TooManyResults = 258,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidHandle),
2 => Some(Self::ReadNotPermitted),
3 => Some(Self::WriteNotPermitted),
4 => Some(Self::InvalidPdu),
5 => Some(Self::InsufficientAuthentication),
7 => Some(Self::InvalidOffset),
8 => Some(Self::InsufficientAuthorization),
12 => Some(Self::InsufficientEncryptionKeySize),
13 => Some(Self::InvalidAttributeValueLength),
14 => Some(Self::UnlikelyError),
15 => Some(Self::InsufficientEncryption),
17 => Some(Self::InsufficientResources),
19 => Some(Self::ValueNotAllowed),
128 => Some(Self::ApplicationError80),
129 => Some(Self::ApplicationError81),
130 => Some(Self::ApplicationError82),
131 => Some(Self::ApplicationError83),
132 => Some(Self::ApplicationError84),
133 => Some(Self::ApplicationError85),
134 => Some(Self::ApplicationError86),
135 => Some(Self::ApplicationError87),
136 => Some(Self::ApplicationError88),
137 => Some(Self::ApplicationError89),
138 => Some(Self::ApplicationError8A),
139 => Some(Self::ApplicationError8B),
140 => Some(Self::ApplicationError8C),
141 => Some(Self::ApplicationError8D),
142 => Some(Self::ApplicationError8E),
143 => Some(Self::ApplicationError8F),
144 => Some(Self::ApplicationError90),
145 => Some(Self::ApplicationError91),
146 => Some(Self::ApplicationError92),
147 => Some(Self::ApplicationError93),
148 => Some(Self::ApplicationError94),
149 => Some(Self::ApplicationError95),
150 => Some(Self::ApplicationError96),
151 => Some(Self::ApplicationError97),
152 => Some(Self::ApplicationError98),
153 => Some(Self::ApplicationError99),
154 => Some(Self::ApplicationError9A),
155 => Some(Self::ApplicationError9B),
156 => Some(Self::ApplicationError9C),
157 => Some(Self::ApplicationError9D),
158 => Some(Self::ApplicationError9E),
159 => Some(Self::ApplicationError9F),
252 => Some(Self::WriteRequestRejected),
253 => Some(Self::CccDescriptorImproperlyConfigured),
254 => Some(Self::ProcedureAlreadyInProgress),
255 => Some(Self::OutOfRange),
257 => Some(Self::InvalidParameters),
258 => Some(Self::TooManyResults),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum PublishServiceError {
InvalidServiceHandle,
InvalidUuid,
InvalidCharacteristics,
UnlikelyError,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! PublishServiceErrorUnknown {
() => {
_
};
}
impl PublishServiceError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidServiceHandle),
2 => Some(Self::InvalidUuid),
3 => Some(Self::InvalidCharacteristics),
4 => Some(Self::UnlikelyError),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::InvalidServiceHandle,
2 => Self::InvalidUuid,
3 => Self::InvalidCharacteristics,
4 => Self::UnlikelyError,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::InvalidServiceHandle => 1,
Self::InvalidUuid => 2,
Self::InvalidCharacteristics => 3,
Self::UnlikelyError => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ServiceKind {
Primary = 1,
Secondary = 2,
}
impl ServiceKind {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Primary),
2 => Some(Self::Secondary),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum WriteMode {
Default,
Reliable,
WithoutResponse,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! WriteModeUnknown {
() => {
_
};
}
impl WriteMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Default),
2 => Some(Self::Reliable),
3 => Some(Self::WithoutResponse),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Default,
2 => Self::Reliable,
3 => Self::WithoutResponse,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Default => 1,
Self::Reliable => 2,
Self::WithoutResponse => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct CharacteristicNotifierOnNotificationRequest {
pub value: ReadValue,
}
impl fidl::Persistable for CharacteristicNotifierOnNotificationRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConnectToServiceRequest {
pub handle: ServiceHandle,
pub service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ClientConnectToServiceRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct ClientWatchServicesRequest {
pub uuids: Vec<fidl_fuchsia_bluetooth::Uuid>,
}
impl fidl::Persistable for ClientWatchServicesRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ClientWatchServicesResponse {
pub updated: Vec<ServiceInfo>,
pub removed: Vec<Handle>,
}
impl fidl::Persistable for ClientWatchServicesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Handle {
pub value: u64,
}
impl fidl::Persistable for Handle {}
#[derive(Clone, Debug, PartialEq)]
pub struct LocalServiceCharacteristicConfigurationRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub handle: Handle,
pub notify: bool,
pub indicate: bool,
}
impl fidl::Persistable for LocalServiceCharacteristicConfigurationRequest {}
#[derive(Debug, PartialEq)]
pub struct LocalServiceOnIndicateValueRequest {
pub update: ValueChangedParameters,
pub confirmation: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for LocalServiceOnIndicateValueRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct LocalServiceReadValueRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub handle: Handle,
pub offset: i32,
}
impl fidl::Persistable for LocalServiceReadValueRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LocalServiceValueChangedCreditRequest {
pub additional_credit: u8,
}
impl fidl::Persistable for LocalServiceValueChangedCreditRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceReadValueResponse {
pub value: Vec<u8>,
}
impl fidl::Persistable for LocalServiceReadValueResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceDiscoverCharacteristicsResponse {
pub characteristics: Vec<Characteristic>,
}
impl fidl::Persistable for RemoteServiceDiscoverCharacteristicsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadByTypeRequest {
pub uuid: fidl_fuchsia_bluetooth::Uuid,
}
impl fidl::Persistable for RemoteServiceReadByTypeRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadCharacteristicRequest {
pub handle: Handle,
pub options: ReadOptions,
}
impl fidl::Persistable for RemoteServiceReadCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadDescriptorRequest {
pub handle: Handle,
pub options: ReadOptions,
}
impl fidl::Persistable for RemoteServiceReadDescriptorRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceRegisterCharacteristicNotifierRequest {
pub handle: Handle,
pub notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RemoteServiceRegisterCharacteristicNotifierRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteCharacteristicRequest {
pub handle: Handle,
pub value: Vec<u8>,
pub options: WriteOptions,
}
impl fidl::Persistable for RemoteServiceWriteCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteDescriptorRequest {
pub handle: Handle,
pub value: Vec<u8>,
pub options: WriteOptions,
}
impl fidl::Persistable for RemoteServiceWriteDescriptorRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadByTypeResponse {
pub results: Vec<ReadByTypeResult>,
}
impl fidl::Persistable for RemoteServiceReadByTypeResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadCharacteristicResponse {
pub value: ReadValue,
}
impl fidl::Persistable for RemoteServiceReadCharacteristicResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadDescriptorResponse {
pub value: ReadValue,
}
impl fidl::Persistable for RemoteServiceReadDescriptorResponse {}
#[derive(Debug, PartialEq)]
pub struct ServerPublishServiceRequest {
pub info: ServiceInfo,
pub service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ServerPublishServiceRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ServiceHandle {
pub value: u64,
}
impl fidl::Persistable for ServiceHandle {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ShortReadOptions;
impl fidl::Persistable for ShortReadOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AttributePermissions {
pub read: Option<SecurityRequirements>,
pub write: Option<SecurityRequirements>,
pub update: Option<SecurityRequirements>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AttributePermissions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Characteristic {
pub handle: Option<Handle>,
pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
pub properties: Option<CharacteristicPropertyBits>,
pub permissions: Option<AttributePermissions>,
pub descriptors: Option<Vec<Descriptor>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Characteristic {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Descriptor {
pub handle: Option<Handle>,
pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
pub permissions: Option<AttributePermissions>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Descriptor {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LocalServicePeerUpdateRequest {
pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
pub mtu: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LocalServicePeerUpdateRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LocalServiceWriteValueRequest {
pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
pub handle: Option<Handle>,
pub offset: Option<u32>,
pub value: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LocalServiceWriteValueRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LongReadOptions {
pub offset: Option<u16>,
pub max_bytes: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LongReadOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ReadByTypeResult {
pub handle: Option<Handle>,
pub value: Option<ReadValue>,
pub error: Option<Error>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ReadByTypeResult {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ReadValue {
pub handle: Option<Handle>,
pub value: Option<Vec<u8>>,
pub maybe_truncated: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ReadValue {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SecurityRequirements {
pub encryption_required: Option<bool>,
pub authentication_required: Option<bool>,
pub authorization_required: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SecurityRequirements {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceInfo {
pub handle: Option<ServiceHandle>,
pub kind: Option<ServiceKind>,
pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
pub characteristics: Option<Vec<Characteristic>>,
pub includes: Option<Vec<ServiceHandle>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceInfo {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ValueChangedParameters {
pub handle: Option<Handle>,
pub value: Option<Vec<u8>>,
pub peer_ids: Option<Vec<fidl_fuchsia_bluetooth::PeerId>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ValueChangedParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WriteOptions {
pub write_mode: Option<WriteMode>,
pub offset: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for WriteOptions {}
#[derive(Clone, Debug)]
pub enum ReadOptions {
ShortRead(ShortReadOptions),
LongRead(LongReadOptions),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ReadOptionsUnknown {
() => {
_
};
}
impl PartialEq for ReadOptions {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::ShortRead(x), Self::ShortRead(y)) => *x == *y,
(Self::LongRead(x), Self::LongRead(y)) => *x == *y,
_ => false,
}
}
}
impl ReadOptions {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::ShortRead(_) => 1,
Self::LongRead(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for ReadOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CharacteristicNotifierMarker;
impl fidl::endpoints::ProtocolMarker for CharacteristicNotifierMarker {
type Proxy = CharacteristicNotifierProxy;
type RequestStream = CharacteristicNotifierRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CharacteristicNotifierSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) CharacteristicNotifier";
}
pub trait CharacteristicNotifierProxyInterface: Send + Sync {
type OnNotificationResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_notification(&self, value: &ReadValue) -> Self::OnNotificationResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CharacteristicNotifierSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CharacteristicNotifierSynchronousProxy {
type Proxy = CharacteristicNotifierProxy;
type Protocol = CharacteristicNotifierMarker;
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 CharacteristicNotifierSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<CharacteristicNotifierMarker 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<CharacteristicNotifierEvent, fidl::Error> {
CharacteristicNotifierEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_notification(
&self,
mut value: &ReadValue,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
CharacteristicNotifierOnNotificationRequest,
fidl::encoding::EmptyPayload,
>(
(value,),
0x8edda1bd01f3c0a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct CharacteristicNotifierProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CharacteristicNotifierProxy {
type Protocol = CharacteristicNotifierMarker;
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 CharacteristicNotifierProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CharacteristicNotifierEventStream {
CharacteristicNotifierEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_notification(
&self,
mut value: &ReadValue,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
CharacteristicNotifierProxyInterface::r#on_notification(self, value)
}
}
impl CharacteristicNotifierProxyInterface for CharacteristicNotifierProxy {
type OnNotificationResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_notification(&self, mut value: &ReadValue) -> Self::OnNotificationResponseFut {
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,
0x8edda1bd01f3c0a,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<CharacteristicNotifierOnNotificationRequest, ()>(
(value,),
0x8edda1bd01f3c0a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CharacteristicNotifierEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CharacteristicNotifierEventStream {}
impl futures::stream::FusedStream for CharacteristicNotifierEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CharacteristicNotifierEventStream {
type Item = Result<CharacteristicNotifierEvent, 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(CharacteristicNotifierEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CharacteristicNotifierEvent {}
impl CharacteristicNotifierEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CharacteristicNotifierEvent, 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:
<CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CharacteristicNotifierRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CharacteristicNotifierRequestStream {}
impl futures::stream::FusedStream for CharacteristicNotifierRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CharacteristicNotifierRequestStream {
type Protocol = CharacteristicNotifierMarker;
type ControlHandle = CharacteristicNotifierControlHandle;
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 {
CharacteristicNotifierControlHandle { 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 CharacteristicNotifierRequestStream {
type Item = Result<CharacteristicNotifierRequest, 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 CharacteristicNotifierRequestStream 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 {
0x8edda1bd01f3c0a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(CharacteristicNotifierOnNotificationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CharacteristicNotifierOnNotificationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CharacteristicNotifierControlHandle {
inner: this.inner.clone(),
};
Ok(CharacteristicNotifierRequest::OnNotification {value: req.value,
responder: CharacteristicNotifierOnNotificationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CharacteristicNotifierRequest {
OnNotification { value: ReadValue, responder: CharacteristicNotifierOnNotificationResponder },
}
impl CharacteristicNotifierRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_notification(
self,
) -> Option<(ReadValue, CharacteristicNotifierOnNotificationResponder)> {
if let CharacteristicNotifierRequest::OnNotification { value, responder } = self {
Some((value, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CharacteristicNotifierRequest::OnNotification { .. } => "on_notification",
}
}
}
#[derive(Debug, Clone)]
pub struct CharacteristicNotifierControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CharacteristicNotifierControlHandle {
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 CharacteristicNotifierControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CharacteristicNotifierOnNotificationResponder {
control_handle: std::mem::ManuallyDrop<CharacteristicNotifierControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CharacteristicNotifierOnNotificationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CharacteristicNotifierOnNotificationResponder {
type ControlHandle = CharacteristicNotifierControlHandle;
fn control_handle(&self) -> &CharacteristicNotifierControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CharacteristicNotifierOnNotificationResponder {
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,
0x8edda1bd01f3c0a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ClientMarker;
impl fidl::endpoints::ProtocolMarker for ClientMarker {
type Proxy = ClientProxy;
type RequestStream = ClientRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ClientSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Client";
}
pub trait ClientProxyInterface: Send + Sync {
type WatchServicesResponseFut: std::future::Future<Output = Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error>>
+ Send;
fn r#watch_services(
&self,
uuids: &[fidl_fuchsia_bluetooth::Uuid],
) -> Self::WatchServicesResponseFut;
fn r#connect_to_service(
&self,
handle: &ServiceHandle,
service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ClientSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
type Proxy = ClientProxy;
type Protocol = ClientMarker;
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 ClientSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ClientMarker 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<ClientEvent, fidl::Error> {
ClientEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_services(
&self,
mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
___deadline: zx::MonotonicInstant,
) -> Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error> {
let _response =
self.client.send_query::<ClientWatchServicesRequest, ClientWatchServicesResponse>(
(uuids,),
0x23243a22d6f08640,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.updated, _response.removed))
}
pub fn r#connect_to_service(
&self,
mut handle: &ServiceHandle,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ClientConnectToServiceRequest>(
(handle, service),
0x61b59f2b6d075ff8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ClientProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ClientProxy {
type Protocol = ClientMarker;
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 ClientProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ClientEventStream {
ClientEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_services(
&self,
mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
) -> fidl::client::QueryResponseFut<
(Vec<ServiceInfo>, Vec<Handle>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ClientProxyInterface::r#watch_services(self, uuids)
}
pub fn r#connect_to_service(
&self,
mut handle: &ServiceHandle,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
ClientProxyInterface::r#connect_to_service(self, handle, service)
}
}
impl ClientProxyInterface for ClientProxy {
type WatchServicesResponseFut = fidl::client::QueryResponseFut<
(Vec<ServiceInfo>, Vec<Handle>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_services(
&self,
mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
) -> Self::WatchServicesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ClientWatchServicesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x23243a22d6f08640,
>(_buf?)?;
Ok((_response.updated, _response.removed))
}
self.client
.send_query_and_decode::<ClientWatchServicesRequest, (Vec<ServiceInfo>, Vec<Handle>)>(
(uuids,),
0x23243a22d6f08640,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect_to_service(
&self,
mut handle: &ServiceHandle,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ClientConnectToServiceRequest>(
(handle, service),
0x61b59f2b6d075ff8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ClientEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ClientEventStream {}
impl futures::stream::FusedStream for ClientEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ClientEventStream {
type Item = Result<ClientEvent, 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(ClientEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ClientEvent {}
impl ClientEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ClientEvent, 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: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ClientRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ClientRequestStream {}
impl futures::stream::FusedStream for ClientRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ClientRequestStream {
type Protocol = ClientMarker;
type ControlHandle = ClientControlHandle;
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 {
ClientControlHandle { 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 ClientRequestStream {
type Item = Result<ClientRequest, 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 ClientRequestStream 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 {
0x23243a22d6f08640 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ClientWatchServicesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientWatchServicesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientControlHandle { inner: this.inner.clone() };
Ok(ClientRequest::WatchServices {
uuids: req.uuids,
responder: ClientWatchServicesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x61b59f2b6d075ff8 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ClientConnectToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientControlHandle { inner: this.inner.clone() };
Ok(ClientRequest::ConnectToService {
handle: req.handle,
service: req.service,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ClientRequest {
WatchServices {
uuids: Vec<fidl_fuchsia_bluetooth::Uuid>,
responder: ClientWatchServicesResponder,
},
ConnectToService {
handle: ServiceHandle,
service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
control_handle: ClientControlHandle,
},
}
impl ClientRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_services(
self,
) -> Option<(Vec<fidl_fuchsia_bluetooth::Uuid>, ClientWatchServicesResponder)> {
if let ClientRequest::WatchServices { uuids, responder } = self {
Some((uuids, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_service(
self,
) -> Option<(ServiceHandle, fidl::endpoints::ServerEnd<RemoteServiceMarker>, ClientControlHandle)>
{
if let ClientRequest::ConnectToService { handle, service, control_handle } = self {
Some((handle, service, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ClientRequest::WatchServices { .. } => "watch_services",
ClientRequest::ConnectToService { .. } => "connect_to_service",
}
}
}
#[derive(Debug, Clone)]
pub struct ClientControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ClientControlHandle {
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 ClientControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ClientWatchServicesResponder {
control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientWatchServicesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientWatchServicesResponder {
type ControlHandle = ClientControlHandle;
fn control_handle(&self) -> &ClientControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ClientWatchServicesResponder {
pub fn send(
self,
mut updated: &[ServiceInfo],
mut removed: &[Handle],
) -> 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: &[ServiceInfo],
mut removed: &[Handle],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(updated, removed);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut updated: &[ServiceInfo],
mut removed: &[Handle],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ClientWatchServicesResponse>(
(updated, removed),
self.tx_id,
0x23243a22d6f08640,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LocalServiceMarker;
impl fidl::endpoints::ProtocolMarker for LocalServiceMarker {
type Proxy = LocalServiceProxy;
type RequestStream = LocalServiceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LocalServiceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) LocalService";
}
pub type LocalServiceReadValueResult = Result<Vec<u8>, Error>;
pub type LocalServiceWriteValueResult = Result<(), Error>;
pub trait LocalServiceProxyInterface: Send + Sync {
type CharacteristicConfigurationResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#characteristic_configuration(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
handle: &Handle,
notify: bool,
indicate: bool,
) -> Self::CharacteristicConfigurationResponseFut;
type ReadValueResponseFut: std::future::Future<Output = Result<LocalServiceReadValueResult, fidl::Error>>
+ Send;
fn r#read_value(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
handle: &Handle,
offset: i32,
) -> Self::ReadValueResponseFut;
type WriteValueResponseFut: std::future::Future<Output = Result<LocalServiceWriteValueResult, fidl::Error>>
+ Send;
fn r#write_value(&self, payload: &LocalServiceWriteValueRequest)
-> Self::WriteValueResponseFut;
type PeerUpdateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#peer_update(&self, payload: &LocalServicePeerUpdateRequest)
-> Self::PeerUpdateResponseFut;
fn r#value_changed_credit(&self, additional_credit: u8) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LocalServiceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LocalServiceSynchronousProxy {
type Proxy = LocalServiceProxy;
type Protocol = LocalServiceMarker;
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 LocalServiceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LocalServiceMarker 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<LocalServiceEvent, fidl::Error> {
LocalServiceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#characteristic_configuration(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut notify: bool,
mut indicate: bool,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
LocalServiceCharacteristicConfigurationRequest,
fidl::encoding::EmptyPayload,
>(
(peer_id, handle, notify, indicate,),
0x431101fcd8d9ef15,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#read_value(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut offset: i32,
___deadline: zx::MonotonicInstant,
) -> Result<LocalServiceReadValueResult, fidl::Error> {
let _response = self.client.send_query::<
LocalServiceReadValueRequest,
fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>,
>(
(peer_id, handle, offset,),
0x49e11d396625d104,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#write_value(
&self,
mut payload: &LocalServiceWriteValueRequest,
___deadline: zx::MonotonicInstant,
) -> Result<LocalServiceWriteValueResult, fidl::Error> {
let _response = self.client.send_query::<
LocalServiceWriteValueRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
payload,
0x7d6ae631baf18260,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#peer_update(
&self,
mut payload: &LocalServicePeerUpdateRequest,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<LocalServicePeerUpdateRequest, fidl::encoding::EmptyPayload>(
payload,
0x7e362177a04108b8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceValueChangedCreditRequest>(
(additional_credit,),
0x7cf0931548318566,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct LocalServiceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LocalServiceProxy {
type Protocol = LocalServiceMarker;
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 LocalServiceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LocalServiceEventStream {
LocalServiceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#characteristic_configuration(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut notify: bool,
mut indicate: bool,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
LocalServiceProxyInterface::r#characteristic_configuration(
self, peer_id, handle, notify, indicate,
)
}
pub fn r#read_value(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut offset: i32,
) -> fidl::client::QueryResponseFut<
LocalServiceReadValueResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LocalServiceProxyInterface::r#read_value(self, peer_id, handle, offset)
}
pub fn r#write_value(
&self,
mut payload: &LocalServiceWriteValueRequest,
) -> fidl::client::QueryResponseFut<
LocalServiceWriteValueResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LocalServiceProxyInterface::r#write_value(self, payload)
}
pub fn r#peer_update(
&self,
mut payload: &LocalServicePeerUpdateRequest,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
LocalServiceProxyInterface::r#peer_update(self, payload)
}
pub fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
LocalServiceProxyInterface::r#value_changed_credit(self, additional_credit)
}
}
impl LocalServiceProxyInterface for LocalServiceProxy {
type CharacteristicConfigurationResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#characteristic_configuration(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut notify: bool,
mut indicate: bool,
) -> Self::CharacteristicConfigurationResponseFut {
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,
0x431101fcd8d9ef15,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<LocalServiceCharacteristicConfigurationRequest, ()>(
(peer_id, handle, notify, indicate),
0x431101fcd8d9ef15,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadValueResponseFut = fidl::client::QueryResponseFut<
LocalServiceReadValueResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_value(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: &Handle,
mut offset: i32,
) -> Self::ReadValueResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LocalServiceReadValueResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x49e11d396625d104,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client
.send_query_and_decode::<LocalServiceReadValueRequest, LocalServiceReadValueResult>(
(peer_id, handle, offset),
0x49e11d396625d104,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteValueResponseFut = fidl::client::QueryResponseFut<
LocalServiceWriteValueResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_value(
&self,
mut payload: &LocalServiceWriteValueRequest,
) -> Self::WriteValueResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LocalServiceWriteValueResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7d6ae631baf18260,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<LocalServiceWriteValueRequest, LocalServiceWriteValueResult>(
payload,
0x7d6ae631baf18260,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PeerUpdateResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#peer_update(
&self,
mut payload: &LocalServicePeerUpdateRequest,
) -> Self::PeerUpdateResponseFut {
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,
0x7e362177a04108b8,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<LocalServicePeerUpdateRequest, ()>(
payload,
0x7e362177a04108b8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceValueChangedCreditRequest>(
(additional_credit,),
0x7cf0931548318566,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct LocalServiceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LocalServiceEventStream {}
impl futures::stream::FusedStream for LocalServiceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LocalServiceEventStream {
type Item = Result<LocalServiceEvent, 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(LocalServiceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LocalServiceEvent {
OnSuppressDiscovery {},
OnNotifyValue { payload: ValueChangedParameters },
OnIndicateValue { update: ValueChangedParameters, confirmation: fidl::EventPair },
}
impl LocalServiceEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_suppress_discovery(self) -> Option<()> {
if let LocalServiceEvent::OnSuppressDiscovery {} = self {
Some(())
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_notify_value(self) -> Option<ValueChangedParameters> {
if let LocalServiceEvent::OnNotifyValue { payload } = self {
Some((payload))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_indicate_value(self) -> Option<(ValueChangedParameters, fidl::EventPair)> {
if let LocalServiceEvent::OnIndicateValue { update, confirmation } = self {
Some((update, confirmation))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LocalServiceEvent, 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 {
0x106d36281c3cfb66 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((LocalServiceEvent::OnSuppressDiscovery {}))
}
0x190c1c528bfd0068 => {
let mut out = fidl::new_empty!(
ValueChangedParameters,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ValueChangedParameters>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((LocalServiceEvent::OnNotifyValue { payload: out }))
}
0x59431c3653ac531f => {
let mut out = fidl::new_empty!(
LocalServiceOnIndicateValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceOnIndicateValueRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((LocalServiceEvent::OnIndicateValue {
update: out.update,
confirmation: out.confirmation,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LocalServiceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LocalServiceRequestStream {}
impl futures::stream::FusedStream for LocalServiceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LocalServiceRequestStream {
type Protocol = LocalServiceMarker;
type ControlHandle = LocalServiceControlHandle;
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 {
LocalServiceControlHandle { 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 LocalServiceRequestStream {
type Item = Result<LocalServiceRequest, 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 LocalServiceRequestStream 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 {
0x431101fcd8d9ef15 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalServiceCharacteristicConfigurationRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceCharacteristicConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::CharacteristicConfiguration {
peer_id: req.peer_id,
handle: req.handle,
notify: req.notify,
indicate: req.indicate,
responder: LocalServiceCharacteristicConfigurationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x49e11d396625d104 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalServiceReadValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceReadValueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::ReadValue {
peer_id: req.peer_id,
handle: req.handle,
offset: req.offset,
responder: LocalServiceReadValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7d6ae631baf18260 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalServiceWriteValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceWriteValueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::WriteValue {
payload: req,
responder: LocalServiceWriteValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e362177a04108b8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalServicePeerUpdateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServicePeerUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::PeerUpdate {
payload: req,
responder: LocalServicePeerUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7cf0931548318566 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
LocalServiceValueChangedCreditRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceValueChangedCreditRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::ValueChangedCredit {
additional_credit: req.additional_credit,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LocalServiceRequest {
CharacteristicConfiguration {
peer_id: fidl_fuchsia_bluetooth::PeerId,
handle: Handle,
notify: bool,
indicate: bool,
responder: LocalServiceCharacteristicConfigurationResponder,
},
ReadValue {
peer_id: fidl_fuchsia_bluetooth::PeerId,
handle: Handle,
offset: i32,
responder: LocalServiceReadValueResponder,
},
WriteValue {
payload: LocalServiceWriteValueRequest,
responder: LocalServiceWriteValueResponder,
},
PeerUpdate {
payload: LocalServicePeerUpdateRequest,
responder: LocalServicePeerUpdateResponder,
},
ValueChangedCredit { additional_credit: u8, control_handle: LocalServiceControlHandle },
}
impl LocalServiceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_characteristic_configuration(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Handle,
bool,
bool,
LocalServiceCharacteristicConfigurationResponder,
)> {
if let LocalServiceRequest::CharacteristicConfiguration {
peer_id,
handle,
notify,
indicate,
responder,
} = self
{
Some((peer_id, handle, notify, indicate, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_value(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, Handle, i32, LocalServiceReadValueResponder)> {
if let LocalServiceRequest::ReadValue { peer_id, handle, offset, responder } = self {
Some((peer_id, handle, offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_value(
self,
) -> Option<(LocalServiceWriteValueRequest, LocalServiceWriteValueResponder)> {
if let LocalServiceRequest::WriteValue { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_peer_update(
self,
) -> Option<(LocalServicePeerUpdateRequest, LocalServicePeerUpdateResponder)> {
if let LocalServiceRequest::PeerUpdate { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_value_changed_credit(self) -> Option<(u8, LocalServiceControlHandle)> {
if let LocalServiceRequest::ValueChangedCredit { additional_credit, control_handle } = self
{
Some((additional_credit, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LocalServiceRequest::CharacteristicConfiguration { .. } => {
"characteristic_configuration"
}
LocalServiceRequest::ReadValue { .. } => "read_value",
LocalServiceRequest::WriteValue { .. } => "write_value",
LocalServiceRequest::PeerUpdate { .. } => "peer_update",
LocalServiceRequest::ValueChangedCredit { .. } => "value_changed_credit",
}
}
}
#[derive(Debug, Clone)]
pub struct LocalServiceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LocalServiceControlHandle {
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 LocalServiceControlHandle {
pub fn send_on_suppress_discovery(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x106d36281c3cfb66,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_notify_value(
&self,
mut payload: &ValueChangedParameters,
) -> Result<(), fidl::Error> {
self.inner.send::<ValueChangedParameters>(
payload,
0,
0x190c1c528bfd0068,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_indicate_value(
&self,
mut update: &ValueChangedParameters,
mut confirmation: fidl::EventPair,
) -> Result<(), fidl::Error> {
self.inner.send::<LocalServiceOnIndicateValueRequest>(
(update, confirmation),
0,
0x59431c3653ac531f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServiceCharacteristicConfigurationResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServiceCharacteristicConfigurationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServiceCharacteristicConfigurationResponder {
type ControlHandle = LocalServiceControlHandle;
fn control_handle(&self) -> &LocalServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServiceCharacteristicConfigurationResponder {
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,
0x431101fcd8d9ef15,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServiceReadValueResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServiceReadValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServiceReadValueResponder {
type ControlHandle = LocalServiceControlHandle;
fn control_handle(&self) -> &LocalServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServiceReadValueResponder {
pub fn send(self, mut result: Result<&[u8], 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<&[u8], Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>>(
result.map(|value| (value,)),
self.tx_id,
0x49e11d396625d104,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServiceWriteValueResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServiceWriteValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServiceWriteValueResponder {
type ControlHandle = LocalServiceControlHandle;
fn control_handle(&self) -> &LocalServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServiceWriteValueResponder {
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,
0x7d6ae631baf18260,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServicePeerUpdateResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServicePeerUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServicePeerUpdateResponder {
type ControlHandle = LocalServiceControlHandle;
fn control_handle(&self) -> &LocalServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServicePeerUpdateResponder {
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,
0x7e362177a04108b8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RemoteServiceMarker;
impl fidl::endpoints::ProtocolMarker for RemoteServiceMarker {
type Proxy = RemoteServiceProxy;
type RequestStream = RemoteServiceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RemoteServiceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RemoteService";
}
pub type RemoteServiceReadByTypeResult = Result<Vec<ReadByTypeResult>, Error>;
pub type RemoteServiceReadCharacteristicResult = Result<ReadValue, Error>;
pub type RemoteServiceWriteCharacteristicResult = Result<(), Error>;
pub type RemoteServiceReadDescriptorResult = Result<ReadValue, Error>;
pub type RemoteServiceWriteDescriptorResult = Result<(), Error>;
pub type RemoteServiceRegisterCharacteristicNotifierResult = Result<(), Error>;
pub trait RemoteServiceProxyInterface: Send + Sync {
type DiscoverCharacteristicsResponseFut: std::future::Future<Output = Result<Vec<Characteristic>, fidl::Error>>
+ Send;
fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut;
type ReadByTypeResponseFut: std::future::Future<Output = Result<RemoteServiceReadByTypeResult, fidl::Error>>
+ Send;
fn r#read_by_type(&self, uuid: &fidl_fuchsia_bluetooth::Uuid) -> Self::ReadByTypeResponseFut;
type ReadCharacteristicResponseFut: std::future::Future<Output = Result<RemoteServiceReadCharacteristicResult, fidl::Error>>
+ Send;
fn r#read_characteristic(
&self,
handle: &Handle,
options: &ReadOptions,
) -> Self::ReadCharacteristicResponseFut;
type WriteCharacteristicResponseFut: std::future::Future<Output = Result<RemoteServiceWriteCharacteristicResult, fidl::Error>>
+ Send;
fn r#write_characteristic(
&self,
handle: &Handle,
value: &[u8],
options: &WriteOptions,
) -> Self::WriteCharacteristicResponseFut;
type ReadDescriptorResponseFut: std::future::Future<Output = Result<RemoteServiceReadDescriptorResult, fidl::Error>>
+ Send;
fn r#read_descriptor(
&self,
handle: &Handle,
options: &ReadOptions,
) -> Self::ReadDescriptorResponseFut;
type WriteDescriptorResponseFut: std::future::Future<Output = Result<RemoteServiceWriteDescriptorResult, fidl::Error>>
+ Send;
fn r#write_descriptor(
&self,
handle: &Handle,
value: &[u8],
options: &WriteOptions,
) -> Self::WriteDescriptorResponseFut;
type RegisterCharacteristicNotifierResponseFut: std::future::Future<
Output = Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error>,
> + Send;
fn r#register_characteristic_notifier(
&self,
handle: &Handle,
notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
) -> Self::RegisterCharacteristicNotifierResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RemoteServiceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RemoteServiceSynchronousProxy {
type Proxy = RemoteServiceProxy;
type Protocol = RemoteServiceMarker;
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 RemoteServiceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RemoteServiceMarker 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<RemoteServiceEvent, fidl::Error> {
RemoteServiceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#discover_characteristics(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<Characteristic>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
RemoteServiceDiscoverCharacteristicsResponse,
>(
(),
0x6cd730f12e402543,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.characteristics)
}
pub fn r#read_by_type(
&self,
mut uuid: &fidl_fuchsia_bluetooth::Uuid,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadByTypeRequest,
fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
>(
(uuid,),
0x739bb1e313162bbc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.results))
}
pub fn r#read_characteristic(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceReadCharacteristicResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadCharacteristicRequest,
fidl::encoding::ResultType<RemoteServiceReadCharacteristicResponse, Error>,
>(
(handle, options,),
0x4d41757ed69a96cb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#write_characteristic(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceWriteCharacteristicResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteCharacteristicRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, value, options,),
0x7fc7511adecde8c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#read_descriptor(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceReadDescriptorResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadDescriptorRequest,
fidl::encoding::ResultType<RemoteServiceReadDescriptorResponse, Error>,
>(
(handle, options,),
0x7ed7ce00457dcec1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#write_descriptor(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceWriteDescriptorResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteDescriptorRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, value, options,),
0x21d9106bfd6b7351,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#register_characteristic_notifier(
&self,
mut handle: &Handle,
mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceRegisterCharacteristicNotifierRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, notifier,),
0x35007a85245f5cc6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RemoteServiceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RemoteServiceProxy {
type Protocol = RemoteServiceMarker;
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 RemoteServiceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RemoteServiceEventStream {
RemoteServiceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#discover_characteristics(
&self,
) -> fidl::client::QueryResponseFut<
Vec<Characteristic>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#discover_characteristics(self)
}
pub fn r#read_by_type(
&self,
mut uuid: &fidl_fuchsia_bluetooth::Uuid,
) -> fidl::client::QueryResponseFut<
RemoteServiceReadByTypeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_by_type(self, uuid)
}
pub fn r#read_characteristic(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
) -> fidl::client::QueryResponseFut<
RemoteServiceReadCharacteristicResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_characteristic(self, handle, options)
}
pub fn r#write_characteristic(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
) -> fidl::client::QueryResponseFut<
RemoteServiceWriteCharacteristicResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_characteristic(self, handle, value, options)
}
pub fn r#read_descriptor(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
) -> fidl::client::QueryResponseFut<
RemoteServiceReadDescriptorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_descriptor(self, handle, options)
}
pub fn r#write_descriptor(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
) -> fidl::client::QueryResponseFut<
RemoteServiceWriteDescriptorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_descriptor(self, handle, value, options)
}
pub fn r#register_characteristic_notifier(
&self,
mut handle: &Handle,
mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
) -> fidl::client::QueryResponseFut<
RemoteServiceRegisterCharacteristicNotifierResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#register_characteristic_notifier(self, handle, notifier)
}
}
impl RemoteServiceProxyInterface for RemoteServiceProxy {
type DiscoverCharacteristicsResponseFut = fidl::client::QueryResponseFut<
Vec<Characteristic>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<Characteristic>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceDiscoverCharacteristicsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6cd730f12e402543,
>(_buf?)?;
Ok(_response.characteristics)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Characteristic>>(
(),
0x6cd730f12e402543,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadByTypeResponseFut = fidl::client::QueryResponseFut<
RemoteServiceReadByTypeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_by_type(
&self,
mut uuid: &fidl_fuchsia_bluetooth::Uuid,
) -> Self::ReadByTypeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x739bb1e313162bbc,
>(_buf?)?;
Ok(_response.map(|x| x.results))
}
self.client
.send_query_and_decode::<RemoteServiceReadByTypeRequest, RemoteServiceReadByTypeResult>(
(uuid,),
0x739bb1e313162bbc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadCharacteristicResponseFut = fidl::client::QueryResponseFut<
RemoteServiceReadCharacteristicResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_characteristic(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
) -> Self::ReadCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceReadCharacteristicResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RemoteServiceReadCharacteristicResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4d41757ed69a96cb,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadCharacteristicRequest,
RemoteServiceReadCharacteristicResult,
>(
(handle, options,),
0x4d41757ed69a96cb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteCharacteristicResponseFut = fidl::client::QueryResponseFut<
RemoteServiceWriteCharacteristicResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_characteristic(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
) -> Self::WriteCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceWriteCharacteristicResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7fc7511adecde8c,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RemoteServiceWriteCharacteristicRequest,
RemoteServiceWriteCharacteristicResult,
>(
(handle, value, options,),
0x7fc7511adecde8c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadDescriptorResponseFut = fidl::client::QueryResponseFut<
RemoteServiceReadDescriptorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_descriptor(
&self,
mut handle: &Handle,
mut options: &ReadOptions,
) -> Self::ReadDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceReadDescriptorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RemoteServiceReadDescriptorResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7ed7ce00457dcec1,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadDescriptorRequest,
RemoteServiceReadDescriptorResult,
>(
(handle, options,),
0x7ed7ce00457dcec1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteDescriptorResponseFut = fidl::client::QueryResponseFut<
RemoteServiceWriteDescriptorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_descriptor(
&self,
mut handle: &Handle,
mut value: &[u8],
mut options: &WriteOptions,
) -> Self::WriteDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceWriteDescriptorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x21d9106bfd6b7351,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RemoteServiceWriteDescriptorRequest,
RemoteServiceWriteDescriptorResult,
>(
(handle, value, options,),
0x21d9106bfd6b7351,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RegisterCharacteristicNotifierResponseFut = fidl::client::QueryResponseFut<
RemoteServiceRegisterCharacteristicNotifierResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#register_characteristic_notifier(
&self,
mut handle: &Handle,
mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
) -> Self::RegisterCharacteristicNotifierResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35007a85245f5cc6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RemoteServiceRegisterCharacteristicNotifierRequest,
RemoteServiceRegisterCharacteristicNotifierResult,
>(
(handle, notifier,),
0x35007a85245f5cc6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RemoteServiceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RemoteServiceEventStream {}
impl futures::stream::FusedStream for RemoteServiceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RemoteServiceEventStream {
type Item = Result<RemoteServiceEvent, 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(RemoteServiceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RemoteServiceEvent {}
impl RemoteServiceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RemoteServiceEvent, 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: <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RemoteServiceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RemoteServiceRequestStream {}
impl futures::stream::FusedStream for RemoteServiceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RemoteServiceRequestStream {
type Protocol = RemoteServiceMarker;
type ControlHandle = RemoteServiceControlHandle;
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 {
RemoteServiceControlHandle { 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 RemoteServiceRequestStream {
type Item = Result<RemoteServiceRequest, 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 RemoteServiceRequestStream 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 {
0x6cd730f12e402543 => {
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 =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::DiscoverCharacteristics {
responder: RemoteServiceDiscoverCharacteristicsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x739bb1e313162bbc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceReadByTypeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadByTypeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::ReadByType {
uuid: req.uuid,
responder: RemoteServiceReadByTypeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4d41757ed69a96cb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceReadCharacteristicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::ReadCharacteristic {
handle: req.handle,
options: req.options,
responder: RemoteServiceReadCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7fc7511adecde8c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceWriteCharacteristicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::WriteCharacteristic {
handle: req.handle,
value: req.value,
options: req.options,
responder: RemoteServiceWriteCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7ed7ce00457dcec1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceReadDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::ReadDescriptor {
handle: req.handle,
options: req.options,
responder: RemoteServiceReadDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x21d9106bfd6b7351 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceWriteDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::WriteDescriptor {
handle: req.handle,
value: req.value,
options: req.options,
responder: RemoteServiceWriteDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35007a85245f5cc6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceRegisterCharacteristicNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceRegisterCharacteristicNotifierRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::RegisterCharacteristicNotifier {
handle: req.handle,
notifier: req.notifier,
responder: RemoteServiceRegisterCharacteristicNotifierResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RemoteServiceRequest {
DiscoverCharacteristics { responder: RemoteServiceDiscoverCharacteristicsResponder },
ReadByType { uuid: fidl_fuchsia_bluetooth::Uuid, responder: RemoteServiceReadByTypeResponder },
ReadCharacteristic {
handle: Handle,
options: ReadOptions,
responder: RemoteServiceReadCharacteristicResponder,
},
WriteCharacteristic {
handle: Handle,
value: Vec<u8>,
options: WriteOptions,
responder: RemoteServiceWriteCharacteristicResponder,
},
ReadDescriptor {
handle: Handle,
options: ReadOptions,
responder: RemoteServiceReadDescriptorResponder,
},
WriteDescriptor {
handle: Handle,
value: Vec<u8>,
options: WriteOptions,
responder: RemoteServiceWriteDescriptorResponder,
},
RegisterCharacteristicNotifier {
handle: Handle,
notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
responder: RemoteServiceRegisterCharacteristicNotifierResponder,
},
}
impl RemoteServiceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_discover_characteristics(
self,
) -> Option<(RemoteServiceDiscoverCharacteristicsResponder)> {
if let RemoteServiceRequest::DiscoverCharacteristics { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_by_type(
self,
) -> Option<(fidl_fuchsia_bluetooth::Uuid, RemoteServiceReadByTypeResponder)> {
if let RemoteServiceRequest::ReadByType { uuid, responder } = self {
Some((uuid, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_characteristic(
self,
) -> Option<(Handle, ReadOptions, RemoteServiceReadCharacteristicResponder)> {
if let RemoteServiceRequest::ReadCharacteristic { handle, options, responder } = self {
Some((handle, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_characteristic(
self,
) -> Option<(Handle, Vec<u8>, WriteOptions, RemoteServiceWriteCharacteristicResponder)> {
if let RemoteServiceRequest::WriteCharacteristic { handle, value, options, responder } =
self
{
Some((handle, value, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_descriptor(
self,
) -> Option<(Handle, ReadOptions, RemoteServiceReadDescriptorResponder)> {
if let RemoteServiceRequest::ReadDescriptor { handle, options, responder } = self {
Some((handle, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_descriptor(
self,
) -> Option<(Handle, Vec<u8>, WriteOptions, RemoteServiceWriteDescriptorResponder)> {
if let RemoteServiceRequest::WriteDescriptor { handle, value, options, responder } = self {
Some((handle, value, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_characteristic_notifier(
self,
) -> Option<(
Handle,
fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
RemoteServiceRegisterCharacteristicNotifierResponder,
)> {
if let RemoteServiceRequest::RegisterCharacteristicNotifier {
handle,
notifier,
responder,
} = self
{
Some((handle, notifier, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RemoteServiceRequest::DiscoverCharacteristics { .. } => "discover_characteristics",
RemoteServiceRequest::ReadByType { .. } => "read_by_type",
RemoteServiceRequest::ReadCharacteristic { .. } => "read_characteristic",
RemoteServiceRequest::WriteCharacteristic { .. } => "write_characteristic",
RemoteServiceRequest::ReadDescriptor { .. } => "read_descriptor",
RemoteServiceRequest::WriteDescriptor { .. } => "write_descriptor",
RemoteServiceRequest::RegisterCharacteristicNotifier { .. } => {
"register_characteristic_notifier"
}
}
}
}
#[derive(Debug, Clone)]
pub struct RemoteServiceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RemoteServiceControlHandle {
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 RemoteServiceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceDiscoverCharacteristicsResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceDiscoverCharacteristicsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceDiscoverCharacteristicsResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceDiscoverCharacteristicsResponder {
pub fn send(self, mut characteristics: &[Characteristic]) -> Result<(), fidl::Error> {
let _result = self.send_raw(characteristics);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut characteristics: &[Characteristic],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(characteristics);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut characteristics: &[Characteristic]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceDiscoverCharacteristicsResponse>(
(characteristics,),
self.tx_id,
0x6cd730f12e402543,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceReadByTypeResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceReadByTypeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceReadByTypeResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceReadByTypeResponder {
pub fn send(self, mut result: Result<&[ReadByTypeResult], 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<&[ReadByTypeResult], Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[ReadByTypeResult], Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>>(
result.map(|results| (results,)),
self.tx_id,
0x739bb1e313162bbc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceReadCharacteristicResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceReadCharacteristicResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceReadCharacteristicResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceReadCharacteristicResponder {
pub fn send(self, mut result: Result<&ReadValue, 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<&ReadValue, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RemoteServiceReadCharacteristicResponse,
Error,
>>(
result.map(|value| (value,)),
self.tx_id,
0x4d41757ed69a96cb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceWriteCharacteristicResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceWriteCharacteristicResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceWriteCharacteristicResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceWriteCharacteristicResponder {
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,
0x7fc7511adecde8c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceReadDescriptorResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceReadDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceReadDescriptorResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceReadDescriptorResponder {
pub fn send(self, mut result: Result<&ReadValue, 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<&ReadValue, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RemoteServiceReadDescriptorResponse,
Error,
>>(
result.map(|value| (value,)),
self.tx_id,
0x7ed7ce00457dcec1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceWriteDescriptorResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceWriteDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceWriteDescriptorResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceWriteDescriptorResponder {
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,
0x21d9106bfd6b7351,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceRegisterCharacteristicNotifierResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceRegisterCharacteristicNotifierResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceRegisterCharacteristicNotifierResponder {
type ControlHandle = RemoteServiceControlHandle;
fn control_handle(&self) -> &RemoteServiceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteServiceRegisterCharacteristicNotifierResponder {
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,
0x35007a85245f5cc6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Server_Marker;
impl fidl::endpoints::ProtocolMarker for Server_Marker {
type Proxy = Server_Proxy;
type RequestStream = Server_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = Server_SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.gatt2.Server";
}
impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
pub type ServerPublishServiceResult = Result<(), PublishServiceError>;
pub trait Server_ProxyInterface: Send + Sync {
type PublishServiceResponseFut: std::future::Future<Output = Result<ServerPublishServiceResult, fidl::Error>>
+ Send;
fn r#publish_service(
&self,
info: &ServiceInfo,
service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
) -> Self::PublishServiceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct Server_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
type Proxy = Server_Proxy;
type Protocol = Server_Marker;
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 Server_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <Server_Marker 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<Server_Event, fidl::Error> {
Server_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish_service(
&self,
mut info: &ServiceInfo,
mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<ServerPublishServiceResult, fidl::Error> {
let _response =
self.client.send_query::<ServerPublishServiceRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PublishServiceError,
>>(
(info, service),
0x3110442f2077bfe2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct Server_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for Server_Proxy {
type Protocol = Server_Marker;
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 Server_Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> Server_EventStream {
Server_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish_service(
&self,
mut info: &ServiceInfo,
mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
) -> fidl::client::QueryResponseFut<
ServerPublishServiceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Server_ProxyInterface::r#publish_service(self, info, service)
}
}
impl Server_ProxyInterface for Server_Proxy {
type PublishServiceResponseFut = fidl::client::QueryResponseFut<
ServerPublishServiceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish_service(
&self,
mut info: &ServiceInfo,
mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
) -> Self::PublishServiceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ServerPublishServiceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishServiceError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3110442f2077bfe2,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<ServerPublishServiceRequest, ServerPublishServiceResult>(
(info, service),
0x3110442f2077bfe2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct Server_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for Server_EventStream {}
impl futures::stream::FusedStream for Server_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for Server_EventStream {
type Item = Result<Server_Event, 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(Server_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum Server_Event {}
impl Server_Event {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<Server_Event, 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: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct Server_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for Server_RequestStream {}
impl futures::stream::FusedStream for Server_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for Server_RequestStream {
type Protocol = Server_Marker;
type ControlHandle = Server_ControlHandle;
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 {
Server_ControlHandle { 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 Server_RequestStream {
type Item = Result<Server_Request, 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 Server_RequestStream 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 {
0x3110442f2077bfe2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ServerPublishServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerPublishServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Server_ControlHandle { inner: this.inner.clone() };
Ok(Server_Request::PublishService {
info: req.info,
service: req.service,
responder: Server_PublishServiceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum Server_Request {
PublishService {
info: ServiceInfo,
service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
responder: Server_PublishServiceResponder,
},
}
impl Server_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_publish_service(
self,
) -> Option<(
ServiceInfo,
fidl::endpoints::ClientEnd<LocalServiceMarker>,
Server_PublishServiceResponder,
)> {
if let Server_Request::PublishService { info, service, responder } = self {
Some((info, service, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
Server_Request::PublishService { .. } => "publish_service",
}
}
}
#[derive(Debug, Clone)]
pub struct Server_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for Server_ControlHandle {
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 Server_ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Server_PublishServiceResponder {
control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Server_PublishServiceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Server_PublishServiceResponder {
type ControlHandle = Server_ControlHandle;
fn control_handle(&self) -> &Server_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Server_PublishServiceResponder {
pub fn send(self, mut result: Result<(), PublishServiceError>) -> 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<(), PublishServiceError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PublishServiceError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PublishServiceError,
>>(
result,
self.tx_id,
0x3110442f2077bfe2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CharacteristicPropertyBits {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
impl fidl::encoding::ValueTypeMarker for CharacteristicPropertyBits {
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 CharacteristicPropertyBits
{
#[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);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CharacteristicPropertyBits
{
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
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::InvalidHandle
}
#[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 PublishServiceError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PublishServiceError {
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 PublishServiceError
{
#[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 PublishServiceError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceKind {
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 ServiceKind {
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 ServiceKind {
#[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 ServiceKind {
#[inline(always)]
fn new_empty() -> Self {
Self::Primary
}
#[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 WriteMode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for WriteMode {
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 WriteMode {
#[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 WriteMode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CharacteristicNotifierOnNotificationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CharacteristicNotifierOnNotificationRequest {
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<CharacteristicNotifierOnNotificationRequest, D>
for &CharacteristicNotifierOnNotificationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CharacteristicNotifierOnNotificationRequest>(offset);
fidl::encoding::Encode::<CharacteristicNotifierOnNotificationRequest, D>::encode(
(<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
fidl::encoding::Encode<CharacteristicNotifierOnNotificationRequest, 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::<CharacteristicNotifierOnNotificationRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CharacteristicNotifierOnNotificationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(ReadValue, 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!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ClientConnectToServiceRequest {
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 ClientConnectToServiceRequest {
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<
ClientConnectToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ClientConnectToServiceRequest
{
#[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::<ClientConnectToServiceRequest>(offset);
fidl::encoding::Encode::<ClientConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<ServiceHandle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ServiceHandle, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ClientConnectToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConnectToServiceRequest>(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 fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ClientConnectToServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(
ServiceHandle,
fidl::encoding::DefaultFuchsiaResourceDialect
),
service: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(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!(
ServiceHandle,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.handle,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientWatchServicesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientWatchServicesRequest {
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<ClientWatchServicesRequest, D> for &ClientWatchServicesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientWatchServicesRequest>(offset);
fidl::encoding::Encode::<ClientWatchServicesRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid> as fidl::encoding::ValueTypeMarker>::borrow(&self.uuids),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
D,
>,
> fidl::encoding::Encode<ClientWatchServicesRequest, 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::<ClientWatchServicesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientWatchServicesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
uuids: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
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<fidl_fuchsia_bluetooth::Uuid>,
D,
&mut self.uuids,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientWatchServicesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientWatchServicesResponse {
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<ClientWatchServicesResponse, D> for &ClientWatchServicesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientWatchServicesResponse>(offset);
fidl::encoding::Encode::<ClientWatchServicesResponse, D>::encode(
(
<fidl::encoding::Vector<ServiceInfo, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
<fidl::encoding::Vector<Handle, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<ServiceInfo, 65535>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<Handle, 65535>, D>,
> fidl::encoding::Encode<ClientWatchServicesResponse, 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::<ClientWatchServicesResponse>(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 ClientWatchServicesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
updated: fidl::new_empty!(fidl::encoding::Vector<ServiceInfo, 65535>, D),
removed: fidl::new_empty!(fidl::encoding::Vector<Handle, 65535>, 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::Vector<ServiceInfo, 65535>, D, &mut self.updated, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<Handle, 65535>, D, &mut self.removed, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Handle {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Handle {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Handle, D> for &Handle {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Handle>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Handle).write_unaligned((self as *const Handle).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<Handle, 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::<Handle>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Handle {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceCharacteristicConfigurationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceCharacteristicConfigurationRequest {
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<LocalServiceCharacteristicConfigurationRequest, D>
for &LocalServiceCharacteristicConfigurationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceCharacteristicConfigurationRequest>(offset);
fidl::encoding::Encode::<LocalServiceCharacteristicConfigurationRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.peer_id,
),
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.notify),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.indicate),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<Handle, D>,
T2: fidl::encoding::Encode<bool, D>,
T3: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<LocalServiceCharacteristicConfigurationRequest, D>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceCharacteristicConfigurationRequest>(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 + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 17, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceCharacteristicConfigurationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
handle: fidl::new_empty!(Handle, D),
notify: fidl::new_empty!(bool, D),
indicate: 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(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 8, _depth)?;
fidl::decode!(bool, D, &mut self.notify, decoder, offset + 16, _depth)?;
fidl::decode!(bool, D, &mut self.indicate, decoder, offset + 17, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for LocalServiceOnIndicateValueRequest {
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 LocalServiceOnIndicateValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
LocalServiceOnIndicateValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut LocalServiceOnIndicateValueRequest
{
#[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::<LocalServiceOnIndicateValueRequest>(offset);
fidl::encoding::Encode::<
LocalServiceOnIndicateValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<ValueChangedParameters as fidl::encoding::ValueTypeMarker>::borrow(
&self.update,
),
<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.confirmation,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
ValueChangedParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
LocalServiceOnIndicateValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceOnIndicateValueRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for LocalServiceOnIndicateValueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
update: fidl::new_empty!(
ValueChangedParameters,
fidl::encoding::DefaultFuchsiaResourceDialect
),
confirmation: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
ValueChangedParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.update,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.confirmation, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceReadValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceReadValueRequest {
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<LocalServiceReadValueRequest, D> for &LocalServiceReadValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceReadValueRequest>(offset);
fidl::encoding::Encode::<LocalServiceReadValueRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.peer_id,
),
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<Handle, D>,
T2: fidl::encoding::Encode<i32, D>,
> fidl::encoding::Encode<LocalServiceReadValueRequest, 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::<LocalServiceReadValueRequest>(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 + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceReadValueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
handle: fidl::new_empty!(Handle, D),
offset: fidl::new_empty!(i32, 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 = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 8, _depth)?;
fidl::decode!(i32, D, &mut self.offset, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceValueChangedCreditRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceValueChangedCreditRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LocalServiceValueChangedCreditRequest, D>
for &LocalServiceValueChangedCreditRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceValueChangedCreditRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LocalServiceValueChangedCreditRequest)
.write_unaligned((self as *const LocalServiceValueChangedCreditRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<LocalServiceValueChangedCreditRequest, 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::<LocalServiceValueChangedCreditRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceValueChangedCreditRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { additional_credit: 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);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceReadValueResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceReadValueResponse {
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<LocalServiceReadValueResponse, D>
for &LocalServiceReadValueResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceReadValueResponse>(offset);
fidl::encoding::Encode::<LocalServiceReadValueResponse, D>::encode(
(<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
> fidl::encoding::Encode<LocalServiceReadValueResponse, 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::<LocalServiceReadValueResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceReadValueResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
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<RemoteServiceDiscoverCharacteristicsResponse, D>
for &RemoteServiceDiscoverCharacteristicsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
fidl::encoding::Encode::<RemoteServiceDiscoverCharacteristicsResponse, D>::encode(
(
<fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<Characteristic, 32767>, D>,
> fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, 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::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceDiscoverCharacteristicsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
characteristics: fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, 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::Vector<Characteristic, 32767>, D, &mut self.characteristics, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D>
for &RemoteServiceReadByTypeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
fidl::encoding::Encode::<RemoteServiceReadByTypeRequest, D>::encode(
(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow(
&self.uuid,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Uuid, D>,
> fidl::encoding::Encode<RemoteServiceReadByTypeRequest, 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::<RemoteServiceReadByTypeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadByTypeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { uuid: fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, 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::Uuid,
D,
&mut self.uuid,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicRequest {
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<RemoteServiceReadCharacteristicRequest, D>
for &RemoteServiceReadCharacteristicRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
fidl::encoding::Encode::<RemoteServiceReadCharacteristicRequest, D>::encode(
(
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<ReadOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Handle, D>,
T1: fidl::encoding::Encode<ReadOptions, D>,
> fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, 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::<RemoteServiceReadCharacteristicRequest>(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 RemoteServiceReadCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Handle, D), options: fidl::new_empty!(ReadOptions, 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!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(ReadOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorRequest {
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<RemoteServiceReadDescriptorRequest, D>
for &RemoteServiceReadDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
fidl::encoding::Encode::<RemoteServiceReadDescriptorRequest, D>::encode(
(
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<ReadOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Handle, D>,
T1: fidl::encoding::Encode<ReadOptions, D>,
> fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, 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::<RemoteServiceReadDescriptorRequest>(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 RemoteServiceReadDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Handle, D), options: fidl::new_empty!(ReadOptions, 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!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(ReadOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RemoteServiceRegisterCharacteristicNotifierRequest {
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 RemoteServiceRegisterCharacteristicNotifierRequest {
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<
RemoteServiceRegisterCharacteristicNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RemoteServiceRegisterCharacteristicNotifierRequest
{
#[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::<RemoteServiceRegisterCharacteristicNotifierRequest>(offset);
fidl::encoding::Encode::<
RemoteServiceRegisterCharacteristicNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.notifier
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Handle, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RemoteServiceRegisterCharacteristicNotifierRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<RemoteServiceRegisterCharacteristicNotifierRequest>(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 fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RemoteServiceRegisterCharacteristicNotifierRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Handle, fidl::encoding::DefaultFuchsiaResourceDialect),
notifier: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(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!(
Handle,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.handle,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.notifier,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D>
for &RemoteServiceWriteCharacteristicRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
fidl::encoding::Encode::<RemoteServiceWriteCharacteristicRequest, D>::encode(
(
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),
<WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Handle, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
T2: fidl::encoding::Encode<WriteOptions, D>,
> fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, 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::<RemoteServiceWriteCharacteristicRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Handle, D),
value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
options: fidl::new_empty!(WriteOptions, 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!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
fidl::decode!(WriteOptions, D, &mut self.options, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D>
for &RemoteServiceWriteDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
fidl::encoding::Encode::<RemoteServiceWriteDescriptorRequest, D>::encode(
(
<Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),
<WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Handle, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
T2: fidl::encoding::Encode<WriteOptions, D>,
> fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, 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::<RemoteServiceWriteDescriptorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Handle, D),
value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
options: fidl::new_empty!(WriteOptions, 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!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
fidl::decode!(WriteOptions, D, &mut self.options, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeResponse {
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<RemoteServiceReadByTypeResponse, D>
for &RemoteServiceReadByTypeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
fidl::encoding::Encode::<RemoteServiceReadByTypeResponse, D>::encode(
(
<fidl::encoding::Vector<ReadByTypeResult, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 65535>, D>,
> fidl::encoding::Encode<RemoteServiceReadByTypeResponse, 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::<RemoteServiceReadByTypeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadByTypeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { results: fidl::new_empty!(fidl::encoding::Vector<ReadByTypeResult, 65535>, 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::Vector<ReadByTypeResult, 65535>, D, &mut self.results, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicResponse {
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<RemoteServiceReadCharacteristicResponse, D>
for &RemoteServiceReadCharacteristicResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
fidl::encoding::Encode::<RemoteServiceReadCharacteristicResponse, D>::encode(
(<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, 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::<RemoteServiceReadCharacteristicResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(ReadValue, 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!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorResponse {
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<RemoteServiceReadDescriptorResponse, D>
for &RemoteServiceReadDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
fidl::encoding::Encode::<RemoteServiceReadDescriptorResponse, D>::encode(
(<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, 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::<RemoteServiceReadDescriptorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(ReadValue, 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!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ServerPublishServiceRequest {
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 ServerPublishServiceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ServerPublishServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ServerPublishServiceRequest
{
#[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::<ServerPublishServiceRequest>(offset);
fidl::encoding::Encode::<ServerPublishServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<ServiceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ServerPublishServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ServerPublishServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
info: fidl::new_empty!(ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
service: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
ServiceInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceHandle {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceHandle {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceHandle, D>
for &ServiceHandle
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceHandle>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ServiceHandle)
.write_unaligned((self as *const ServiceHandle).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<ServiceHandle, 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::<ServiceHandle>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceHandle {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ShortReadOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ShortReadOptions {
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<ShortReadOptions, D>
for &ShortReadOptions
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ShortReadOptions>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ShortReadOptions {
#[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 AttributePermissions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.update {
return 3;
}
if let Some(_) = self.write {
return 2;
}
if let Some(_) = self.read {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AttributePermissions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AttributePermissions {
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<AttributePermissions, D>
for &AttributePermissions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AttributePermissions>(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::<SecurityRequirements, D>(
self.read
.as_ref()
.map(<SecurityRequirements 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::<SecurityRequirements, D>(
self.write
.as_ref()
.map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
self.update
.as_ref()
.map(<SecurityRequirements 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 AttributePermissions {
#[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 =
<SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.read.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
fidl::decode!(
SecurityRequirements,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.write.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
fidl::decode!(
SecurityRequirements,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.update.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
fidl::decode!(
SecurityRequirements,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 Characteristic {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.descriptors {
return 5;
}
if let Some(_) = self.permissions {
return 4;
}
if let Some(_) = self.properties {
return 3;
}
if let Some(_) = self.type_ {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Characteristic {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Characteristic {
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<Characteristic, D>
for &Characteristic
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Characteristic>(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::<Handle, D>(
self.handle.as_ref().map(<Handle 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::Uuid, D>(
self.type_
.as_ref()
.map(<fidl_fuchsia_bluetooth::Uuid 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::<CharacteristicPropertyBits, D>(
self.properties
.as_ref()
.map(<CharacteristicPropertyBits 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::<AttributePermissions, D>(
self.permissions
.as_ref()
.map(<AttributePermissions as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Descriptor, 65532>, D>(
self.descriptors.as_ref().map(<fidl::encoding::Vector<Descriptor, 65532> 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 Characteristic {
#[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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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::Uuid as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.type_
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
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 =
<CharacteristicPropertyBits 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
.properties
.get_or_insert_with(|| fidl::new_empty!(CharacteristicPropertyBits, D));
fidl::decode!(
CharacteristicPropertyBits,
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 =
<AttributePermissions 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
.permissions
.get_or_insert_with(|| fidl::new_empty!(AttributePermissions, D));
fidl::decode!(
AttributePermissions,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<Descriptor, 65532> 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.descriptors.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<Descriptor, 65532>, D),
);
fidl::decode!(fidl::encoding::Vector<Descriptor, 65532>, 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 Descriptor {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.permissions {
return 3;
}
if let Some(_) = self.type_ {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Descriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Descriptor {
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<Descriptor, D>
for &Descriptor
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Descriptor>(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::<Handle, D>(
self.handle.as_ref().map(<Handle 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::Uuid, D>(
self.type_
.as_ref()
.map(<fidl_fuchsia_bluetooth::Uuid 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::<AttributePermissions, D>(
self.permissions
.as_ref()
.map(<AttributePermissions 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 Descriptor {
#[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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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::Uuid as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.type_
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
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 =
<AttributePermissions 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
.permissions
.get_or_insert_with(|| fidl::new_empty!(AttributePermissions, D));
fidl::decode!(
AttributePermissions,
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 LocalServicePeerUpdateRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.mtu {
return 2;
}
if let Some(_) = self.peer_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LocalServicePeerUpdateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServicePeerUpdateRequest {
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<LocalServicePeerUpdateRequest, D>
for &LocalServicePeerUpdateRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServicePeerUpdateRequest>(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.peer_id.as_ref().map(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.mtu.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServicePeerUpdateRequest
{
#[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
.peer_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 =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl LocalServiceWriteValueRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.value {
return 4;
}
if let Some(_) = self.offset {
return 3;
}
if let Some(_) = self.handle {
return 2;
}
if let Some(_) = self.peer_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceWriteValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceWriteValueRequest {
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<LocalServiceWriteValueRequest, D>
for &LocalServiceWriteValueRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceWriteValueRequest>(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.peer_id.as_ref().map(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Handle, D>(
self.handle.as_ref().map(<Handle 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::<u32, D>(
self.offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 512>, D>(
self.value.as_ref().map(
<fidl::encoding::Vector<u8, 512> 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 LocalServiceWriteValueRequest
{
#[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
.peer_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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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 =
<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.offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::Vector<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.value
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
fidl::decode!(fidl::encoding::Vector<u8, 512>, 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 LongReadOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.max_bytes {
return 2;
}
if let Some(_) = self.offset {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LongReadOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LongReadOptions {
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<LongReadOptions, D>
for &LongReadOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LongReadOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.offset.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.max_bytes.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LongReadOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.offset.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.max_bytes.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl ReadByTypeResult {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.error {
return 3;
}
if let Some(_) = self.value {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ReadByTypeResult {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadByTypeResult {
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<ReadByTypeResult, D>
for &ReadByTypeResult
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadByTypeResult>(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::<Handle, D>(
self.handle.as_ref().map(<Handle 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::<ReadValue, D>(
self.value.as_ref().map(<ReadValue 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::<Error, D>(
self.error.as_ref().map(<Error 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 ReadByTypeResult {
#[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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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 =
<ReadValue 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.value.get_or_insert_with(|| fidl::new_empty!(ReadValue, D));
fidl::decode!(ReadValue, 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 =
<Error 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.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
fidl::decode!(Error, 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 ReadValue {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.maybe_truncated {
return 3;
}
if let Some(_) = self.value {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ReadValue {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadValue {
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<ReadValue, D>
for &ReadValue
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadValue>(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::<Handle, D>(
self.handle.as_ref().map(<Handle 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<u8, 512>, D>(
self.value.as_ref().map(
<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.maybe_truncated
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadValue {
#[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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.value
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
fidl::decode!(fidl::encoding::Vector<u8, 512>, 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.maybe_truncated.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl SecurityRequirements {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.authorization_required {
return 3;
}
if let Some(_) = self.authentication_required {
return 2;
}
if let Some(_) = self.encryption_required {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
for &SecurityRequirements
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityRequirements>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.encryption_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.authentication_required
.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.authorization_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.encryption_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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.authorization_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl ServiceInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.includes {
return 5;
}
if let Some(_) = self.characteristics {
return 4;
}
if let Some(_) = self.type_ {
return 3;
}
if let Some(_) = self.kind {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInfo {
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<ServiceInfo, D>
for &ServiceInfo
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInfo>(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::<ServiceHandle, D>(
self.handle
.as_ref()
.map(<ServiceHandle 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::<ServiceKind, D>(
self.kind.as_ref().map(<ServiceKind 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_fuchsia_bluetooth::Uuid, D>(
self.type_
.as_ref()
.map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Characteristic, 32767>, D>(
self.characteristics.as_ref().map(<fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ServiceHandle, 65535>, D>(
self.includes.as_ref().map(<fidl::encoding::Vector<ServiceHandle, 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 ServiceInfo {
#[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 =
<ServiceHandle 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.handle.get_or_insert_with(|| fidl::new_empty!(ServiceHandle, D));
fidl::decode!(ServiceHandle, 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 =
<ServiceKind 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.kind.get_or_insert_with(|| fidl::new_empty!(ServiceKind, D));
fidl::decode!(ServiceKind, 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_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.type_
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Uuid,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<Characteristic, 32767> 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.characteristics.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, D),
);
fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<ServiceHandle, 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.includes.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<ServiceHandle, 65535>, D),
);
fidl::decode!(fidl::encoding::Vector<ServiceHandle, 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 ValueChangedParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.peer_ids {
return 3;
}
if let Some(_) = self.value {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ValueChangedParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ValueChangedParameters {
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<ValueChangedParameters, D> for &ValueChangedParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ValueChangedParameters>(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::<Handle, D>(
self.handle.as_ref().map(<Handle 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<u8, 512>, D>(
self.value.as_ref().map(
<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>, D>(
self.peer_ids.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> 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 ValueChangedParameters
{
#[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 =
<Handle 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.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
fidl::decode!(Handle, 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<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.value
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
fidl::decode!(fidl::encoding::Vector<u8, 512>, 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::UnboundedVector<
fidl_fuchsia_bluetooth::PeerId,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.peer_ids.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<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;
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 WriteOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.offset {
return 2;
}
if let Some(_) = self.write_mode {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for WriteOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WriteOptions {
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<WriteOptions, D>
for &WriteOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WriteOptions>(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::<WriteMode, D>(
self.write_mode
.as_ref()
.map(<WriteMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.offset.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteOptions {
#[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 =
<WriteMode 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.write_mode.get_or_insert_with(|| fidl::new_empty!(WriteMode, D));
fidl::decode!(WriteMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.offset.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReadOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadOptions {
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<ReadOptions, D>
for &ReadOptions
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadOptions>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ReadOptions::ShortRead(ref val) => {
fidl::encoding::encode_in_envelope::<ShortReadOptions, D>(
<ShortReadOptions as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ReadOptions::LongRead(ref val) => {
fidl::encoding::encode_in_envelope::<LongReadOptions, D>(
<LongReadOptions as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ReadOptions::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadOptions {
#[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 => <ShortReadOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <LongReadOptions 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 ReadOptions::ShortRead(_) = self {
} else {
*self = ReadOptions::ShortRead(fidl::new_empty!(ShortReadOptions, D));
}
#[allow(irrefutable_let_patterns)]
if let ReadOptions::ShortRead(ref mut val) = self {
fidl::decode!(ShortReadOptions, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ReadOptions::LongRead(_) = self {
} else {
*self = ReadOptions::LongRead(fidl::new_empty!(LongReadOptions, D));
}
#[allow(irrefutable_let_patterns)]
if let ReadOptions::LongRead(ref mut val) = self {
fidl::decode!(LongReadOptions, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ReadOptions::__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(())
}
}
}