#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type Memory = String;
pub type Number = String;
pub const MAX_PICONET_SIZE: u64 = 8;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum CallDirection {
MobileOriginated = 1,
MobileTerminated = 2,
}
impl CallDirection {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::MobileOriginated),
2 => Some(Self::MobileTerminated),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum CallState {
OutgoingDialing,
OutgoingAlerting,
IncomingRinging,
IncomingWaiting,
OngoingHeld,
OngoingActive,
Terminated,
TransferredToAg,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! CallStateUnknown {
() => {
_
};
}
impl CallState {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::OutgoingDialing),
2 => Some(Self::OutgoingAlerting),
3 => Some(Self::IncomingRinging),
4 => Some(Self::IncomingWaiting),
5 => Some(Self::OngoingHeld),
6 => Some(Self::OngoingActive),
7 => Some(Self::Terminated),
8 => Some(Self::TransferredToAg),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::OutgoingDialing,
2 => Self::OutgoingAlerting,
3 => Self::IncomingRinging,
4 => Self::IncomingWaiting,
5 => Self::OngoingHeld,
6 => Self::OngoingActive,
7 => Self::Terminated,
8 => Self::TransferredToAg,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::OutgoingDialing => 1,
Self::OutgoingAlerting => 2,
Self::IncomingRinging => 3,
Self::IncomingWaiting => 4,
Self::OngoingHeld => 5,
Self::OngoingActive => 6,
Self::Terminated => 7,
Self::TransferredToAg => 8,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum DtmfCode {
One = 49,
Two = 50,
Three = 51,
Four = 52,
Five = 53,
Six = 54,
Seven = 55,
Eight = 56,
Nine = 57,
NumberSign = 35,
Zero = 48,
Asterisk = 42,
A = 65,
B = 66,
C = 67,
D = 68,
}
impl DtmfCode {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
49 => Some(Self::One),
50 => Some(Self::Two),
51 => Some(Self::Three),
52 => Some(Self::Four),
53 => Some(Self::Five),
54 => Some(Self::Six),
55 => Some(Self::Seven),
56 => Some(Self::Eight),
57 => Some(Self::Nine),
35 => Some(Self::NumberSign),
48 => Some(Self::Zero),
42 => Some(Self::Asterisk),
65 => Some(Self::A),
66 => Some(Self::B),
67 => Some(Self::C),
68 => Some(Self::D),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(i8)]
pub enum SignalStrength {
None = 1,
VeryLow = 2,
Low = 3,
Medium = 4,
High = 5,
VeryHigh = 6,
}
impl SignalStrength {
#[inline]
pub fn from_primitive(prim: i8) -> Option<Self> {
match prim {
1 => Some(Self::None),
2 => Some(Self::VeryLow),
3 => Some(Self::Low),
4 => Some(Self::Medium),
5 => Some(Self::High),
6 => Some(Self::VeryHigh),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> i8 {
self as i8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Debug, PartialEq)]
pub struct CallManagerPeerConnectedRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for CallManagerPeerConnectedRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CallSendDtmfCodeRequest {
pub code: DtmfCode,
}
impl fidl::Persistable for CallSendDtmfCodeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CallWatchStateResponse {
pub state: CallState,
}
impl fidl::Persistable for CallWatchStateResponse {}
#[derive(Debug, PartialEq)]
pub struct HandsFreeWatchPeerConnectedResponse {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub handle: fidl::endpoints::ClientEnd<PeerHandlerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HandsFreeWatchPeerConnectedResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HeadsetGainSetMicrophoneGainRequest {
pub requested: u8,
}
impl fidl::Persistable for HeadsetGainSetMicrophoneGainRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HeadsetGainSetSpeakerGainRequest {
pub requested: u8,
}
impl fidl::Persistable for HeadsetGainSetSpeakerGainRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HeadsetGainWatchMicrophoneGainResponse {
pub gain: u8,
}
impl fidl::Persistable for HeadsetGainWatchMicrophoneGainResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HeadsetGainWatchSpeakerGainResponse {
pub gain: u8,
}
impl fidl::Persistable for HeadsetGainWatchSpeakerGainResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HfpRegisterRequest {
pub manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HfpRegisterRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerHandlerGainControlRequest {
pub control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerHandlerGainControlRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerHandlerQueryOperatorResponse {
pub operator: Option<String>,
}
impl fidl::Persistable for PeerHandlerQueryOperatorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PeerHandlerReportHeadsetBatteryLevelRequest {
pub level: u8,
}
impl fidl::Persistable for PeerHandlerReportHeadsetBatteryLevelRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerHandlerRequestOutgoingCallRequest {
pub action: CallAction,
}
impl fidl::Persistable for PeerHandlerRequestOutgoingCallRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerHandlerSetNrecModeRequest {
pub enabled: bool,
}
impl fidl::Persistable for PeerHandlerSetNrecModeRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerHandlerSubscriberNumberInformationResponse {
pub numbers: Vec<String>,
}
impl fidl::Persistable for PeerHandlerSubscriberNumberInformationResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerHandlerWatchNetworkInformationResponse {
pub update: NetworkInformation,
}
impl fidl::Persistable for PeerHandlerWatchNetworkInformationResponse {}
#[derive(Debug, PartialEq)]
pub struct PeerHandlerWatchNextCallResponse {
pub call: NextCall,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerHandlerWatchNextCallResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RedialLast;
impl fidl::Persistable for RedialLast {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TransferActive;
impl fidl::Persistable for TransferActive {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NetworkInformation {
pub service_available: Option<bool>,
pub signal_strength: Option<SignalStrength>,
pub roaming: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for NetworkInformation {}
#[derive(Debug, Default, PartialEq)]
pub struct NextCall {
pub call: Option<fidl::endpoints::ClientEnd<CallMarker>>,
pub remote: Option<String>,
pub state: Option<CallState>,
pub direction: Option<CallDirection>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NextCall {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum CallAction {
DialFromNumber(String),
DialFromLocation(String),
RedialLast(RedialLast),
TransferActive(TransferActive),
}
impl CallAction {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::DialFromNumber(_) => 1,
Self::DialFromLocation(_) => 2,
Self::RedialLast(_) => 3,
Self::TransferActive(_) => 4,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for CallAction {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CallMarker;
impl fidl::endpoints::ProtocolMarker for CallMarker {
type Proxy = CallProxy;
type RequestStream = CallRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CallSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Call";
}
pub type CallSendDtmfCodeResult = Result<(), i32>;
pub trait CallProxyInterface: Send + Sync {
type WatchStateResponseFut: std::future::Future<Output = Result<CallState, fidl::Error>> + Send;
fn r#watch_state(&self) -> Self::WatchStateResponseFut;
fn r#request_hold(&self) -> Result<(), fidl::Error>;
fn r#request_active(&self) -> Result<(), fidl::Error>;
fn r#request_terminate(&self) -> Result<(), fidl::Error>;
fn r#request_transfer_audio(&self) -> Result<(), fidl::Error>;
type SendDtmfCodeResponseFut: std::future::Future<Output = Result<CallSendDtmfCodeResult, fidl::Error>>
+ Send;
fn r#send_dtmf_code(&self, code: DtmfCode) -> Self::SendDtmfCodeResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CallSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CallSynchronousProxy {
type Proxy = CallProxy;
type Protocol = CallMarker;
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 CallSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CallMarker 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<CallEvent, fidl::Error> {
CallEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_state(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<CallState, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, CallWatchStateResponse>(
(),
0x5262bcc909bdaeb5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.state)
}
pub fn r#request_hold(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35ade403017d20eb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#request_active(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x248518f967f1fe6e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#request_terminate(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4940915197ee4916,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xb0ca6649f2e104c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#send_dtmf_code(
&self,
mut code: DtmfCode,
___deadline: zx::MonotonicInstant,
) -> Result<CallSendDtmfCodeResult, fidl::Error> {
let _response = self.client.send_query::<
CallSendDtmfCodeRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(code,),
0x50768933ca33fcd6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct CallProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CallProxy {
type Protocol = CallMarker;
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 CallProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CallEventStream {
CallEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_state(
&self,
) -> fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>
{
CallProxyInterface::r#watch_state(self)
}
pub fn r#request_hold(&self) -> Result<(), fidl::Error> {
CallProxyInterface::r#request_hold(self)
}
pub fn r#request_active(&self) -> Result<(), fidl::Error> {
CallProxyInterface::r#request_active(self)
}
pub fn r#request_terminate(&self) -> Result<(), fidl::Error> {
CallProxyInterface::r#request_terminate(self)
}
pub fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
CallProxyInterface::r#request_transfer_audio(self)
}
pub fn r#send_dtmf_code(
&self,
mut code: DtmfCode,
) -> fidl::client::QueryResponseFut<
CallSendDtmfCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
CallProxyInterface::r#send_dtmf_code(self, code)
}
}
impl CallProxyInterface for CallProxy {
type WatchStateResponseFut =
fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_state(&self) -> Self::WatchStateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<CallState, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CallWatchStateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5262bcc909bdaeb5,
>(_buf?)?;
Ok(_response.state)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CallState>(
(),
0x5262bcc909bdaeb5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#request_hold(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35ade403017d20eb,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#request_active(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x248518f967f1fe6e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#request_terminate(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4940915197ee4916,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xb0ca6649f2e104c,
fidl::encoding::DynamicFlags::empty(),
)
}
type SendDtmfCodeResponseFut = fidl::client::QueryResponseFut<
CallSendDtmfCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#send_dtmf_code(&self, mut code: DtmfCode) -> Self::SendDtmfCodeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<CallSendDtmfCodeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x50768933ca33fcd6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<CallSendDtmfCodeRequest, CallSendDtmfCodeResult>(
(code,),
0x50768933ca33fcd6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CallEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CallEventStream {}
impl futures::stream::FusedStream for CallEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CallEventStream {
type Item = Result<CallEvent, 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(CallEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CallEvent {}
impl CallEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CallEvent, 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: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CallRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CallRequestStream {}
impl futures::stream::FusedStream for CallRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CallRequestStream {
type Protocol = CallMarker;
type ControlHandle = CallControlHandle;
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 {
CallControlHandle { 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 CallRequestStream {
type Item = Result<CallRequest, 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 CallRequestStream 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 {
0x5262bcc909bdaeb5 => {
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 = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::WatchState {
responder: CallWatchStateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35ade403017d20eb => {
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 = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::RequestHold { control_handle })
}
0x248518f967f1fe6e => {
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 = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::RequestActive { control_handle })
}
0x4940915197ee4916 => {
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 = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::RequestTerminate { control_handle })
}
0xb0ca6649f2e104c => {
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 = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::RequestTransferAudio { control_handle })
}
0x50768933ca33fcd6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CallSendDtmfCodeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallSendDtmfCodeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CallControlHandle { inner: this.inner.clone() };
Ok(CallRequest::SendDtmfCode {
code: req.code,
responder: CallSendDtmfCodeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CallRequest {
WatchState { responder: CallWatchStateResponder },
RequestHold { control_handle: CallControlHandle },
RequestActive { control_handle: CallControlHandle },
RequestTerminate { control_handle: CallControlHandle },
RequestTransferAudio { control_handle: CallControlHandle },
SendDtmfCode { code: DtmfCode, responder: CallSendDtmfCodeResponder },
}
impl CallRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_state(self) -> Option<(CallWatchStateResponder)> {
if let CallRequest::WatchState { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_hold(self) -> Option<(CallControlHandle)> {
if let CallRequest::RequestHold { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_active(self) -> Option<(CallControlHandle)> {
if let CallRequest::RequestActive { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_terminate(self) -> Option<(CallControlHandle)> {
if let CallRequest::RequestTerminate { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_transfer_audio(self) -> Option<(CallControlHandle)> {
if let CallRequest::RequestTransferAudio { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_dtmf_code(self) -> Option<(DtmfCode, CallSendDtmfCodeResponder)> {
if let CallRequest::SendDtmfCode { code, responder } = self {
Some((code, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CallRequest::WatchState { .. } => "watch_state",
CallRequest::RequestHold { .. } => "request_hold",
CallRequest::RequestActive { .. } => "request_active",
CallRequest::RequestTerminate { .. } => "request_terminate",
CallRequest::RequestTransferAudio { .. } => "request_transfer_audio",
CallRequest::SendDtmfCode { .. } => "send_dtmf_code",
}
}
}
#[derive(Debug, Clone)]
pub struct CallControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CallControlHandle {
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 CallControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CallWatchStateResponder {
control_handle: std::mem::ManuallyDrop<CallControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CallWatchStateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CallWatchStateResponder {
type ControlHandle = CallControlHandle;
fn control_handle(&self) -> &CallControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CallWatchStateResponder {
pub fn send(self, mut state: CallState) -> Result<(), fidl::Error> {
let _result = self.send_raw(state);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut state: CallState) -> Result<(), fidl::Error> {
let _result = self.send_raw(state);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut state: CallState) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CallWatchStateResponse>(
(state,),
self.tx_id,
0x5262bcc909bdaeb5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CallSendDtmfCodeResponder {
control_handle: std::mem::ManuallyDrop<CallControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CallSendDtmfCodeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CallSendDtmfCodeResponder {
type ControlHandle = CallControlHandle;
fn control_handle(&self) -> &CallControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CallSendDtmfCodeResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x50768933ca33fcd6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CallManagerMarker;
impl fidl::endpoints::ProtocolMarker for CallManagerMarker {
type Proxy = CallManagerProxy;
type RequestStream = CallManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CallManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) CallManager";
}
pub trait CallManagerProxyInterface: Send + Sync {
type PeerConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#peer_connected(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
) -> Self::PeerConnectedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CallManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CallManagerSynchronousProxy {
type Proxy = CallManagerProxy;
type Protocol = CallManagerMarker;
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 CallManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CallManagerMarker 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<CallManagerEvent, fidl::Error> {
CallManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#peer_connected(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<CallManagerPeerConnectedRequest, fidl::encoding::EmptyPayload>(
(id, handle),
0x1431cc24b2980086,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct CallManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CallManagerProxy {
type Protocol = CallManagerMarker;
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 CallManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CallManagerEventStream {
CallManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#peer_connected(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
CallManagerProxyInterface::r#peer_connected(self, id, handle)
}
}
impl CallManagerProxyInterface for CallManagerProxy {
type PeerConnectedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#peer_connected(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
) -> 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,
0x1431cc24b2980086,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<CallManagerPeerConnectedRequest, ()>(
(id, handle),
0x1431cc24b2980086,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CallManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CallManagerEventStream {}
impl futures::stream::FusedStream for CallManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CallManagerEventStream {
type Item = Result<CallManagerEvent, 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(CallManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CallManagerEvent {}
impl CallManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CallManagerEvent, 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: <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CallManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CallManagerRequestStream {}
impl futures::stream::FusedStream for CallManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CallManagerRequestStream {
type Protocol = CallManagerMarker;
type ControlHandle = CallManagerControlHandle;
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 {
CallManagerControlHandle { 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 CallManagerRequestStream {
type Item = Result<CallManagerRequest, 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 CallManagerRequestStream 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 {
0x1431cc24b2980086 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CallManagerPeerConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallManagerPeerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CallManagerControlHandle { inner: this.inner.clone() };
Ok(CallManagerRequest::PeerConnected {
id: req.id,
handle: req.handle,
responder: CallManagerPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CallManagerRequest {
PeerConnected {
id: fidl_fuchsia_bluetooth::PeerId,
handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
responder: CallManagerPeerConnectedResponder,
},
}
impl CallManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_peer_connected(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
fidl::endpoints::ServerEnd<PeerHandlerMarker>,
CallManagerPeerConnectedResponder,
)> {
if let CallManagerRequest::PeerConnected { id, handle, responder } = self {
Some((id, handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CallManagerRequest::PeerConnected { .. } => "peer_connected",
}
}
}
#[derive(Debug, Clone)]
pub struct CallManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CallManagerControlHandle {
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 CallManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CallManagerPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop<CallManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CallManagerPeerConnectedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CallManagerPeerConnectedResponder {
type ControlHandle = CallManagerControlHandle;
fn control_handle(&self) -> &CallManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CallManagerPeerConnectedResponder {
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,
0x1431cc24b2980086,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HandsFreeMarker;
impl fidl::endpoints::ProtocolMarker for HandsFreeMarker {
type Proxy = HandsFreeProxy;
type RequestStream = HandsFreeRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HandsFreeSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.HandsFree";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HandsFreeMarker {}
pub type HandsFreeWatchPeerConnectedResult =
Result<(fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>), i32>;
pub trait HandsFreeProxyInterface: Send + Sync {
type WatchPeerConnectedResponseFut: std::future::Future<Output = Result<HandsFreeWatchPeerConnectedResult, fidl::Error>>
+ Send;
fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HandsFreeSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HandsFreeSynchronousProxy {
type Proxy = HandsFreeProxy;
type Protocol = HandsFreeMarker;
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 HandsFreeSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HandsFreeMarker 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<HandsFreeEvent, fidl::Error> {
HandsFreeEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_peer_connected(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
>(
(),
0x1cc503325a8bbc3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.id, x.handle)))
}
}
#[derive(Debug, Clone)]
pub struct HandsFreeProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HandsFreeProxy {
type Protocol = HandsFreeMarker;
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 HandsFreeProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HandsFreeEventStream {
HandsFreeEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_peer_connected(
&self,
) -> fidl::client::QueryResponseFut<
HandsFreeWatchPeerConnectedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HandsFreeProxyInterface::r#watch_peer_connected(self)
}
}
impl HandsFreeProxyInterface for HandsFreeProxy {
type WatchPeerConnectedResponseFut = fidl::client::QueryResponseFut<
HandsFreeWatchPeerConnectedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1cc503325a8bbc3f,
>(_buf?)?;
Ok(_response.map(|x| (x.id, x.handle)))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
HandsFreeWatchPeerConnectedResult,
>(
(),
0x1cc503325a8bbc3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HandsFreeEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HandsFreeEventStream {}
impl futures::stream::FusedStream for HandsFreeEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HandsFreeEventStream {
type Item = Result<HandsFreeEvent, 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(HandsFreeEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HandsFreeEvent {}
impl HandsFreeEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HandsFreeEvent, 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: <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HandsFreeRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HandsFreeRequestStream {}
impl futures::stream::FusedStream for HandsFreeRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HandsFreeRequestStream {
type Protocol = HandsFreeMarker;
type ControlHandle = HandsFreeControlHandle;
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 {
HandsFreeControlHandle { 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 HandsFreeRequestStream {
type Item = Result<HandsFreeRequest, 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 HandsFreeRequestStream 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 {
0x1cc503325a8bbc3f => {
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 = HandsFreeControlHandle { inner: this.inner.clone() };
Ok(HandsFreeRequest::WatchPeerConnected {
responder: HandsFreeWatchPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HandsFreeRequest {
WatchPeerConnected { responder: HandsFreeWatchPeerConnectedResponder },
}
impl HandsFreeRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_peer_connected(self) -> Option<(HandsFreeWatchPeerConnectedResponder)> {
if let HandsFreeRequest::WatchPeerConnected { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HandsFreeRequest::WatchPeerConnected { .. } => "watch_peer_connected",
}
}
}
#[derive(Debug, Clone)]
pub struct HandsFreeControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HandsFreeControlHandle {
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 HandsFreeControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HandsFreeWatchPeerConnectedResponder {
control_handle: std::mem::ManuallyDrop<HandsFreeControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HandsFreeWatchPeerConnectedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HandsFreeWatchPeerConnectedResponder {
type ControlHandle = HandsFreeControlHandle;
fn control_handle(&self) -> &HandsFreeControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HandsFreeWatchPeerConnectedResponder {
pub fn send(
self,
mut result: Result<
(&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
i32,
>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<
(&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
i32,
>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<
(&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
i32,
>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
HandsFreeWatchPeerConnectedResponse,
i32,
>>(
result,
self.tx_id,
0x1cc503325a8bbc3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HeadsetGainMarker;
impl fidl::endpoints::ProtocolMarker for HeadsetGainMarker {
type Proxy = HeadsetGainProxy;
type RequestStream = HeadsetGainRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HeadsetGainSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HeadsetGain";
}
pub trait HeadsetGainProxyInterface: Send + Sync {
fn r#set_speaker_gain(&self, requested: u8) -> Result<(), fidl::Error>;
type WatchSpeakerGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut;
fn r#set_microphone_gain(&self, requested: u8) -> Result<(), fidl::Error>;
type WatchMicrophoneGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>>
+ Send;
fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HeadsetGainSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HeadsetGainSynchronousProxy {
type Proxy = HeadsetGainProxy;
type Protocol = HeadsetGainMarker;
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 HeadsetGainSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HeadsetGainMarker 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<HeadsetGainEvent, fidl::Error> {
HeadsetGainEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
self.client.send::<HeadsetGainSetSpeakerGainRequest>(
(requested,),
0x3462191b2a6ae5ce,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_speaker_gain(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<u8, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchSpeakerGainResponse>(
(),
0x2007abdf2695c747,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.gain)
}
pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
(requested,),
0x7ddbb4e63caeef8e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_microphone_gain(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<u8, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchMicrophoneGainResponse>(
(),
0x1d171fb432fa55ad,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.gain)
}
}
#[derive(Debug, Clone)]
pub struct HeadsetGainProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HeadsetGainProxy {
type Protocol = HeadsetGainMarker;
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 HeadsetGainProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HeadsetGainEventStream {
HeadsetGainEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
HeadsetGainProxyInterface::r#set_speaker_gain(self, requested)
}
pub fn r#watch_speaker_gain(
&self,
) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
HeadsetGainProxyInterface::r#watch_speaker_gain(self)
}
pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
HeadsetGainProxyInterface::r#set_microphone_gain(self, requested)
}
pub fn r#watch_microphone_gain(
&self,
) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
HeadsetGainProxyInterface::r#watch_microphone_gain(self)
}
}
impl HeadsetGainProxyInterface for HeadsetGainProxy {
fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
self.client.send::<HeadsetGainSetSpeakerGainRequest>(
(requested,),
0x3462191b2a6ae5ce,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchSpeakerGainResponseFut =
fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u8, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
HeadsetGainWatchSpeakerGainResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2007abdf2695c747,
>(_buf?)?;
Ok(_response.gain)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
(),
0x2007abdf2695c747,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
(requested,),
0x7ddbb4e63caeef8e,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchMicrophoneGainResponseFut =
fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u8, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
HeadsetGainWatchMicrophoneGainResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1d171fb432fa55ad,
>(_buf?)?;
Ok(_response.gain)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
(),
0x1d171fb432fa55ad,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HeadsetGainEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HeadsetGainEventStream {}
impl futures::stream::FusedStream for HeadsetGainEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HeadsetGainEventStream {
type Item = Result<HeadsetGainEvent, 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(HeadsetGainEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HeadsetGainEvent {}
impl HeadsetGainEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HeadsetGainEvent, 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: <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HeadsetGainRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HeadsetGainRequestStream {}
impl futures::stream::FusedStream for HeadsetGainRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HeadsetGainRequestStream {
type Protocol = HeadsetGainMarker;
type ControlHandle = HeadsetGainControlHandle;
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 {
HeadsetGainControlHandle { 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 HeadsetGainRequestStream {
type Item = Result<HeadsetGainRequest, 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 HeadsetGainRequestStream 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 {
0x3462191b2a6ae5ce => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HeadsetGainSetSpeakerGainRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetSpeakerGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
Ok(HeadsetGainRequest::SetSpeakerGain {
requested: req.requested,
control_handle,
})
}
0x2007abdf2695c747 => {
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 = HeadsetGainControlHandle { inner: this.inner.clone() };
Ok(HeadsetGainRequest::WatchSpeakerGain {
responder: HeadsetGainWatchSpeakerGainResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7ddbb4e63caeef8e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HeadsetGainSetMicrophoneGainRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetMicrophoneGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
Ok(HeadsetGainRequest::SetMicrophoneGain {
requested: req.requested,
control_handle,
})
}
0x1d171fb432fa55ad => {
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 = HeadsetGainControlHandle { inner: this.inner.clone() };
Ok(HeadsetGainRequest::WatchMicrophoneGain {
responder: HeadsetGainWatchMicrophoneGainResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HeadsetGainRequest {
SetSpeakerGain { requested: u8, control_handle: HeadsetGainControlHandle },
WatchSpeakerGain { responder: HeadsetGainWatchSpeakerGainResponder },
SetMicrophoneGain { requested: u8, control_handle: HeadsetGainControlHandle },
WatchMicrophoneGain { responder: HeadsetGainWatchMicrophoneGainResponder },
}
impl HeadsetGainRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_speaker_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
if let HeadsetGainRequest::SetSpeakerGain { requested, control_handle } = self {
Some((requested, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_speaker_gain(self) -> Option<(HeadsetGainWatchSpeakerGainResponder)> {
if let HeadsetGainRequest::WatchSpeakerGain { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_microphone_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
if let HeadsetGainRequest::SetMicrophoneGain { requested, control_handle } = self {
Some((requested, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_microphone_gain(self) -> Option<(HeadsetGainWatchMicrophoneGainResponder)> {
if let HeadsetGainRequest::WatchMicrophoneGain { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HeadsetGainRequest::SetSpeakerGain { .. } => "set_speaker_gain",
HeadsetGainRequest::WatchSpeakerGain { .. } => "watch_speaker_gain",
HeadsetGainRequest::SetMicrophoneGain { .. } => "set_microphone_gain",
HeadsetGainRequest::WatchMicrophoneGain { .. } => "watch_microphone_gain",
}
}
}
#[derive(Debug, Clone)]
pub struct HeadsetGainControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HeadsetGainControlHandle {
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 HeadsetGainControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HeadsetGainWatchSpeakerGainResponder {
control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HeadsetGainWatchSpeakerGainResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HeadsetGainWatchSpeakerGainResponder {
type ControlHandle = HeadsetGainControlHandle;
fn control_handle(&self) -> &HeadsetGainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HeadsetGainWatchSpeakerGainResponder {
pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<HeadsetGainWatchSpeakerGainResponse>(
(gain,),
self.tx_id,
0x2007abdf2695c747,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HeadsetGainWatchMicrophoneGainResponder {
control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HeadsetGainWatchMicrophoneGainResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HeadsetGainWatchMicrophoneGainResponder {
type ControlHandle = HeadsetGainControlHandle;
fn control_handle(&self) -> &HeadsetGainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HeadsetGainWatchMicrophoneGainResponder {
pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<HeadsetGainWatchMicrophoneGainResponse>(
(gain,),
self.tx_id,
0x1d171fb432fa55ad,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HfpMarker;
impl fidl::endpoints::ProtocolMarker for HfpMarker {
type Proxy = HfpProxy;
type RequestStream = HfpRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HfpSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.Hfp";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HfpMarker {}
pub trait HfpProxyInterface: Send + Sync {
fn r#register(
&self,
manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HfpSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HfpSynchronousProxy {
type Proxy = HfpProxy;
type Protocol = HfpMarker;
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 HfpSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HfpMarker 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<HfpEvent, fidl::Error> {
HfpEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register(
&self,
mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HfpRegisterRequest>(
(manager,),
0x1b2ea4f6069181ad,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct HfpProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HfpProxy {
type Protocol = HfpMarker;
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 HfpProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HfpEventStream {
HfpEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register(
&self,
mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
) -> Result<(), fidl::Error> {
HfpProxyInterface::r#register(self, manager)
}
}
impl HfpProxyInterface for HfpProxy {
fn r#register(
&self,
mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HfpRegisterRequest>(
(manager,),
0x1b2ea4f6069181ad,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct HfpEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HfpEventStream {}
impl futures::stream::FusedStream for HfpEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HfpEventStream {
type Item = Result<HfpEvent, 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(HfpEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HfpEvent {}
impl HfpEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HfpEvent, 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: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HfpRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HfpRequestStream {}
impl futures::stream::FusedStream for HfpRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HfpRequestStream {
type Protocol = HfpMarker;
type ControlHandle = HfpControlHandle;
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 {
HfpControlHandle { 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 HfpRequestStream {
type Item = Result<HfpRequest, 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 HfpRequestStream 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 {
0x1b2ea4f6069181ad => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HfpRegisterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HfpRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HfpControlHandle { inner: this.inner.clone() };
Ok(HfpRequest::Register { manager: req.manager, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HfpRequest {
Register {
manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
control_handle: HfpControlHandle,
},
}
impl HfpRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register(
self,
) -> Option<(fidl::endpoints::ClientEnd<CallManagerMarker>, HfpControlHandle)> {
if let HfpRequest::Register { manager, control_handle } = self {
Some((manager, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HfpRequest::Register { .. } => "register",
}
}
}
#[derive(Debug, Clone)]
pub struct HfpControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HfpControlHandle {
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 HfpControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerHandlerMarker;
impl fidl::endpoints::ProtocolMarker for PeerHandlerMarker {
type Proxy = PeerHandlerProxy;
type RequestStream = PeerHandlerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerHandlerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PeerHandler";
}
pub type PeerHandlerRequestOutgoingCallResult = Result<(), i32>;
pub type PeerHandlerSetNrecModeResult = Result<(), i32>;
pub trait PeerHandlerProxyInterface: Send + Sync {
type WatchNetworkInformationResponseFut: std::future::Future<Output = Result<NetworkInformation, fidl::Error>>
+ Send;
fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut;
type WatchNextCallResponseFut: std::future::Future<Output = Result<NextCall, fidl::Error>>
+ Send;
fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut;
type RequestOutgoingCallResponseFut: std::future::Future<Output = Result<PeerHandlerRequestOutgoingCallResult, fidl::Error>>
+ Send;
fn r#request_outgoing_call(&self, action: &CallAction) -> Self::RequestOutgoingCallResponseFut;
type QueryOperatorResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
+ Send;
fn r#query_operator(&self) -> Self::QueryOperatorResponseFut;
type SubscriberNumberInformationResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
+ Send;
fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut;
type SetNrecModeResponseFut: std::future::Future<Output = Result<PeerHandlerSetNrecModeResult, fidl::Error>>
+ Send;
fn r#set_nrec_mode(&self, enabled: bool) -> Self::SetNrecModeResponseFut;
fn r#report_headset_battery_level(&self, level: u8) -> Result<(), fidl::Error>;
fn r#gain_control(
&self,
control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerHandlerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerHandlerSynchronousProxy {
type Proxy = PeerHandlerProxy;
type Protocol = PeerHandlerMarker;
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 PeerHandlerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerHandlerMarker 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<PeerHandlerEvent, fidl::Error> {
PeerHandlerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_network_information(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkInformation, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNetworkInformationResponse>(
(),
0x1c9eba597076b7cb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.update)
}
pub fn r#watch_next_call(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<NextCall, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNextCallResponse>(
(),
0x5e3b7b4e7c3d359,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.call)
}
pub fn r#request_outgoing_call(
&self,
mut action: &CallAction,
___deadline: zx::MonotonicInstant,
) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
let _response = self.client.send_query::<
PeerHandlerRequestOutgoingCallRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(action,),
0x1a2637c743c89ad,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#query_operator(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Option<String>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PeerHandlerQueryOperatorResponse>(
(),
0x1217eaf5db4c3300,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.operator)
}
pub fn r#subscriber_number_information(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<String>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
PeerHandlerSubscriberNumberInformationResponse,
>(
(),
0x15f5235855b02a3a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.numbers)
}
pub fn r#set_nrec_mode(
&self,
mut enabled: bool,
___deadline: zx::MonotonicInstant,
) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
let _response = self.client.send_query::<
PeerHandlerSetNrecModeRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(enabled,),
0x2f8890d0f866672f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
(level,),
0x4e3e8be4680d85b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#gain_control(
&self,
mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PeerHandlerGainControlRequest>(
(control,),
0x6e043b6d2e0fb917,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PeerHandlerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerHandlerProxy {
type Protocol = PeerHandlerMarker;
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 PeerHandlerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerHandlerEventStream {
PeerHandlerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_network_information(
&self,
) -> fidl::client::QueryResponseFut<
NetworkInformation,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerHandlerProxyInterface::r#watch_network_information(self)
}
pub fn r#watch_next_call(
&self,
) -> fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PeerHandlerProxyInterface::r#watch_next_call(self)
}
pub fn r#request_outgoing_call(
&self,
mut action: &CallAction,
) -> fidl::client::QueryResponseFut<
PeerHandlerRequestOutgoingCallResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerHandlerProxyInterface::r#request_outgoing_call(self, action)
}
pub fn r#query_operator(
&self,
) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PeerHandlerProxyInterface::r#query_operator(self)
}
pub fn r#subscriber_number_information(
&self,
) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PeerHandlerProxyInterface::r#subscriber_number_information(self)
}
pub fn r#set_nrec_mode(
&self,
mut enabled: bool,
) -> fidl::client::QueryResponseFut<
PeerHandlerSetNrecModeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerHandlerProxyInterface::r#set_nrec_mode(self, enabled)
}
pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
PeerHandlerProxyInterface::r#report_headset_battery_level(self, level)
}
pub fn r#gain_control(
&self,
mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
) -> Result<(), fidl::Error> {
PeerHandlerProxyInterface::r#gain_control(self, control)
}
}
impl PeerHandlerProxyInterface for PeerHandlerProxy {
type WatchNetworkInformationResponseFut = fidl::client::QueryResponseFut<
NetworkInformation,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkInformation, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PeerHandlerWatchNetworkInformationResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1c9eba597076b7cb,
>(_buf?)?;
Ok(_response.update)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NetworkInformation>(
(),
0x1c9eba597076b7cb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchNextCallResponseFut =
fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NextCall, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PeerHandlerWatchNextCallResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5e3b7b4e7c3d359,
>(_buf?)?;
Ok(_response.call)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NextCall>(
(),
0x5e3b7b4e7c3d359,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RequestOutgoingCallResponseFut = fidl::client::QueryResponseFut<
PeerHandlerRequestOutgoingCallResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#request_outgoing_call(
&self,
mut action: &CallAction,
) -> Self::RequestOutgoingCallResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1a2637c743c89ad,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PeerHandlerRequestOutgoingCallRequest,
PeerHandlerRequestOutgoingCallResult,
>(
(action,),
0x1a2637c743c89ad,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type QueryOperatorResponseFut = fidl::client::QueryResponseFut<
Option<String>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#query_operator(&self) -> Self::QueryOperatorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<String>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PeerHandlerQueryOperatorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1217eaf5db4c3300,
>(_buf?)?;
Ok(_response.operator)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
(),
0x1217eaf5db4c3300,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SubscriberNumberInformationResponseFut =
fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<String>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PeerHandlerSubscriberNumberInformationResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x15f5235855b02a3a,
>(_buf?)?;
Ok(_response.numbers)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
(),
0x15f5235855b02a3a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetNrecModeResponseFut = fidl::client::QueryResponseFut<
PeerHandlerSetNrecModeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_nrec_mode(&self, mut enabled: bool) -> Self::SetNrecModeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2f8890d0f866672f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<PeerHandlerSetNrecModeRequest, PeerHandlerSetNrecModeResult>(
(enabled,),
0x2f8890d0f866672f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
(level,),
0x4e3e8be4680d85b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#gain_control(
&self,
mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PeerHandlerGainControlRequest>(
(control,),
0x6e043b6d2e0fb917,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PeerHandlerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerHandlerEventStream {}
impl futures::stream::FusedStream for PeerHandlerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerHandlerEventStream {
type Item = Result<PeerHandlerEvent, 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(PeerHandlerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerHandlerEvent {}
impl PeerHandlerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerHandlerEvent, 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: <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerHandlerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerHandlerRequestStream {}
impl futures::stream::FusedStream for PeerHandlerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerHandlerRequestStream {
type Protocol = PeerHandlerMarker;
type ControlHandle = PeerHandlerControlHandle;
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 {
PeerHandlerControlHandle { 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 PeerHandlerRequestStream {
type Item = Result<PeerHandlerRequest, 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 PeerHandlerRequestStream 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 {
0x1c9eba597076b7cb => {
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 = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::WatchNetworkInformation {
responder: PeerHandlerWatchNetworkInformationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5e3b7b4e7c3d359 => {
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 = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::WatchNextCall {
responder: PeerHandlerWatchNextCallResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1a2637c743c89ad => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerHandlerRequestOutgoingCallRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerRequestOutgoingCallRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::RequestOutgoingCall {
action: req.action,
responder: PeerHandlerRequestOutgoingCallResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1217eaf5db4c3300 => {
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 = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::QueryOperator {
responder: PeerHandlerQueryOperatorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x15f5235855b02a3a => {
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 = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::SubscriberNumberInformation {
responder: PeerHandlerSubscriberNumberInformationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2f8890d0f866672f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerHandlerSetNrecModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerSetNrecModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::SetNrecMode {
enabled: req.enabled,
responder: PeerHandlerSetNrecModeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e3e8be4680d85b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PeerHandlerReportHeadsetBatteryLevelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerReportHeadsetBatteryLevelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::ReportHeadsetBatteryLevel {
level: req.level,
control_handle,
})
}
0x6e043b6d2e0fb917 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PeerHandlerGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
Ok(PeerHandlerRequest::GainControl { control: req.control, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerHandlerRequest {
WatchNetworkInformation { responder: PeerHandlerWatchNetworkInformationResponder },
WatchNextCall { responder: PeerHandlerWatchNextCallResponder },
RequestOutgoingCall { action: CallAction, responder: PeerHandlerRequestOutgoingCallResponder },
QueryOperator { responder: PeerHandlerQueryOperatorResponder },
SubscriberNumberInformation { responder: PeerHandlerSubscriberNumberInformationResponder },
SetNrecMode { enabled: bool, responder: PeerHandlerSetNrecModeResponder },
ReportHeadsetBatteryLevel { level: u8, control_handle: PeerHandlerControlHandle },
GainControl {
control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
control_handle: PeerHandlerControlHandle,
},
}
impl PeerHandlerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_network_information(
self,
) -> Option<(PeerHandlerWatchNetworkInformationResponder)> {
if let PeerHandlerRequest::WatchNetworkInformation { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_next_call(self) -> Option<(PeerHandlerWatchNextCallResponder)> {
if let PeerHandlerRequest::WatchNextCall { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_outgoing_call(
self,
) -> Option<(CallAction, PeerHandlerRequestOutgoingCallResponder)> {
if let PeerHandlerRequest::RequestOutgoingCall { action, responder } = self {
Some((action, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_query_operator(self) -> Option<(PeerHandlerQueryOperatorResponder)> {
if let PeerHandlerRequest::QueryOperator { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_subscriber_number_information(
self,
) -> Option<(PeerHandlerSubscriberNumberInformationResponder)> {
if let PeerHandlerRequest::SubscriberNumberInformation { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_nrec_mode(self) -> Option<(bool, PeerHandlerSetNrecModeResponder)> {
if let PeerHandlerRequest::SetNrecMode { enabled, responder } = self {
Some((enabled, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_report_headset_battery_level(self) -> Option<(u8, PeerHandlerControlHandle)> {
if let PeerHandlerRequest::ReportHeadsetBatteryLevel { level, control_handle } = self {
Some((level, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_gain_control(
self,
) -> Option<(fidl::endpoints::ClientEnd<HeadsetGainMarker>, PeerHandlerControlHandle)> {
if let PeerHandlerRequest::GainControl { control, control_handle } = self {
Some((control, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerHandlerRequest::WatchNetworkInformation { .. } => "watch_network_information",
PeerHandlerRequest::WatchNextCall { .. } => "watch_next_call",
PeerHandlerRequest::RequestOutgoingCall { .. } => "request_outgoing_call",
PeerHandlerRequest::QueryOperator { .. } => "query_operator",
PeerHandlerRequest::SubscriberNumberInformation { .. } => {
"subscriber_number_information"
}
PeerHandlerRequest::SetNrecMode { .. } => "set_nrec_mode",
PeerHandlerRequest::ReportHeadsetBatteryLevel { .. } => "report_headset_battery_level",
PeerHandlerRequest::GainControl { .. } => "gain_control",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerHandlerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerHandlerControlHandle {
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 PeerHandlerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerWatchNetworkInformationResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerWatchNetworkInformationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerWatchNetworkInformationResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerWatchNetworkInformationResponder {
pub fn send(self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
let _result = self.send_raw(update);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut update: &NetworkInformation,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(update);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PeerHandlerWatchNetworkInformationResponse>(
(update,),
self.tx_id,
0x1c9eba597076b7cb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerWatchNextCallResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerWatchNextCallResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerWatchNextCallResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerWatchNextCallResponder {
pub fn send(self, mut call: NextCall) -> Result<(), fidl::Error> {
let _result = self.send_raw(call);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut call: NextCall) -> Result<(), fidl::Error> {
let _result = self.send_raw(call);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut call: NextCall) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PeerHandlerWatchNextCallResponse>(
(&mut call,),
self.tx_id,
0x5e3b7b4e7c3d359,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerRequestOutgoingCallResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerRequestOutgoingCallResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerRequestOutgoingCallResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerRequestOutgoingCallResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x1a2637c743c89ad,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerQueryOperatorResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerQueryOperatorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerQueryOperatorResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerQueryOperatorResponder {
pub fn send(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(operator);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(operator);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PeerHandlerQueryOperatorResponse>(
(operator,),
self.tx_id,
0x1217eaf5db4c3300,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerSubscriberNumberInformationResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerSubscriberNumberInformationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerSubscriberNumberInformationResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerSubscriberNumberInformationResponder {
pub fn send(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(numbers);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
let _result = self.send_raw(numbers);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut numbers: &[String]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PeerHandlerSubscriberNumberInformationResponse>(
(numbers,),
self.tx_id,
0x15f5235855b02a3a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerHandlerSetNrecModeResponder {
control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerHandlerSetNrecModeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerHandlerSetNrecModeResponder {
type ControlHandle = PeerHandlerControlHandle;
fn control_handle(&self) -> &PeerHandlerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerHandlerSetNrecModeResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x2f8890d0f866672f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CallDirection {
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 CallDirection {
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 CallDirection {
#[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 CallDirection {
#[inline(always)]
fn new_empty() -> Self {
Self::MobileOriginated
}
#[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 CallState {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for CallState {
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 CallState {
#[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 CallState {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DtmfCode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for DtmfCode {
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 DtmfCode {
#[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 DtmfCode {
#[inline(always)]
fn new_empty() -> Self {
Self::NumberSign
}
#[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::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SignalStrength {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<i8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<i8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for SignalStrength {
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 SignalStrength {
#[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 SignalStrength {
#[inline(always)]
fn new_empty() -> Self {
Self::None
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<i8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for CallManagerPeerConnectedRequest {
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 CallManagerPeerConnectedRequest {
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<
CallManagerPeerConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut CallManagerPeerConnectedRequest
{
#[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::<CallManagerPeerConnectedRequest>(offset);
fidl::encoding::Encode::<CallManagerPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
),
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<PeerHandlerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
CallManagerPeerConnectedRequest,
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::<CallManagerPeerConnectedRequest>(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 CallManagerPeerConnectedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
handle: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
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!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.handle,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CallSendDtmfCodeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CallSendDtmfCodeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CallSendDtmfCodeRequest, D> for &CallSendDtmfCodeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CallSendDtmfCodeRequest>(offset);
fidl::encoding::Encode::<CallSendDtmfCodeRequest, D>::encode(
(<DtmfCode as fidl::encoding::ValueTypeMarker>::borrow(&self.code),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DtmfCode, D>>
fidl::encoding::Encode<CallSendDtmfCodeRequest, 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::<CallSendDtmfCodeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CallSendDtmfCodeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { code: fidl::new_empty!(DtmfCode, 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!(DtmfCode, D, &mut self.code, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CallWatchStateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CallWatchStateResponse {
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<CallWatchStateResponse, D> for &CallWatchStateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CallWatchStateResponse>(offset);
fidl::encoding::Encode::<CallWatchStateResponse, D>::encode(
(<CallState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallState, D>>
fidl::encoding::Encode<CallWatchStateResponse, 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::<CallWatchStateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CallWatchStateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { state: fidl::new_empty!(CallState, 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!(CallState, D, &mut self.state, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HandsFreeWatchPeerConnectedResponse {
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 HandsFreeWatchPeerConnectedResponse {
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<
HandsFreeWatchPeerConnectedResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HandsFreeWatchPeerConnectedResponse
{
#[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::<HandsFreeWatchPeerConnectedResponse>(offset);
fidl::encoding::Encode::<HandsFreeWatchPeerConnectedResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
),
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::ClientEnd<PeerHandlerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HandsFreeWatchPeerConnectedResponse,
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::<HandsFreeWatchPeerConnectedResponse>(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 HandsFreeWatchPeerConnectedResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
handle: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
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!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.handle,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HeadsetGainSetMicrophoneGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetMicrophoneGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, D>
for &HeadsetGainSetMicrophoneGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HeadsetGainSetMicrophoneGainRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HeadsetGainSetMicrophoneGainRequest)
.write_unaligned((self as *const HeadsetGainSetMicrophoneGainRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, 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::<HeadsetGainSetMicrophoneGainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HeadsetGainSetMicrophoneGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { requested: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HeadsetGainSetSpeakerGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetSpeakerGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, D>
for &HeadsetGainSetSpeakerGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HeadsetGainSetSpeakerGainRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HeadsetGainSetSpeakerGainRequest)
.write_unaligned((self as *const HeadsetGainSetSpeakerGainRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, 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::<HeadsetGainSetSpeakerGainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HeadsetGainSetSpeakerGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { requested: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchMicrophoneGainResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchMicrophoneGainResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, D>
for &HeadsetGainWatchMicrophoneGainResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HeadsetGainWatchMicrophoneGainResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HeadsetGainWatchMicrophoneGainResponse).write_unaligned(
(self as *const HeadsetGainWatchMicrophoneGainResponse).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, 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::<HeadsetGainWatchMicrophoneGainResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HeadsetGainWatchMicrophoneGainResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { gain: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchSpeakerGainResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchSpeakerGainResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, D>
for &HeadsetGainWatchSpeakerGainResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HeadsetGainWatchSpeakerGainResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HeadsetGainWatchSpeakerGainResponse)
.write_unaligned((self as *const HeadsetGainWatchSpeakerGainResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, 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::<HeadsetGainWatchSpeakerGainResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HeadsetGainWatchSpeakerGainResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { gain: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HfpRegisterRequest {
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 HfpRegisterRequest {
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<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut HfpRegisterRequest
{
#[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::<HfpRegisterRequest>(offset);
fidl::encoding::Encode::<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<HfpRegisterRequest, 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::<HfpRegisterRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HfpRegisterRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
manager: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
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::ClientEnd<CallManagerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.manager,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PeerHandlerGainControlRequest {
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 PeerHandlerGainControlRequest {
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<
PeerHandlerGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PeerHandlerGainControlRequest
{
#[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::<PeerHandlerGainControlRequest>(offset);
fidl::encoding::Encode::<PeerHandlerGainControlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PeerHandlerGainControlRequest,
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::<PeerHandlerGainControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerHandlerGainControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
control: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
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::ClientEnd<HeadsetGainMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.control,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerQueryOperatorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerQueryOperatorResponse {
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<PeerHandlerQueryOperatorResponse, D>
for &PeerHandlerQueryOperatorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerQueryOperatorResponse>(offset);
fidl::encoding::Encode::<PeerHandlerQueryOperatorResponse, D>::encode(
(
<fidl::encoding::Optional<fidl::encoding::BoundedString<16>> as fidl::encoding::ValueTypeMarker>::borrow(&self.operator),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<16>>, D>,
> fidl::encoding::Encode<PeerHandlerQueryOperatorResponse, 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::<PeerHandlerQueryOperatorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerQueryOperatorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
operator: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
D,
&mut self.operator,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, D>
for &PeerHandlerReportHeadsetBatteryLevelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PeerHandlerReportHeadsetBatteryLevelRequest).write_unaligned(
(self as *const PeerHandlerReportHeadsetBatteryLevelRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, 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::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerReportHeadsetBatteryLevelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { level: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerRequestOutgoingCallRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerRequestOutgoingCallRequest {
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<PeerHandlerRequestOutgoingCallRequest, D>
for &PeerHandlerRequestOutgoingCallRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerRequestOutgoingCallRequest>(offset);
fidl::encoding::Encode::<PeerHandlerRequestOutgoingCallRequest, D>::encode(
(<CallAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallAction, D>>
fidl::encoding::Encode<PeerHandlerRequestOutgoingCallRequest, 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::<PeerHandlerRequestOutgoingCallRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerRequestOutgoingCallRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { action: fidl::new_empty!(CallAction, 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!(CallAction, D, &mut self.action, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerSetNrecModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerSetNrecModeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, D>
for &PeerHandlerSetNrecModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerSetNrecModeRequest>(offset);
fidl::encoding::Encode::<PeerHandlerSetNrecModeRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, 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::<PeerHandlerSetNrecModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerSetNrecModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: 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.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerSubscriberNumberInformationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerSubscriberNumberInformationResponse {
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<PeerHandlerSubscriberNumberInformationResponse, D>
for &PeerHandlerSubscriberNumberInformationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
fidl::encoding::Encode::<PeerHandlerSubscriberNumberInformationResponse, D>::encode(
(
<fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.numbers),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
D,
>,
> fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, 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::<PeerHandlerSubscriberNumberInformationResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerSubscriberNumberInformationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
numbers: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
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<fidl::encoding::BoundedString<256>, 128>,
D,
&mut self.numbers,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerHandlerWatchNetworkInformationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNetworkInformationResponse {
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<PeerHandlerWatchNetworkInformationResponse, D>
for &PeerHandlerWatchNetworkInformationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
fidl::encoding::Encode::<PeerHandlerWatchNetworkInformationResponse, D>::encode(
(<NetworkInformation as fidl::encoding::ValueTypeMarker>::borrow(&self.update),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkInformation, D>>
fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, 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::<PeerHandlerWatchNetworkInformationResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerHandlerWatchNetworkInformationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { update: fidl::new_empty!(NetworkInformation, 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!(NetworkInformation, D, &mut self.update, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PeerHandlerWatchNextCallResponse {
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 PeerHandlerWatchNextCallResponse {
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<
PeerHandlerWatchNextCallResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PeerHandlerWatchNextCallResponse
{
#[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::<PeerHandlerWatchNextCallResponse>(offset);
fidl::encoding::Encode::<
PeerHandlerWatchNextCallResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<NextCall as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.call),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<
PeerHandlerWatchNextCallResponse,
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::<PeerHandlerWatchNextCallResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerHandlerWatchNextCallResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { call: fidl::new_empty!(NextCall, 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!(
NextCall,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.call,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RedialLast {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RedialLast {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RedialLast, D>
for &RedialLast
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RedialLast>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RedialLast {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for TransferActive {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TransferActive {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferActive, D>
for &TransferActive
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TransferActive>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferActive {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl NetworkInformation {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.roaming {
return 3;
}
if let Some(_) = self.signal_strength {
return 2;
}
if let Some(_) = self.service_available {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for NetworkInformation {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkInformation {
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<NetworkInformation, D>
for &NetworkInformation
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkInformation>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.service_available
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<SignalStrength, D>(
self.signal_strength
.as_ref()
.map(<SignalStrength as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.roaming.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInformation {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.service_available.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<SignalStrength 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.signal_strength.get_or_insert_with(|| fidl::new_empty!(SignalStrength, D));
fidl::decode!(SignalStrength, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.roaming.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl NextCall {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.direction {
return 4;
}
if let Some(_) = self.state {
return 3;
}
if let Some(_) = self.remote {
return 2;
}
if let Some(_) = self.call {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for NextCall {
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 NextCall {
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<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut NextCall
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NextCall>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.call.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.remote.as_ref().map(
<fidl::encoding::BoundedString<256> 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::<
CallState,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.state.as_ref().map(<CallState as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
CallDirection,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.direction
.as_ref()
.map(<CallDirection as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NextCall {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<CallMarker>,
> 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.call.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<256> 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.remote.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<CallState 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.state.get_or_insert_with(|| {
fidl::new_empty!(CallState, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
CallState,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<CallDirection 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.direction.get_or_insert_with(|| {
fidl::new_empty!(CallDirection, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
CallDirection,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CallAction {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CallAction {
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<CallAction, D>
for &CallAction
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CallAction>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
CallAction::DialFromNumber(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<256>,
D,
>(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
CallAction::DialFromLocation(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<256>,
D,
>(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
CallAction::RedialLast(ref val) => {
fidl::encoding::encode_in_envelope::<RedialLast, D>(
<RedialLast as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
CallAction::TransferActive(ref val) => {
fidl::encoding::encode_in_envelope::<TransferActive, D>(
<TransferActive as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallAction {
#[inline(always)]
fn new_empty() -> Self {
Self::DialFromNumber(fidl::new_empty!(fidl::encoding::BoundedString<256>, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => {
<fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
3 => <RedialLast as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <TransferActive as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let CallAction::DialFromNumber(_) = self {
} else {
*self = CallAction::DialFromNumber(fidl::new_empty!(
fidl::encoding::BoundedString<256>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let CallAction::DialFromNumber(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let CallAction::DialFromLocation(_) = self {
} else {
*self = CallAction::DialFromLocation(fidl::new_empty!(
fidl::encoding::BoundedString<256>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let CallAction::DialFromLocation(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<256>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let CallAction::RedialLast(_) = self {
} else {
*self = CallAction::RedialLast(fidl::new_empty!(RedialLast, D));
}
#[allow(irrefutable_let_patterns)]
if let CallAction::RedialLast(ref mut val) = self {
fidl::decode!(RedialLast, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let CallAction::TransferActive(_) = self {
} else {
*self = CallAction::TransferActive(fidl::new_empty!(TransferActive, D));
}
#[allow(irrefutable_let_patterns)]
if let CallAction::TransferActive(ref mut val) = self {
fidl::decode!(TransferActive, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}