#![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;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MockPeerConnectProxyRequest {
pub interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for MockPeerConnectProxyRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerObserverPeerConnectedRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>,
}
impl fidl::Persistable for PeerObserverPeerConnectedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerObserverServiceFoundRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Option<Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>>,
pub attributes: Vec<fidl_fuchsia_bluetooth_bredr::Attribute>,
}
impl fidl::Persistable for PeerObserverServiceFoundRequest {}
#[derive(Debug, PartialEq)]
pub struct ProfileTestRegisterPeerRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
pub observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileTestRegisterPeerRequest
{
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MockPeerMarker;
impl fidl::endpoints::ProtocolMarker for MockPeerMarker {
type Proxy = MockPeerProxy;
type RequestStream = MockPeerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MockPeerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MockPeer";
}
pub trait MockPeerProxyInterface: Send + Sync {
type ConnectProxy_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#connect_proxy_(
&self,
interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
) -> Self::ConnectProxy_ResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MockPeerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MockPeerSynchronousProxy {
type Proxy = MockPeerProxy;
type Protocol = MockPeerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl MockPeerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<MockPeerEvent, fidl::Error> {
MockPeerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<MockPeerConnectProxyRequest, fidl::encoding::EmptyPayload>(
(interface,),
0x578ee1f7ee6dd9d8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct MockPeerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MockPeerProxy {
type Protocol = MockPeerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl MockPeerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MockPeerEventStream {
MockPeerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
MockPeerProxyInterface::r#connect_proxy_(self, interface)
}
}
impl MockPeerProxyInterface for MockPeerProxy {
type ConnectProxy_ResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#connect_proxy_(
&self,
mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
) -> Self::ConnectProxy_ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x578ee1f7ee6dd9d8,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<MockPeerConnectProxyRequest, ()>(
(interface,),
0x578ee1f7ee6dd9d8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MockPeerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MockPeerEventStream {}
impl futures::stream::FusedStream for MockPeerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MockPeerEventStream {
type Item = Result<MockPeerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(MockPeerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MockPeerEvent {}
impl MockPeerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MockPeerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MockPeerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MockPeerRequestStream {}
impl futures::stream::FusedStream for MockPeerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MockPeerRequestStream {
type Protocol = MockPeerMarker;
type ControlHandle = MockPeerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
MockPeerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 MockPeerRequestStream {
type Item = Result<MockPeerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled MockPeerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x578ee1f7ee6dd9d8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MockPeerConnectProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MockPeerConnectProxyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = MockPeerControlHandle { inner: this.inner.clone() };
Ok(MockPeerRequest::ConnectProxy_ {
interface: req.interface,
responder: MockPeerConnectProxy_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<MockPeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MockPeerRequest {
ConnectProxy_ {
interface: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
responder: MockPeerConnectProxy_Responder,
},
}
impl MockPeerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_proxy_(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
MockPeerConnectProxy_Responder,
)> {
if let MockPeerRequest::ConnectProxy_ { interface, responder } = self {
Some((interface, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MockPeerRequest::ConnectProxy_ { .. } => "connect_proxy_",
}
}
}
#[derive(Debug, Clone)]
pub struct MockPeerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MockPeerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 MockPeerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MockPeerConnectProxy_Responder {
control_handle: std::mem::ManuallyDrop<MockPeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MockPeerConnectProxy_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MockPeerConnectProxy_Responder {
type ControlHandle = MockPeerControlHandle;
fn control_handle(&self) -> &MockPeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MockPeerConnectProxy_Responder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x578ee1f7ee6dd9d8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerObserverMarker;
impl fidl::endpoints::ProtocolMarker for PeerObserverMarker {
type Proxy = PeerObserverProxy;
type RequestStream = PeerObserverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerObserverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PeerObserver";
}
pub trait PeerObserverProxyInterface: Send + Sync {
type ServiceFoundResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#service_found(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
protocol: Option<&[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor]>,
attributes: &[fidl_fuchsia_bluetooth_bredr::Attribute],
) -> Self::ServiceFoundResponseFut;
type PeerConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#peer_connected(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
protocol: &[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor],
) -> Self::PeerConnectedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerObserverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerObserverSynchronousProxy {
type Proxy = PeerObserverProxy;
type Protocol = PeerObserverMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl PeerObserverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PeerObserverEvent, fidl::Error> {
PeerObserverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor]>,
mut attributes: &[fidl_fuchsia_bluetooth_bredr::Attribute],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<PeerObserverServiceFoundRequest, fidl::encoding::EmptyPayload>(
(peer_id, protocol, attributes),
0x3b990da866718b5c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<PeerObserverPeerConnectedRequest, fidl::encoding::EmptyPayload>(
(peer_id, protocol),
0x77ce6712cb60d46c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct PeerObserverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerObserverProxy {
type Protocol = PeerObserverMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl PeerObserverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerObserverEventStream {
PeerObserverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor]>,
mut attributes: &[fidl_fuchsia_bluetooth_bredr::Attribute],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PeerObserverProxyInterface::r#service_found(self, peer_id, protocol, attributes)
}
pub fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PeerObserverProxyInterface::r#peer_connected(self, peer_id, protocol)
}
}
impl PeerObserverProxyInterface for PeerObserverProxy {
type ServiceFoundResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor]>,
mut attributes: &[fidl_fuchsia_bluetooth_bredr::Attribute],
) -> Self::ServiceFoundResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b990da866718b5c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerObserverServiceFoundRequest, ()>(
(peer_id, protocol, attributes),
0x3b990da866718b5c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PeerConnectedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: &[fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor],
) -> Self::PeerConnectedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x77ce6712cb60d46c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerObserverPeerConnectedRequest, ()>(
(peer_id, protocol),
0x77ce6712cb60d46c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PeerObserverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerObserverEventStream {}
impl futures::stream::FusedStream for PeerObserverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerObserverEventStream {
type Item = Result<PeerObserverEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(PeerObserverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerObserverEvent {}
impl PeerObserverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerObserverEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerObserverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerObserverRequestStream {}
impl futures::stream::FusedStream for PeerObserverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerObserverRequestStream {
type Protocol = PeerObserverMarker;
type ControlHandle = PeerObserverControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
PeerObserverControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 PeerObserverRequestStream {
type Item = Result<PeerObserverRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled PeerObserverRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x3b990da866718b5c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerObserverServiceFoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerObserverServiceFoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PeerObserverControlHandle { inner: this.inner.clone() };
Ok(PeerObserverRequest::ServiceFound {
peer_id: req.peer_id,
protocol: req.protocol,
attributes: req.attributes,
responder: PeerObserverServiceFoundResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x77ce6712cb60d46c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerObserverPeerConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerObserverPeerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PeerObserverControlHandle { inner: this.inner.clone() };
Ok(PeerObserverRequest::PeerConnected {
peer_id: req.peer_id,
protocol: req.protocol,
responder: PeerObserverPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerObserverRequest {
ServiceFound {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Option<Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>>,
attributes: Vec<fidl_fuchsia_bluetooth_bredr::Attribute>,
responder: PeerObserverServiceFoundResponder,
},
PeerConnected {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>,
responder: PeerObserverPeerConnectedResponder,
},
}
impl PeerObserverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_service_found(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Option<Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>>,
Vec<fidl_fuchsia_bluetooth_bredr::Attribute>,
PeerObserverServiceFoundResponder,
)> {
if let PeerObserverRequest::ServiceFound { peer_id, protocol, attributes, responder } = self
{
Some((peer_id, protocol, attributes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_peer_connected(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Vec<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor>,
PeerObserverPeerConnectedResponder,
)> {
if let PeerObserverRequest::PeerConnected { peer_id, protocol, responder } = self {
Some((peer_id, protocol, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerObserverRequest::ServiceFound { .. } => "service_found",
PeerObserverRequest::PeerConnected { .. } => "peer_connected",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerObserverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerObserverControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 PeerObserverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerObserverServiceFoundResponder {
control_handle: std::mem::ManuallyDrop<PeerObserverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerObserverServiceFoundResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerObserverServiceFoundResponder {
type ControlHandle = PeerObserverControlHandle;
fn control_handle(&self) -> &PeerObserverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerObserverServiceFoundResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3b990da866718b5c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerObserverPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop<PeerObserverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerObserverPeerConnectedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerObserverPeerConnectedResponder {
type ControlHandle = PeerObserverControlHandle;
fn control_handle(&self) -> &PeerObserverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerObserverPeerConnectedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x77ce6712cb60d46c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProfileTestMarker;
impl fidl::endpoints::ProtocolMarker for ProfileTestMarker {
type Proxy = ProfileTestProxy;
type RequestStream = ProfileTestRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileTestSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.bredr.test.ProfileTest";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileTestMarker {}
pub trait ProfileTestProxyInterface: Send + Sync {
type RegisterPeerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#register_peer(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> Self::RegisterPeerResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileTestSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileTestSynchronousProxy {
type Proxy = ProfileTestProxy;
type Protocol = ProfileTestMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ProfileTestSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ProfileTestEvent, fidl::Error> {
ProfileTestEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ProfileTestRegisterPeerRequest, fidl::encoding::EmptyPayload>(
(peer_id, peer, observer),
0x4cb156cd976ac1a8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ProfileTestProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProfileTestProxy {
type Protocol = ProfileTestMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ProfileTestProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileTestEventStream {
ProfileTestEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ProfileTestProxyInterface::r#register_peer(self, peer_id, peer, observer)
}
}
impl ProfileTestProxyInterface for ProfileTestProxy {
type RegisterPeerResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
mut observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
) -> Self::RegisterPeerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4cb156cd976ac1a8,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ProfileTestRegisterPeerRequest, ()>(
(peer_id, peer, observer),
0x4cb156cd976ac1a8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProfileTestEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProfileTestEventStream {}
impl futures::stream::FusedStream for ProfileTestEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileTestEventStream {
type Item = Result<ProfileTestEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ProfileTestEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileTestEvent {}
impl ProfileTestEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProfileTestEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileTestRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileTestRequestStream {}
impl futures::stream::FusedStream for ProfileTestRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileTestRequestStream {
type Protocol = ProfileTestMarker;
type ControlHandle = ProfileTestControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ProfileTestControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 ProfileTestRequestStream {
type Item = Result<ProfileTestRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ProfileTestRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x4cb156cd976ac1a8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileTestRegisterPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileTestRegisterPeerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileTestControlHandle { inner: this.inner.clone() };
Ok(ProfileTestRequest::RegisterPeer {
peer_id: req.peer_id,
peer: req.peer,
observer: req.observer,
responder: ProfileTestRegisterPeerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileTestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProfileTestRequest {
RegisterPeer {
peer_id: fidl_fuchsia_bluetooth::PeerId,
peer: fidl::endpoints::ServerEnd<MockPeerMarker>,
observer: fidl::endpoints::ClientEnd<PeerObserverMarker>,
responder: ProfileTestRegisterPeerResponder,
},
}
impl ProfileTestRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_peer(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
fidl::endpoints::ServerEnd<MockPeerMarker>,
fidl::endpoints::ClientEnd<PeerObserverMarker>,
ProfileTestRegisterPeerResponder,
)> {
if let ProfileTestRequest::RegisterPeer { peer_id, peer, observer, responder } = self {
Some((peer_id, peer, observer, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileTestRequest::RegisterPeer { .. } => "register_peer",
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileTestControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProfileTestControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 ProfileTestControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileTestRegisterPeerResponder {
control_handle: std::mem::ManuallyDrop<ProfileTestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileTestRegisterPeerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileTestRegisterPeerResponder {
type ControlHandle = ProfileTestControlHandle;
fn control_handle(&self) -> &ProfileTestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileTestRegisterPeerResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x4cb156cd976ac1a8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for MockPeerConnectProxyRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MockPeerConnectProxyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
MockPeerConnectProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut MockPeerConnectProxyRequest
{
#[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::<MockPeerConnectProxyRequest>(offset);
fidl::encoding::Encode::<
MockPeerConnectProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.interface
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
MockPeerConnectProxyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MockPeerConnectProxyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for MockPeerConnectProxyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
interface: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.interface,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerObserverPeerConnectedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerObserverPeerConnectedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerObserverPeerConnectedRequest, D>
for &PeerObserverPeerConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverPeerConnectedRequest>(offset);
fidl::encoding::Encode::<PeerObserverPeerConnectedRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>,
D,
>,
> fidl::encoding::Encode<PeerObserverPeerConnectedRequest, 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::<PeerObserverPeerConnectedRequest>(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 PeerObserverPeerConnectedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
protocol: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>, D, &mut self.protocol, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerObserverServiceFoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerObserverServiceFoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerObserverServiceFoundRequest, D>
for &PeerObserverServiceFoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerObserverServiceFoundRequest>(offset);
fidl::encoding::Encode::<PeerObserverServiceFoundRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Optional<fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
<fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::Attribute, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.attributes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>,
>,
D,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::Attribute, 512>,
D,
>,
> fidl::encoding::Encode<PeerObserverServiceFoundRequest, 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::<PeerObserverServiceFoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerObserverServiceFoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
protocol: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Vector<
fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor,
255,
>,
>,
D
),
attributes: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::Attribute, 512>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ProtocolDescriptor, 255>,
>,
D,
&mut self.protocol,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::Attribute, 512>, D, &mut self.attributes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileTestRegisterPeerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileTestRegisterPeerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
ProfileTestRegisterPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileTestRegisterPeerRequest
{
#[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::<ProfileTestRegisterPeerRequest>(offset);
fidl::encoding::Encode::<ProfileTestRegisterPeerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.peer),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.observer),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileTestRegisterPeerRequest,
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::<ProfileTestRegisterPeerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileTestRegisterPeerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
peer: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
observer: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MockPeerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerObserverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.observer,
decoder,
offset + 12,
_depth
)?;
Ok(())
}
}
}