#![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 MAX_ATTRIBUTE_COUNT: u16 = 65535;
pub const MAX_CHARACTERISTIC_COUNT: u16 = 32767;
pub const MAX_DESCRIPTOR_COUNT: u16 = 65532;
pub const MAX_READ_BY_TYPE_RESULTS: u16 = 189;
pub const MAX_READ_BY_TYPE_VALUE_LENGTH: u16 = 253;
pub const MAX_SERVICE_COUNT: u16 = MAX_ATTRIBUTE_COUNT as u16;
pub const MAX_VALUE_LENGTH: u16 = 512;
pub const PROPERTY_AUTHENTICATED_SIGNED_WRITES: u32 = 64;
pub const PROPERTY_BROADCAST: u32 = 1;
pub const PROPERTY_INDICATE: u32 = 32;
pub const PROPERTY_NOTIFY: u32 = 16;
pub const PROPERTY_READ: u32 = 2;
pub const PROPERTY_RELIABLE_WRITE: u32 = 256;
pub const PROPERTY_WRITABLE_AUXILIARIES: u32 = 512;
pub const PROPERTY_WRITE: u32 = 8;
pub const PROPERTY_WRITE_WITHOUT_RESPONSE: u32 = 4;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
Failure = 1,
InvalidResponse = 2,
TooManyResults = 3,
InsufficientAuthorization = 4,
InsufficientAuthentication = 5,
InsufficientEncryptionKeySize = 6,
InsufficientEncryption = 7,
ReadNotPermitted = 8,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Failure),
2 => Some(Self::InvalidResponse),
3 => Some(Self::TooManyResults),
4 => Some(Self::InsufficientAuthorization),
5 => Some(Self::InsufficientAuthentication),
6 => Some(Self::InsufficientEncryptionKeySize),
7 => Some(Self::InsufficientEncryption),
8 => Some(Self::ReadNotPermitted),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ErrorCode {
NoError = 0,
InvalidOffset = 1,
InvalidValueLength = 2,
NotPermitted = 3,
}
impl ErrorCode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::NoError),
1 => Some(Self::InvalidOffset),
2 => Some(Self::InvalidValueLength),
3 => Some(Self::NotPermitted),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ReliableMode {
Disabled = 1,
Enabled = 2,
}
impl ReliableMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Disabled),
2 => Some(Self::Enabled),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AttributePermissions {
pub read: Option<Box<SecurityRequirements>>,
pub write: Option<Box<SecurityRequirements>>,
pub update: Option<Box<SecurityRequirements>>,
}
impl fidl::Persistable for AttributePermissions {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Characteristic {
pub id: u64,
pub type_: String,
pub properties: u32,
pub permissions: Option<Box<AttributePermissions>>,
pub descriptors: Option<Vec<Descriptor>>,
}
impl fidl::Persistable for Characteristic {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConnectToServiceRequest {
pub id: u64,
pub service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ClientConnectToServiceRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientListServicesRequest {
pub uuids: Option<Vec<String>>,
}
impl fidl::Persistable for ClientListServicesRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ClientListServicesResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub services: Vec<ServiceInfo>,
}
impl fidl::Persistable for ClientListServicesResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Descriptor {
pub id: u64,
pub type_: String,
pub permissions: Option<Box<AttributePermissions>>,
}
impl fidl::Persistable for Descriptor {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceDelegateOnCharacteristicConfigurationRequest {
pub characteristic_id: u64,
pub peer_id: String,
pub notify: bool,
pub indicate: bool,
}
impl fidl::Persistable for LocalServiceDelegateOnCharacteristicConfigurationRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LocalServiceDelegateOnReadValueRequest {
pub id: u64,
pub offset: i32,
}
impl fidl::Persistable for LocalServiceDelegateOnReadValueRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceDelegateOnReadValueResponse {
pub value: Option<Vec<u8>>,
pub status: ErrorCode,
}
impl fidl::Persistable for LocalServiceDelegateOnReadValueResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceDelegateOnWriteValueRequest {
pub id: u64,
pub offset: u16,
pub value: Vec<u8>,
}
impl fidl::Persistable for LocalServiceDelegateOnWriteValueRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceDelegateOnWriteValueResponse {
pub status: ErrorCode,
}
impl fidl::Persistable for LocalServiceDelegateOnWriteValueResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceDelegateOnWriteWithoutResponseRequest {
pub id: u64,
pub offset: u16,
pub value: Vec<u8>,
}
impl fidl::Persistable for LocalServiceDelegateOnWriteWithoutResponseRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LocalServiceNotifyValueRequest {
pub characteristic_id: u64,
pub peer_id: String,
pub value: Vec<u8>,
pub confirm: bool,
}
impl fidl::Persistable for LocalServiceNotifyValueRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceDiscoverCharacteristicsResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub characteristics: Vec<Characteristic>,
}
impl fidl::Persistable for RemoteServiceDiscoverCharacteristicsResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceNotifyCharacteristicRequest {
pub id: u64,
pub enable: bool,
}
impl fidl::Persistable for RemoteServiceNotifyCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceNotifyCharacteristicResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for RemoteServiceNotifyCharacteristicResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceOnCharacteristicValueUpdatedRequest {
pub id: u64,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceOnCharacteristicValueUpdatedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadByTypeRequest {
pub uuid: fidl_fuchsia_bluetooth::Uuid,
}
impl fidl::Persistable for RemoteServiceReadByTypeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RemoteServiceReadCharacteristicRequest {
pub id: u64,
}
impl fidl::Persistable for RemoteServiceReadCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadCharacteristicResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceReadCharacteristicResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RemoteServiceReadDescriptorRequest {
pub id: u64,
}
impl fidl::Persistable for RemoteServiceReadDescriptorRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadDescriptorResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceReadDescriptorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RemoteServiceReadLongCharacteristicRequest {
pub id: u64,
pub offset: u16,
pub max_bytes: u16,
}
impl fidl::Persistable for RemoteServiceReadLongCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadLongCharacteristicResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceReadLongCharacteristicResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RemoteServiceReadLongDescriptorRequest {
pub id: u64,
pub offset: u16,
pub max_bytes: u16,
}
impl fidl::Persistable for RemoteServiceReadLongDescriptorRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadLongDescriptorResponse {
pub status: fidl_fuchsia_bluetooth::Status,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceReadLongDescriptorResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceWriteCharacteristicRequest {
pub id: u64,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceWriteCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteCharacteristicResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for RemoteServiceWriteCharacteristicResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceWriteCharacteristicWithoutResponseRequest {
pub id: u64,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceWriteCharacteristicWithoutResponseRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceWriteDescriptorRequest {
pub id: u64,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceWriteDescriptorRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteDescriptorResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for RemoteServiceWriteDescriptorResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteLongCharacteristicRequest {
pub id: u64,
pub offset: u16,
pub value: Vec<u8>,
pub write_options: WriteOptions,
}
impl fidl::Persistable for RemoteServiceWriteLongCharacteristicRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteLongCharacteristicResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for RemoteServiceWriteLongCharacteristicResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteServiceWriteLongDescriptorRequest {
pub id: u64,
pub offset: u16,
pub value: Vec<u8>,
}
impl fidl::Persistable for RemoteServiceWriteLongDescriptorRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceWriteLongDescriptorResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for RemoteServiceWriteLongDescriptorResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteServiceReadByTypeResponse {
pub results: Vec<ReadByTypeResult>,
}
impl fidl::Persistable for RemoteServiceReadByTypeResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SecurityRequirements {
pub encryption_required: bool,
pub authentication_required: bool,
pub authorization_required: bool,
}
impl fidl::Persistable for SecurityRequirements {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServerPublishServiceRequest {
pub info: ServiceInfo,
pub delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
pub service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ServerPublishServiceRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct ServerPublishServiceResponse {
pub status: fidl_fuchsia_bluetooth::Status,
}
impl fidl::Persistable for ServerPublishServiceResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceInfo {
pub id: u64,
pub primary: bool,
pub type_: String,
pub characteristics: Option<Vec<Characteristic>>,
pub includes: Option<Vec<u64>>,
}
impl fidl::Persistable for ServiceInfo {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ReadByTypeResult {
pub id: Option<u64>,
pub value: Option<Vec<u8>>,
pub error: Option<Error>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ReadByTypeResult {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WriteOptions {
pub reliable_mode: Option<ReliableMode>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for WriteOptions {}
#[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 ListServicesResponseFut: std::future::Future<
Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error>,
> + Send;
fn r#list_services(&self, uuids: Option<&[String]>) -> Self::ListServicesResponseFut;
fn r#connect_to_service(
&self,
id: u64,
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#list_services(
&self,
mut uuids: Option<&[String]>,
___deadline: zx::MonotonicInstant,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error> {
let _response =
self.client.send_query::<ClientListServicesRequest, ClientListServicesResponse>(
(uuids,),
0x367b6c1e1540fb99,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.services))
}
pub fn r#connect_to_service(
&self,
mut id: u64,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ClientConnectToServiceRequest>(
(id, service),
0x45ca1666a35cd25,
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#list_services(
&self,
mut uuids: Option<&[String]>,
) -> fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ClientProxyInterface::r#list_services(self, uuids)
}
pub fn r#connect_to_service(
&self,
mut id: u64,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
ClientProxyInterface::r#connect_to_service(self, id, service)
}
}
impl ClientProxyInterface for ClientProxy {
type ListServicesResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#list_services(&self, mut uuids: Option<&[String]>) -> Self::ListServicesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ClientListServicesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x367b6c1e1540fb99,
>(_buf?)?;
Ok((_response.status, _response.services))
}
self.client.send_query_and_decode::<
ClientListServicesRequest,
(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
>(
(uuids,),
0x367b6c1e1540fb99,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect_to_service(
&self,
mut id: u64,
mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ClientConnectToServiceRequest>(
(id, service),
0x45ca1666a35cd25,
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 {
0x367b6c1e1540fb99 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ClientListServicesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientListServicesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientControlHandle { inner: this.inner.clone() };
Ok(ClientRequest::ListServices {
uuids: req.uuids,
responder: ClientListServicesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x45ca1666a35cd25 => {
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 {
id: req.id,
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 {
ListServices { uuids: Option<Vec<String>>, responder: ClientListServicesResponder },
ConnectToService {
id: u64,
service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
control_handle: ClientControlHandle,
},
}
impl ClientRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_list_services(self) -> Option<(Option<Vec<String>>, ClientListServicesResponder)> {
if let ClientRequest::ListServices { uuids, responder } = self {
Some((uuids, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_service(
self,
) -> Option<(u64, fidl::endpoints::ServerEnd<RemoteServiceMarker>, ClientControlHandle)> {
if let ClientRequest::ConnectToService { id, service, control_handle } = self {
Some((id, service, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ClientRequest::ListServices { .. } => "list_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 ClientListServicesResponder {
control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientListServicesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientListServicesResponder {
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 ClientListServicesResponder {
pub fn send(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut services: &[ServiceInfo],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, services);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut services: &[ServiceInfo],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, services);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut services: &[ServiceInfo],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ClientListServicesResponse>(
(status, services),
self.tx_id,
0x367b6c1e1540fb99,
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 trait LocalServiceProxyInterface: Send + Sync {
fn r#remove_service(&self) -> Result<(), fidl::Error>;
fn r#notify_value(
&self,
characteristic_id: u64,
peer_id: &str,
value: &[u8],
confirm: bool,
) -> 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#remove_service(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x53c92ea8871606f1,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#notify_value(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut value: &[u8],
mut confirm: bool,
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceNotifyValueRequest>(
(characteristic_id, peer_id, value, confirm),
0x5bb142dfdd6d1fa9,
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#remove_service(&self) -> Result<(), fidl::Error> {
LocalServiceProxyInterface::r#remove_service(self)
}
pub fn r#notify_value(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut value: &[u8],
mut confirm: bool,
) -> Result<(), fidl::Error> {
LocalServiceProxyInterface::r#notify_value(self, characteristic_id, peer_id, value, confirm)
}
}
impl LocalServiceProxyInterface for LocalServiceProxy {
fn r#remove_service(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x53c92ea8871606f1,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#notify_value(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut value: &[u8],
mut confirm: bool,
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceNotifyValueRequest>(
(characteristic_id, peer_id, value, confirm),
0x5bb142dfdd6d1fa9,
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 {}
impl LocalServiceEvent {
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 {
_ => 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 {
0x53c92ea8871606f1 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::RemoveService { control_handle })
}
0x5bb142dfdd6d1fa9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
LocalServiceNotifyValueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceNotifyValueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LocalServiceControlHandle { inner: this.inner.clone() };
Ok(LocalServiceRequest::NotifyValue {
characteristic_id: req.characteristic_id,
peer_id: req.peer_id,
value: req.value,
confirm: req.confirm,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LocalServiceRequest {
RemoveService { control_handle: LocalServiceControlHandle },
NotifyValue {
characteristic_id: u64,
peer_id: String,
value: Vec<u8>,
confirm: bool,
control_handle: LocalServiceControlHandle,
},
}
impl LocalServiceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_remove_service(self) -> Option<(LocalServiceControlHandle)> {
if let LocalServiceRequest::RemoveService { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_value(
self,
) -> Option<(u64, String, Vec<u8>, bool, LocalServiceControlHandle)> {
if let LocalServiceRequest::NotifyValue {
characteristic_id,
peer_id,
value,
confirm,
control_handle,
} = self
{
Some((characteristic_id, peer_id, value, confirm, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LocalServiceRequest::RemoveService { .. } => "remove_service",
LocalServiceRequest::NotifyValue { .. } => "notify_value",
}
}
}
#[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 {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LocalServiceDelegateMarker;
impl fidl::endpoints::ProtocolMarker for LocalServiceDelegateMarker {
type Proxy = LocalServiceDelegateProxy;
type RequestStream = LocalServiceDelegateRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LocalServiceDelegateSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) LocalServiceDelegate";
}
pub trait LocalServiceDelegateProxyInterface: Send + Sync {
fn r#on_characteristic_configuration(
&self,
characteristic_id: u64,
peer_id: &str,
notify: bool,
indicate: bool,
) -> Result<(), fidl::Error>;
type OnReadValueResponseFut: std::future::Future<Output = Result<(Option<Vec<u8>>, ErrorCode), fidl::Error>>
+ Send;
fn r#on_read_value(&self, id: u64, offset: i32) -> Self::OnReadValueResponseFut;
type OnWriteValueResponseFut: std::future::Future<Output = Result<ErrorCode, fidl::Error>>
+ Send;
fn r#on_write_value(&self, id: u64, offset: u16, value: &[u8])
-> Self::OnWriteValueResponseFut;
fn r#on_write_without_response(
&self,
id: u64,
offset: u16,
value: &[u8],
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LocalServiceDelegateSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LocalServiceDelegateSynchronousProxy {
type Proxy = LocalServiceDelegateProxy;
type Protocol = LocalServiceDelegateMarker;
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 LocalServiceDelegateSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<LocalServiceDelegateMarker 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<LocalServiceDelegateEvent, fidl::Error> {
LocalServiceDelegateEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_characteristic_configuration(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut notify: bool,
mut indicate: bool,
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
(characteristic_id, peer_id, notify, indicate),
0x71384022749a6e90,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#on_read_value(
&self,
mut id: u64,
mut offset: i32,
___deadline: zx::MonotonicInstant,
) -> Result<(Option<Vec<u8>>, ErrorCode), fidl::Error> {
let _response = self.client.send_query::<
LocalServiceDelegateOnReadValueRequest,
LocalServiceDelegateOnReadValueResponse,
>(
(id, offset,),
0x2f11da4cc774629,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.value, _response.status))
}
pub fn r#on_write_value(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<ErrorCode, fidl::Error> {
let _response = self.client.send_query::<
LocalServiceDelegateOnWriteValueRequest,
LocalServiceDelegateOnWriteValueResponse,
>(
(id, offset, value,),
0x2869075d462d3ea5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#on_write_without_response(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceDelegateOnWriteWithoutResponseRequest>(
(id, offset, value),
0x66ec30d296fd8d64,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct LocalServiceDelegateProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LocalServiceDelegateProxy {
type Protocol = LocalServiceDelegateMarker;
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 LocalServiceDelegateProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LocalServiceDelegateEventStream {
LocalServiceDelegateEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_characteristic_configuration(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut notify: bool,
mut indicate: bool,
) -> Result<(), fidl::Error> {
LocalServiceDelegateProxyInterface::r#on_characteristic_configuration(
self,
characteristic_id,
peer_id,
notify,
indicate,
)
}
pub fn r#on_read_value(
&self,
mut id: u64,
mut offset: i32,
) -> fidl::client::QueryResponseFut<
(Option<Vec<u8>>, ErrorCode),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LocalServiceDelegateProxyInterface::r#on_read_value(self, id, offset)
}
pub fn r#on_write_value(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> fidl::client::QueryResponseFut<ErrorCode, fidl::encoding::DefaultFuchsiaResourceDialect>
{
LocalServiceDelegateProxyInterface::r#on_write_value(self, id, offset, value)
}
pub fn r#on_write_without_response(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> Result<(), fidl::Error> {
LocalServiceDelegateProxyInterface::r#on_write_without_response(self, id, offset, value)
}
}
impl LocalServiceDelegateProxyInterface for LocalServiceDelegateProxy {
fn r#on_characteristic_configuration(
&self,
mut characteristic_id: u64,
mut peer_id: &str,
mut notify: bool,
mut indicate: bool,
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
(characteristic_id, peer_id, notify, indicate),
0x71384022749a6e90,
fidl::encoding::DynamicFlags::empty(),
)
}
type OnReadValueResponseFut = fidl::client::QueryResponseFut<
(Option<Vec<u8>>, ErrorCode),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#on_read_value(&self, mut id: u64, mut offset: i32) -> Self::OnReadValueResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(Option<Vec<u8>>, ErrorCode), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
LocalServiceDelegateOnReadValueResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2f11da4cc774629,
>(_buf?)?;
Ok((_response.value, _response.status))
}
self.client.send_query_and_decode::<
LocalServiceDelegateOnReadValueRequest,
(Option<Vec<u8>>, ErrorCode),
>(
(id, offset,),
0x2f11da4cc774629,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnWriteValueResponseFut =
fidl::client::QueryResponseFut<ErrorCode, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_write_value(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> Self::OnWriteValueResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ErrorCode, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
LocalServiceDelegateOnWriteValueResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2869075d462d3ea5,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<LocalServiceDelegateOnWriteValueRequest, ErrorCode>(
(id, offset, value),
0x2869075d462d3ea5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#on_write_without_response(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.client.send::<LocalServiceDelegateOnWriteWithoutResponseRequest>(
(id, offset, value),
0x66ec30d296fd8d64,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct LocalServiceDelegateEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LocalServiceDelegateEventStream {}
impl futures::stream::FusedStream for LocalServiceDelegateEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LocalServiceDelegateEventStream {
type Item = Result<LocalServiceDelegateEvent, 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(LocalServiceDelegateEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LocalServiceDelegateEvent {}
impl LocalServiceDelegateEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LocalServiceDelegateEvent, 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:
<LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LocalServiceDelegateRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LocalServiceDelegateRequestStream {}
impl futures::stream::FusedStream for LocalServiceDelegateRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LocalServiceDelegateRequestStream {
type Protocol = LocalServiceDelegateMarker;
type ControlHandle = LocalServiceDelegateControlHandle;
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 {
LocalServiceDelegateControlHandle { 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 LocalServiceDelegateRequestStream {
type Item = Result<LocalServiceDelegateRequest, 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 LocalServiceDelegateRequestStream 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 {
0x71384022749a6e90 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(LocalServiceDelegateOnCharacteristicConfigurationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LocalServiceDelegateControlHandle {
inner: this.inner.clone(),
};
Ok(LocalServiceDelegateRequest::OnCharacteristicConfiguration {characteristic_id: req.characteristic_id,
peer_id: req.peer_id,
notify: req.notify,
indicate: req.indicate,
control_handle,
})
}
0x2f11da4cc774629 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(LocalServiceDelegateOnReadValueRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnReadValueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LocalServiceDelegateControlHandle {
inner: this.inner.clone(),
};
Ok(LocalServiceDelegateRequest::OnReadValue {id: req.id,
offset: req.offset,
responder: LocalServiceDelegateOnReadValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2869075d462d3ea5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(LocalServiceDelegateOnWriteValueRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnWriteValueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LocalServiceDelegateControlHandle {
inner: this.inner.clone(),
};
Ok(LocalServiceDelegateRequest::OnWriteValue {id: req.id,
offset: req.offset,
value: req.value,
responder: LocalServiceDelegateOnWriteValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x66ec30d296fd8d64 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(LocalServiceDelegateOnWriteWithoutResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnWriteWithoutResponseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LocalServiceDelegateControlHandle {
inner: this.inner.clone(),
};
Ok(LocalServiceDelegateRequest::OnWriteWithoutResponse {id: req.id,
offset: req.offset,
value: req.value,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LocalServiceDelegateRequest {
OnCharacteristicConfiguration {
characteristic_id: u64,
peer_id: String,
notify: bool,
indicate: bool,
control_handle: LocalServiceDelegateControlHandle,
},
OnReadValue { id: u64, offset: i32, responder: LocalServiceDelegateOnReadValueResponder },
OnWriteValue {
id: u64,
offset: u16,
value: Vec<u8>,
responder: LocalServiceDelegateOnWriteValueResponder,
},
OnWriteWithoutResponse {
id: u64,
offset: u16,
value: Vec<u8>,
control_handle: LocalServiceDelegateControlHandle,
},
}
impl LocalServiceDelegateRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_characteristic_configuration(
self,
) -> Option<(u64, String, bool, bool, LocalServiceDelegateControlHandle)> {
if let LocalServiceDelegateRequest::OnCharacteristicConfiguration {
characteristic_id,
peer_id,
notify,
indicate,
control_handle,
} = self
{
Some((characteristic_id, peer_id, notify, indicate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_read_value(
self,
) -> Option<(u64, i32, LocalServiceDelegateOnReadValueResponder)> {
if let LocalServiceDelegateRequest::OnReadValue { id, offset, responder } = self {
Some((id, offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_write_value(
self,
) -> Option<(u64, u16, Vec<u8>, LocalServiceDelegateOnWriteValueResponder)> {
if let LocalServiceDelegateRequest::OnWriteValue { id, offset, value, responder } = self {
Some((id, offset, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_write_without_response(
self,
) -> Option<(u64, u16, Vec<u8>, LocalServiceDelegateControlHandle)> {
if let LocalServiceDelegateRequest::OnWriteWithoutResponse {
id,
offset,
value,
control_handle,
} = self
{
Some((id, offset, value, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LocalServiceDelegateRequest::OnCharacteristicConfiguration { .. } => {
"on_characteristic_configuration"
}
LocalServiceDelegateRequest::OnReadValue { .. } => "on_read_value",
LocalServiceDelegateRequest::OnWriteValue { .. } => "on_write_value",
LocalServiceDelegateRequest::OnWriteWithoutResponse { .. } => {
"on_write_without_response"
}
}
}
}
#[derive(Debug, Clone)]
pub struct LocalServiceDelegateControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LocalServiceDelegateControlHandle {
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 LocalServiceDelegateControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServiceDelegateOnReadValueResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceDelegateControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServiceDelegateOnReadValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServiceDelegateOnReadValueResponder {
type ControlHandle = LocalServiceDelegateControlHandle;
fn control_handle(&self) -> &LocalServiceDelegateControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServiceDelegateOnReadValueResponder {
pub fn send(self, mut value: Option<&[u8]>, mut status: ErrorCode) -> Result<(), fidl::Error> {
let _result = self.send_raw(value, status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut value: Option<&[u8]>,
mut status: ErrorCode,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(value, status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut value: Option<&[u8]>, mut status: ErrorCode) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LocalServiceDelegateOnReadValueResponse>(
(value, status),
self.tx_id,
0x2f11da4cc774629,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LocalServiceDelegateOnWriteValueResponder {
control_handle: std::mem::ManuallyDrop<LocalServiceDelegateControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LocalServiceDelegateOnWriteValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LocalServiceDelegateOnWriteValueResponder {
type ControlHandle = LocalServiceDelegateControlHandle;
fn control_handle(&self) -> &LocalServiceDelegateControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LocalServiceDelegateOnWriteValueResponder {
pub fn send(self, mut status: ErrorCode) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: ErrorCode) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: ErrorCode) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LocalServiceDelegateOnWriteValueResponse>(
(status,),
self.tx_id,
0x2869075d462d3ea5,
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 trait RemoteServiceProxyInterface: Send + Sync {
type DiscoverCharacteristicsResponseFut: std::future::Future<
Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error>,
> + Send;
fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut;
type ReadCharacteristicResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
+ Send;
fn r#read_characteristic(&self, id: u64) -> Self::ReadCharacteristicResponseFut;
type ReadLongCharacteristicResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
+ Send;
fn r#read_long_characteristic(
&self,
id: u64,
offset: u16,
max_bytes: u16,
) -> Self::ReadLongCharacteristicResponseFut;
type WriteCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#write_characteristic(&self, id: u64, value: &[u8])
-> Self::WriteCharacteristicResponseFut;
type WriteLongCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#write_long_characteristic(
&self,
id: u64,
offset: u16,
value: &[u8],
write_options: &WriteOptions,
) -> Self::WriteLongCharacteristicResponseFut;
fn r#write_characteristic_without_response(
&self,
id: u64,
value: &[u8],
) -> Result<(), fidl::Error>;
type ReadDescriptorResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
+ Send;
fn r#read_descriptor(&self, id: u64) -> Self::ReadDescriptorResponseFut;
type ReadLongDescriptorResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
+ Send;
fn r#read_long_descriptor(
&self,
id: u64,
offset: u16,
max_bytes: u16,
) -> Self::ReadLongDescriptorResponseFut;
type WriteDescriptorResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#write_descriptor(&self, id: u64, value: &[u8]) -> Self::WriteDescriptorResponseFut;
type WriteLongDescriptorResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#write_long_descriptor(
&self,
id: u64,
offset: u16,
value: &[u8],
) -> Self::WriteLongDescriptorResponseFut;
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 NotifyCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#notify_characteristic(
&self,
id: u64,
enable: bool,
) -> Self::NotifyCharacteristicResponseFut;
}
#[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<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
RemoteServiceDiscoverCharacteristicsResponse,
>(
(),
0x4c13b72543a8aa16,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.characteristics))
}
pub fn r#read_characteristic(
&self,
mut id: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadCharacteristicRequest,
RemoteServiceReadCharacteristicResponse,
>(
(id,),
0x200a5253bc0771c8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.value))
}
pub fn r#read_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
___deadline: zx::MonotonicInstant,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadLongCharacteristicRequest,
RemoteServiceReadLongCharacteristicResponse,
>(
(id, offset, max_bytes,),
0x2df2f20845555766,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.value))
}
pub fn r#write_characteristic(
&self,
mut id: u64,
mut value: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteCharacteristicRequest,
RemoteServiceWriteCharacteristicResponse,
>(
(id, value,),
0x5c1f529653cdad04,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#write_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
mut write_options: &WriteOptions,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteLongCharacteristicRequest,
RemoteServiceWriteLongCharacteristicResponse,
>(
(id, offset, value, write_options,),
0x2d358800658043e1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#write_characteristic_without_response(
&self,
mut id: u64,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.client.send::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
(id, value),
0x6eee4a248275f56e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#read_descriptor(
&self,
mut id: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = self
.client
.send_query::<RemoteServiceReadDescriptorRequest, RemoteServiceReadDescriptorResponse>(
(id,),
0x3d72215c1d23037a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.value))
}
pub fn r#read_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
___deadline: zx::MonotonicInstant,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceReadLongDescriptorRequest,
RemoteServiceReadLongDescriptorResponse,
>(
(id, offset, max_bytes,),
0x779efe322414240b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.value))
}
pub fn r#write_descriptor(
&self,
mut id: u64,
mut value: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteDescriptorRequest,
RemoteServiceWriteDescriptorResponse,
>(
(id, value,),
0x24c813d96509895,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#write_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceWriteLongDescriptorRequest,
RemoteServiceWriteLongDescriptorResponse,
>(
(id, offset, value,),
0x653c9dbe0138b47,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
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,),
0x72e84b1d5eb5c245,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.results))
}
pub fn r#notify_characteristic(
&self,
mut id: u64,
mut enable: bool,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = self.client.send_query::<
RemoteServiceNotifyCharacteristicRequest,
RemoteServiceNotifyCharacteristicResponse,
>(
(id, enable,),
0x615750fd68cbd159,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[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<
(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#discover_characteristics(self)
}
pub fn r#read_characteristic(
&self,
mut id: u64,
) -> fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_characteristic(self, id)
}
pub fn r#read_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
) -> fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_long_characteristic(self, id, offset, max_bytes)
}
pub fn r#write_characteristic(
&self,
mut id: u64,
mut value: &[u8],
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_characteristic(self, id, value)
}
pub fn r#write_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
mut write_options: &WriteOptions,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_long_characteristic(
self,
id,
offset,
value,
write_options,
)
}
pub fn r#write_characteristic_without_response(
&self,
mut id: u64,
mut value: &[u8],
) -> Result<(), fidl::Error> {
RemoteServiceProxyInterface::r#write_characteristic_without_response(self, id, value)
}
pub fn r#read_descriptor(
&self,
mut id: u64,
) -> fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_descriptor(self, id)
}
pub fn r#read_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
) -> fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#read_long_descriptor(self, id, offset, max_bytes)
}
pub fn r#write_descriptor(
&self,
mut id: u64,
mut value: &[u8],
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_descriptor(self, id, value)
}
pub fn r#write_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#write_long_descriptor(self, id, offset, value)
}
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#notify_characteristic(
&self,
mut id: u64,
mut enable: bool,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RemoteServiceProxyInterface::r#notify_characteristic(self, id, enable)
}
}
impl RemoteServiceProxyInterface for RemoteServiceProxy {
type DiscoverCharacteristicsResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, 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<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceDiscoverCharacteristicsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4c13b72543a8aa16,
>(_buf?)?;
Ok((_response.status, _response.characteristics))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>),
>(
(),
0x4c13b72543a8aa16,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadCharacteristicResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_characteristic(&self, mut id: u64) -> Self::ReadCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceReadCharacteristicResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x200a5253bc0771c8,
>(_buf?)?;
Ok((_response.status, _response.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadCharacteristicRequest,
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
>(
(id,),
0x200a5253bc0771c8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadLongCharacteristicResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
) -> Self::ReadLongCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceReadLongCharacteristicResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2df2f20845555766,
>(_buf?)?;
Ok((_response.status, _response.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadLongCharacteristicRequest,
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
>(
(id, offset, max_bytes,),
0x2df2f20845555766,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteCharacteristicResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_characteristic(
&self,
mut id: u64,
mut value: &[u8],
) -> Self::WriteCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceWriteCharacteristicResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5c1f529653cdad04,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<
RemoteServiceWriteCharacteristicRequest,
fidl_fuchsia_bluetooth::Status,
>(
(id, value,),
0x5c1f529653cdad04,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteLongCharacteristicResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_long_characteristic(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
mut write_options: &WriteOptions,
) -> Self::WriteLongCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceWriteLongCharacteristicResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2d358800658043e1,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<
RemoteServiceWriteLongCharacteristicRequest,
fidl_fuchsia_bluetooth::Status,
>(
(id, offset, value, write_options,),
0x2d358800658043e1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#write_characteristic_without_response(
&self,
mut id: u64,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.client.send::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
(id, value),
0x6eee4a248275f56e,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadDescriptorResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_descriptor(&self, mut id: u64) -> Self::ReadDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceReadDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3d72215c1d23037a,
>(_buf?)?;
Ok((_response.status, _response.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadDescriptorRequest,
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
>(
(id,),
0x3d72215c1d23037a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadLongDescriptorResponseFut = fidl::client::QueryResponseFut<
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut max_bytes: u16,
) -> Self::ReadLongDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceReadLongDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x779efe322414240b,
>(_buf?)?;
Ok((_response.status, _response.value))
}
self.client.send_query_and_decode::<
RemoteServiceReadLongDescriptorRequest,
(fidl_fuchsia_bluetooth::Status, Vec<u8>),
>(
(id, offset, max_bytes,),
0x779efe322414240b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteDescriptorResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_descriptor(
&self,
mut id: u64,
mut value: &[u8],
) -> Self::WriteDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceWriteDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x24c813d96509895,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<
RemoteServiceWriteDescriptorRequest,
fidl_fuchsia_bluetooth::Status,
>(
(id, value,),
0x24c813d96509895,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteLongDescriptorResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_long_descriptor(
&self,
mut id: u64,
mut offset: u16,
mut value: &[u8],
) -> Self::WriteLongDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceWriteLongDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x653c9dbe0138b47,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<
RemoteServiceWriteLongDescriptorRequest,
fidl_fuchsia_bluetooth::Status,
>(
(id, offset, value,),
0x653c9dbe0138b47,
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,
0x72e84b1d5eb5c245,
>(_buf?)?;
Ok(_response.map(|x| x.results))
}
self.client
.send_query_and_decode::<RemoteServiceReadByTypeRequest, RemoteServiceReadByTypeResult>(
(uuid,),
0x72e84b1d5eb5c245,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type NotifyCharacteristicResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#notify_characteristic(
&self,
mut id: u64,
mut enable: bool,
) -> Self::NotifyCharacteristicResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteServiceNotifyCharacteristicResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x615750fd68cbd159,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<
RemoteServiceNotifyCharacteristicRequest,
fidl_fuchsia_bluetooth::Status,
>(
(id, enable,),
0x615750fd68cbd159,
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 {
OnCharacteristicValueUpdated { id: u64, value: Vec<u8> },
}
impl RemoteServiceEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_characteristic_value_updated(self) -> Option<(u64, Vec<u8>)> {
if let RemoteServiceEvent::OnCharacteristicValueUpdated { id, value } = self {
Some((id, value))
} else {
None
}
}
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 {
0x304debe9d0408fac => {
let mut out = fidl::new_empty!(
RemoteServiceOnCharacteristicValueUpdatedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceOnCharacteristicValueUpdatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((RemoteServiceEvent::OnCharacteristicValueUpdated {
id: out.id,
value: out.value,
}))
}
_ => 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 {
0x4c13b72543a8aa16 => {
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,
},
})
}
0x200a5253bc0771c8 => {
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 {
id: req.id,
responder: RemoteServiceReadCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2df2f20845555766 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceReadLongCharacteristicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadLongCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::ReadLongCharacteristic {
id: req.id,
offset: req.offset,
max_bytes: req.max_bytes,
responder: RemoteServiceReadLongCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5c1f529653cdad04 => {
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 {
id: req.id,
value: req.value,
responder: RemoteServiceWriteCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2d358800658043e1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceWriteLongCharacteristicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteLongCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::WriteLongCharacteristic {
id: req.id,
offset: req.offset,
value: req.value,
write_options: req.write_options,
responder: RemoteServiceWriteLongCharacteristicResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6eee4a248275f56e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
RemoteServiceWriteCharacteristicWithoutResponseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::WriteCharacteristicWithoutResponse {
id: req.id,
value: req.value,
control_handle,
})
}
0x3d72215c1d23037a => {
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 {
id: req.id,
responder: RemoteServiceReadDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x779efe322414240b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceReadLongDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadLongDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::ReadLongDescriptor {
id: req.id,
offset: req.offset,
max_bytes: req.max_bytes,
responder: RemoteServiceReadLongDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x24c813d96509895 => {
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 {
id: req.id,
value: req.value,
responder: RemoteServiceWriteDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x653c9dbe0138b47 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceWriteLongDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteLongDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::WriteLongDescriptor {
id: req.id,
offset: req.offset,
value: req.value,
responder: RemoteServiceWriteLongDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x72e84b1d5eb5c245 => {
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,
},
})
}
0x615750fd68cbd159 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RemoteServiceNotifyCharacteristicRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceNotifyCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RemoteServiceControlHandle { inner: this.inner.clone() };
Ok(RemoteServiceRequest::NotifyCharacteristic {
id: req.id,
enable: req.enable,
responder: RemoteServiceNotifyCharacteristicResponder {
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 },
ReadCharacteristic { id: u64, responder: RemoteServiceReadCharacteristicResponder },
ReadLongCharacteristic {
id: u64,
offset: u16,
max_bytes: u16,
responder: RemoteServiceReadLongCharacteristicResponder,
},
WriteCharacteristic {
id: u64,
value: Vec<u8>,
responder: RemoteServiceWriteCharacteristicResponder,
},
WriteLongCharacteristic {
id: u64,
offset: u16,
value: Vec<u8>,
write_options: WriteOptions,
responder: RemoteServiceWriteLongCharacteristicResponder,
},
WriteCharacteristicWithoutResponse {
id: u64,
value: Vec<u8>,
control_handle: RemoteServiceControlHandle,
},
ReadDescriptor { id: u64, responder: RemoteServiceReadDescriptorResponder },
ReadLongDescriptor {
id: u64,
offset: u16,
max_bytes: u16,
responder: RemoteServiceReadLongDescriptorResponder,
},
WriteDescriptor { id: u64, value: Vec<u8>, responder: RemoteServiceWriteDescriptorResponder },
WriteLongDescriptor {
id: u64,
offset: u16,
value: Vec<u8>,
responder: RemoteServiceWriteLongDescriptorResponder,
},
ReadByType { uuid: fidl_fuchsia_bluetooth::Uuid, responder: RemoteServiceReadByTypeResponder },
NotifyCharacteristic {
id: u64,
enable: bool,
responder: RemoteServiceNotifyCharacteristicResponder,
},
}
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_characteristic(
self,
) -> Option<(u64, RemoteServiceReadCharacteristicResponder)> {
if let RemoteServiceRequest::ReadCharacteristic { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_long_characteristic(
self,
) -> Option<(u64, u16, u16, RemoteServiceReadLongCharacteristicResponder)> {
if let RemoteServiceRequest::ReadLongCharacteristic { id, offset, max_bytes, responder } =
self
{
Some((id, offset, max_bytes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_characteristic(
self,
) -> Option<(u64, Vec<u8>, RemoteServiceWriteCharacteristicResponder)> {
if let RemoteServiceRequest::WriteCharacteristic { id, value, responder } = self {
Some((id, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_long_characteristic(
self,
) -> Option<(u64, u16, Vec<u8>, WriteOptions, RemoteServiceWriteLongCharacteristicResponder)>
{
if let RemoteServiceRequest::WriteLongCharacteristic {
id,
offset,
value,
write_options,
responder,
} = self
{
Some((id, offset, value, write_options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_characteristic_without_response(
self,
) -> Option<(u64, Vec<u8>, RemoteServiceControlHandle)> {
if let RemoteServiceRequest::WriteCharacteristicWithoutResponse {
id,
value,
control_handle,
} = self
{
Some((id, value, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_descriptor(self) -> Option<(u64, RemoteServiceReadDescriptorResponder)> {
if let RemoteServiceRequest::ReadDescriptor { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_long_descriptor(
self,
) -> Option<(u64, u16, u16, RemoteServiceReadLongDescriptorResponder)> {
if let RemoteServiceRequest::ReadLongDescriptor { id, offset, max_bytes, responder } = self
{
Some((id, offset, max_bytes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_descriptor(
self,
) -> Option<(u64, Vec<u8>, RemoteServiceWriteDescriptorResponder)> {
if let RemoteServiceRequest::WriteDescriptor { id, value, responder } = self {
Some((id, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_long_descriptor(
self,
) -> Option<(u64, u16, Vec<u8>, RemoteServiceWriteLongDescriptorResponder)> {
if let RemoteServiceRequest::WriteLongDescriptor { id, offset, value, responder } = self {
Some((id, offset, value, 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_notify_characteristic(
self,
) -> Option<(u64, bool, RemoteServiceNotifyCharacteristicResponder)> {
if let RemoteServiceRequest::NotifyCharacteristic { id, enable, responder } = self {
Some((id, enable, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RemoteServiceRequest::DiscoverCharacteristics { .. } => "discover_characteristics",
RemoteServiceRequest::ReadCharacteristic { .. } => "read_characteristic",
RemoteServiceRequest::ReadLongCharacteristic { .. } => "read_long_characteristic",
RemoteServiceRequest::WriteCharacteristic { .. } => "write_characteristic",
RemoteServiceRequest::WriteLongCharacteristic { .. } => "write_long_characteristic",
RemoteServiceRequest::WriteCharacteristicWithoutResponse { .. } => {
"write_characteristic_without_response"
}
RemoteServiceRequest::ReadDescriptor { .. } => "read_descriptor",
RemoteServiceRequest::ReadLongDescriptor { .. } => "read_long_descriptor",
RemoteServiceRequest::WriteDescriptor { .. } => "write_descriptor",
RemoteServiceRequest::WriteLongDescriptor { .. } => "write_long_descriptor",
RemoteServiceRequest::ReadByType { .. } => "read_by_type",
RemoteServiceRequest::NotifyCharacteristic { .. } => "notify_characteristic",
}
}
}
#[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 {
pub fn send_on_characteristic_value_updated(
&self,
mut id: u64,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.inner.send::<RemoteServiceOnCharacteristicValueUpdatedRequest>(
(id, value),
0,
0x304debe9d0408fac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[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 status: &fidl_fuchsia_bluetooth::Status,
mut characteristics: &[Characteristic],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, characteristics);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut characteristics: &[Characteristic],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, characteristics);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut characteristics: &[Characteristic],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceDiscoverCharacteristicsResponse>(
(status, characteristics),
self.tx_id,
0x4c13b72543a8aa16,
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 status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceReadCharacteristicResponse>(
(status, value),
self.tx_id,
0x200a5253bc0771c8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceReadLongCharacteristicResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceReadLongCharacteristicResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceReadLongCharacteristicResponder {
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 RemoteServiceReadLongCharacteristicResponder {
pub fn send(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceReadLongCharacteristicResponse>(
(status, value),
self.tx_id,
0x2df2f20845555766,
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 status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceWriteCharacteristicResponse>(
(status,),
self.tx_id,
0x5c1f529653cdad04,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceWriteLongCharacteristicResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceWriteLongCharacteristicResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceWriteLongCharacteristicResponder {
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 RemoteServiceWriteLongCharacteristicResponder {
pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceWriteLongCharacteristicResponse>(
(status,),
self.tx_id,
0x2d358800658043e1,
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 status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceReadDescriptorResponse>(
(status, value),
self.tx_id,
0x3d72215c1d23037a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceReadLongDescriptorResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceReadLongDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceReadLongDescriptorResponder {
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 RemoteServiceReadLongDescriptorResponder {
pub fn send(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, value);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: &fidl_fuchsia_bluetooth::Status,
mut value: &[u8],
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceReadLongDescriptorResponse>(
(status, value),
self.tx_id,
0x779efe322414240b,
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 status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceWriteDescriptorResponse>(
(status,),
self.tx_id,
0x24c813d96509895,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceWriteLongDescriptorResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceWriteLongDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceWriteLongDescriptorResponder {
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 RemoteServiceWriteLongDescriptorResponder {
pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceWriteLongDescriptorResponse>(
(status,),
self.tx_id,
0x653c9dbe0138b47,
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,
0x72e84b1d5eb5c245,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteServiceNotifyCharacteristicResponder {
control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteServiceNotifyCharacteristicResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteServiceNotifyCharacteristicResponder {
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 RemoteServiceNotifyCharacteristicResponder {
pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteServiceNotifyCharacteristicResponse>(
(status,),
self.tx_id,
0x615750fd68cbd159,
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.gatt.Server";
}
impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
pub trait Server_ProxyInterface: Send + Sync {
type PublishServiceResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
+ Send;
fn r#publish_service(
&self,
info: &ServiceInfo,
delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
service: fidl::endpoints::ServerEnd<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 delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response =
self.client.send_query::<ServerPublishServiceRequest, ServerPublishServiceResponse>(
(info, delegate, service),
0x3b8b6f0988adb8c2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[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 delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Server_ProxyInterface::r#publish_service(self, info, delegate, service)
}
}
impl Server_ProxyInterface for Server_Proxy {
type PublishServiceResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::Status,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish_service(
&self,
mut info: &ServiceInfo,
mut delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
) -> Self::PublishServiceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ServerPublishServiceResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b8b6f0988adb8c2,
>(_buf?)?;
Ok(_response.status)
}
self.client
.send_query_and_decode::<ServerPublishServiceRequest, fidl_fuchsia_bluetooth::Status>(
(info, delegate, service),
0x3b8b6f0988adb8c2,
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 {
0x3b8b6f0988adb8c2 => {
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,
delegate: req.delegate,
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,
delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
responder: Server_PublishServiceResponder,
},
}
impl Server_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_publish_service(
self,
) -> Option<(
ServiceInfo,
fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
fidl::endpoints::ServerEnd<LocalServiceMarker>,
Server_PublishServiceResponder,
)> {
if let Server_Request::PublishService { info, delegate, service, responder } = self {
Some((info, delegate, 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 status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &fidl_fuchsia_bluetooth::Status,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ServerPublishServiceResponse>(
(status,),
self.tx_id,
0x3b8b6f0988adb8c2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
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::Failure
}
#[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 ErrorCode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ErrorCode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
#[inline(always)]
fn new_empty() -> Self {
Self::NoError
}
#[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 ReliableMode {
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 ReliableMode {
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 ReliableMode {
#[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 ReliableMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Disabled
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for 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 {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AttributePermissions, D>
for &AttributePermissions
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AttributePermissions>(offset);
fidl::encoding::Encode::<AttributePermissions, D>::encode(
(
<fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.read),
<fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.write),
<fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.update),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
> fidl::encoding::Encode<AttributePermissions, 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::<AttributePermissions>(offset);
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 AttributePermissions {
#[inline(always)]
fn new_empty() -> Self {
Self {
read: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
write: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
update: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Boxed<SecurityRequirements>,
D,
&mut self.read,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<SecurityRequirements>,
D,
&mut self.write,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<SecurityRequirements>,
D,
&mut self.update,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
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 {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Characteristic, D>
for &Characteristic
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Characteristic>(offset);
fidl::encoding::Encode::<Characteristic, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
<fidl::encoding::Boxed<AttributePermissions> as fidl::encoding::ValueTypeMarker>::borrow(&self.permissions),
<fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>> as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptors),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<fidl::encoding::Boxed<AttributePermissions>, D>,
T4: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
D,
>,
> fidl::encoding::Encode<Characteristic, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Characteristic>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(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 + 24, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
self.4.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Characteristic {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
properties: fidl::new_empty!(u32, D),
permissions: fidl::new_empty!(fidl::encoding::Boxed<AttributePermissions>, D),
descriptors: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
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(24) };
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 + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<36>,
D,
&mut self.type_,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u32, D, &mut self.properties, decoder, offset + 24, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<AttributePermissions>,
D,
&mut self.permissions,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
D,
&mut self.descriptors,
decoder,
offset + 40,
_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(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<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<u64, 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 {
id: fidl::new_empty!(u64, 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!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
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 ClientListServicesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientListServicesRequest {
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<ClientListServicesRequest, D> for &ClientListServicesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientListServicesRequest>(offset);
fidl::encoding::Encode::<ClientListServicesRequest, D>::encode(
(<fidl::encoding::Optional<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
> as fidl::encoding::ValueTypeMarker>::borrow(&self.uuids),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
>,
D,
>,
> fidl::encoding::Encode<ClientListServicesRequest, 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::<ClientListServicesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientListServicesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
uuids: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
>,
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::Optional<
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
>,
D,
&mut self.uuids,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientListServicesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientListServicesResponse {
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<ClientListServicesResponse, D> for &ClientListServicesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientListServicesResponse>(offset);
fidl::encoding::Encode::<ClientListServicesResponse, D>::encode(
(
<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Vector<ServiceInfo, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.services),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<ServiceInfo, 65535>, D>,
> fidl::encoding::Encode<ClientListServicesResponse, 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::<ClientListServicesResponse>(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 ClientListServicesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
services: fidl::new_empty!(fidl::encoding::Vector<ServiceInfo, 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_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<ServiceInfo, 65535>, D, &mut self.services, decoder, offset + 8, _depth)?;
Ok(())
}
}
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 {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Descriptor, D>
for &Descriptor
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Descriptor>(offset);
fidl::encoding::Encode::<Descriptor, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<fidl::encoding::Boxed<AttributePermissions> as fidl::encoding::ValueTypeMarker>::borrow(&self.permissions),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Boxed<AttributePermissions>, D>,
> fidl::encoding::Encode<Descriptor, 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::<Descriptor>(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 Descriptor {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
permissions: fidl::new_empty!(fidl::encoding::Boxed<AttributePermissions>, 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!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<36>,
D,
&mut self.type_,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<AttributePermissions>,
D,
&mut self.permissions,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnCharacteristicConfigurationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker
for LocalServiceDelegateOnCharacteristicConfigurationRequest
{
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<LocalServiceDelegateOnCharacteristicConfigurationRequest, D>
for &LocalServiceDelegateOnCharacteristicConfigurationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
offset,
);
fidl::encoding::Encode::<LocalServiceDelegateOnCharacteristicConfigurationRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristic_id),
<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<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<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
T2: fidl::encoding::Encode<bool, D>,
T3: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<LocalServiceDelegateOnCharacteristicConfigurationRequest, 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::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
offset,
);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(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 + 24, depth)?;
self.3.encode(encoder, offset + 25, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnCharacteristicConfigurationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
characteristic_id: fidl::new_empty!(u64, D),
peer_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, 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(24) };
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 + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.characteristic_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<16>,
D,
&mut self.peer_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(bool, D, &mut self.notify, decoder, offset + 24, _depth)?;
fidl::decode!(bool, D, &mut self.indicate, decoder, offset + 25, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnReadValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnReadValueRequest {
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<LocalServiceDelegateOnReadValueRequest, D>
for &LocalServiceDelegateOnReadValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LocalServiceDelegateOnReadValueRequest).write_unaligned(
(self as *const LocalServiceDelegateOnReadValueRequest).read(),
);
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<i32, D>,
> fidl::encoding::Encode<LocalServiceDelegateOnReadValueRequest, 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::<LocalServiceDelegateOnReadValueRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnReadValueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u64, 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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnReadValueResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnReadValueResponse {
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<LocalServiceDelegateOnReadValueResponse, D>
for &LocalServiceDelegateOnReadValueResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueResponse>(offset);
fidl::encoding::Encode::<LocalServiceDelegateOnReadValueResponse, D>::encode(
(
<fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D,
>,
T1: fidl::encoding::Encode<ErrorCode, D>,
> fidl::encoding::Encode<LocalServiceDelegateOnReadValueResponse, 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::<LocalServiceDelegateOnReadValueResponse>(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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnReadValueResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
value: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D
),
status: fidl::new_empty!(ErrorCode, 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::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D,
&mut self.value,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueRequest {
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<LocalServiceDelegateOnWriteValueRequest, D>
for &LocalServiceDelegateOnWriteValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueRequest>(offset);
fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<LocalServiceDelegateOnWriteValueRequest, 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::<LocalServiceDelegateOnWriteValueRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnWriteValueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, D>
for &LocalServiceDelegateOnWriteValueResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueResponse>(offset);
fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueResponse, D>::encode(
(<ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ErrorCode, D>>
fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, 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::<LocalServiceDelegateOnWriteValueResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnWriteValueResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(ErrorCode, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
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<LocalServiceDelegateOnWriteWithoutResponseRequest, D>
for &LocalServiceDelegateOnWriteWithoutResponseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceDelegateOnWriteWithoutResponseRequest>(offset);
fidl::encoding::Encode::<LocalServiceDelegateOnWriteWithoutResponseRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<LocalServiceDelegateOnWriteWithoutResponseRequest, 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::<LocalServiceDelegateOnWriteWithoutResponseRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceDelegateOnWriteWithoutResponseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LocalServiceNotifyValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LocalServiceNotifyValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LocalServiceNotifyValueRequest, D>
for &LocalServiceNotifyValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalServiceNotifyValueRequest>(offset);
fidl::encoding::Encode::<LocalServiceNotifyValueRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristic_id),
<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.confirm),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
T3: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<LocalServiceNotifyValueRequest, 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::<LocalServiceNotifyValueRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(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 + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LocalServiceNotifyValueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
characteristic_id: fidl::new_empty!(u64, D),
peer_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
confirm: 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(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.characteristic_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<16>,
D,
&mut self.peer_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(bool, D, &mut self.confirm, decoder, offset + 40, _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 {
24
}
}
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_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<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_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<Characteristic, 32767>, D>,
> fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, 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::<RemoteServiceDiscoverCharacteristicsResponse>(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 RemoteServiceDiscoverCharacteristicsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
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_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, &mut self.characteristics, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicRequest {
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<RemoteServiceNotifyCharacteristicRequest, D>
for &RemoteServiceNotifyCharacteristicRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicRequest>(offset);
fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<RemoteServiceNotifyCharacteristicRequest, 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::<RemoteServiceNotifyCharacteristicRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceNotifyCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u64, D), enable: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.enable, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, D>
for &RemoteServiceNotifyCharacteristicResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicResponse>(offset);
fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, 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::<RemoteServiceNotifyCharacteristicResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceNotifyCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
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<RemoteServiceOnCharacteristicValueUpdatedRequest, D>
for &RemoteServiceOnCharacteristicValueUpdatedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceOnCharacteristicValueUpdatedRequest>(offset);
fidl::encoding::Encode::<RemoteServiceOnCharacteristicValueUpdatedRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceOnCharacteristicValueUpdatedRequest, 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::<RemoteServiceOnCharacteristicValueUpdatedRequest>(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 RemoteServiceOnCharacteristicValueUpdatedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 8,
_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 {
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<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);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RemoteServiceReadCharacteristicRequest).write_unaligned(
(self as *const RemoteServiceReadCharacteristicRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, 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::<RemoteServiceReadCharacteristicRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: 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 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 {
24
}
}
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(
(
<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, 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::<RemoteServiceReadCharacteristicResponse>(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 RemoteServiceReadCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
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 {
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<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);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RemoteServiceReadDescriptorRequest)
.write_unaligned((self as *const RemoteServiceReadDescriptorRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, 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::<RemoteServiceReadDescriptorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: 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 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 {
24
}
}
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(
(
<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, 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::<RemoteServiceReadDescriptorResponse>(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 RemoteServiceReadDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicRequest {
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<RemoteServiceReadLongCharacteristicRequest, D>
for &RemoteServiceReadLongCharacteristicRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RemoteServiceReadLongCharacteristicRequest).write_unaligned(
(self as *const RemoteServiceReadLongCharacteristicRequest).read(),
);
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, 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::<RemoteServiceReadLongCharacteristicRequest>(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)?;
self.2.encode(encoder, offset + 10, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadLongCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
max_bytes: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicResponse {
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<RemoteServiceReadLongCharacteristicResponse, D>
for &RemoteServiceReadLongCharacteristicResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
fidl::encoding::Encode::<RemoteServiceReadLongCharacteristicResponse, D>::encode(
(
<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),
<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_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
> fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, 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::<RemoteServiceReadLongCharacteristicResponse>(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 RemoteServiceReadLongCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
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_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorRequest {
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<RemoteServiceReadLongDescriptorRequest, D>
for &RemoteServiceReadLongDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RemoteServiceReadLongDescriptorRequest).write_unaligned(
(self as *const RemoteServiceReadLongDescriptorRequest).read(),
);
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, 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::<RemoteServiceReadLongDescriptorRequest>(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)?;
self.2.encode(encoder, offset + 10, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceReadLongDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
max_bytes: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorResponse {
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<RemoteServiceReadLongDescriptorResponse, D>
for &RemoteServiceReadLongDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
fidl::encoding::Encode::<RemoteServiceReadLongDescriptorResponse, D>::encode(
(
<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, 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::<RemoteServiceReadLongDescriptorResponse>(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 RemoteServiceReadLongDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
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 {
24
}
}
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(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, 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::<RemoteServiceWriteCharacteristicRequest>(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 RemoteServiceWriteCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D>
for &RemoteServiceWriteCharacteristicResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
fidl::encoding::Encode::<RemoteServiceWriteCharacteristicResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, 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::<RemoteServiceWriteCharacteristicResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
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<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
for &RemoteServiceWriteCharacteristicWithoutResponseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
offset,
);
fidl::encoding::Encode::<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, 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::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
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 RemoteServiceWriteCharacteristicWithoutResponseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 8,
_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 {
24
}
}
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(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, 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::<RemoteServiceWriteDescriptorRequest>(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 RemoteServiceWriteDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.value,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D>
for &RemoteServiceWriteDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
fidl::encoding::Encode::<RemoteServiceWriteDescriptorResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, 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::<RemoteServiceWriteDescriptorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D>
for &RemoteServiceWriteLongCharacteristicRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),
<WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.write_options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
T3: fidl::encoding::Encode<WriteOptions, D>,
> fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, 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::<RemoteServiceWriteLongCharacteristicRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteLongCharacteristicRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
write_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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
fidl::decode!(WriteOptions, D, &mut self.write_options, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D>
for &RemoteServiceWriteLongCharacteristicResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, 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::<RemoteServiceWriteLongCharacteristicResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteLongCharacteristicResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorRequest {
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<RemoteServiceWriteLongDescriptorRequest, D>
for &RemoteServiceWriteLongDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
<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<u64, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
> fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, 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::<RemoteServiceWriteLongDescriptorRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteLongDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u16, D),
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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D>
for &RemoteServiceWriteLongDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, 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::<RemoteServiceWriteLongDescriptorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RemoteServiceWriteLongDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_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, 189> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 189>, 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, 189>, 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, 189>, D, &mut self.results, decoder, offset + 0, _depth)?;
Ok(())
}
}
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 {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
3
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
for &SecurityRequirements
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SecurityRequirements>(offset);
fidl::encoding::Encode::<SecurityRequirements, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_required),
<bool as fidl::encoding::ValueTypeMarker>::borrow(
&self.authentication_required,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authorization_required),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<SecurityRequirements, 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::<SecurityRequirements>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
#[inline(always)]
fn new_empty() -> Self {
Self {
encryption_required: fidl::new_empty!(bool, D),
authentication_required: fidl::new_empty!(bool, D),
authorization_required: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.encryption_required, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.authentication_required, decoder, offset + 1, _depth)?;
fidl::decode!(bool, D, &mut self.authorization_required, decoder, offset + 2, _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 {
72
}
}
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<LocalServiceDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<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<LocalServiceDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ServerPublishServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 64, depth)?;
self.2.encode(encoder, offset + 68, 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),
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
service: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<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);
fidl::decode!(
ServiceInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 64,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 68,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServerPublishServiceResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ServerPublishServiceResponse, D> for &ServerPublishServiceResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
fidl::encoding::Encode::<ServerPublishServiceResponse, D>::encode(
(<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
&self.status,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
> fidl::encoding::Encode<ServerPublishServiceResponse, 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::<ServerPublishServiceResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServerPublishServiceResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, 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::Status,
D,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
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 {
64
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceInfo, D>
for &ServiceInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInfo>(offset);
fidl::encoding::Encode::<ServiceInfo, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
<fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
<fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>> as fidl::encoding::ValueTypeMarker>::borrow(&self.includes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
T3: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
D,
>,
T4: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>, D>,
> fidl::encoding::Encode<ServiceInfo, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInfo>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
self.4.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, D),
primary: fidl::new_empty!(bool, D),
type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
characteristics: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
D
),
includes: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<u64, 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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.primary, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<36>,
D,
&mut self.type_,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
D,
&mut self.characteristics,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
D,
&mut self.includes,
decoder,
offset + 48,
_depth
)?;
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.id {
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::<u64, D>(
self.id.as_ref().map(<u64 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, 253>, D>(
self.value.as_ref().map(
<fidl::encoding::Vector<u8, 253> 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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, 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, 253> 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, 253>, D));
fidl::decode!(fidl::encoding::Vector<u8, 253>, 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 WriteOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.reliable_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::<ReliableMode, D>(
self.reliable_mode
.as_ref()
.map(<ReliableMode 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 =
<ReliableMode 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.reliable_mode.get_or_insert_with(|| fidl::new_empty!(ReliableMode, D));
fidl::decode!(ReliableMode, 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(())
}
}
}