#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const AUDIO_INPUT_BYTES_MAX: u32 = 8192;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioRecordingError {
Fail = 1,
}
impl AudioRecordingError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Fail),
_ => 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(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRecordingControlClearInputAudioRequest {
pub index: i32,
}
impl fidl::Standalone for AudioRecordingControlClearInputAudioRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRecordingControlGetOutputAudioResponse {
pub audio_data: fidl::Vmo,
}
impl fidl::Standalone for AudioRecordingControlGetOutputAudioResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRecordingControlPutInputAudioRequest {
pub index: i32,
pub audio_data: Vec<u8>,
}
impl fidl::Standalone for AudioRecordingControlPutInputAudioRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRecordingControlPutInputAudioResponse {
pub byte_count: i32,
}
impl fidl::Persistable for AudioRecordingControlPutInputAudioResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRecordingControlStartInputInjectionRequest {
pub index: i32,
}
impl fidl::Standalone for AudioRecordingControlStartInputInjectionRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioRecordingControlMarker;
impl fidl::endpoints::ProtocolMarker for AudioRecordingControlMarker {
type Proxy = AudioRecordingControlProxy;
type RequestStream = AudioRecordingControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioRecordingControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.test.audio.recording.AudioRecordingControl";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AudioRecordingControlMarker {}
pub type AudioRecordingControlClearInputAudioResult = Result<(), AudioRecordingError>;
pub type AudioRecordingControlStartInputInjectionResult = Result<(), AudioRecordingError>;
pub type AudioRecordingControlStopInputInjectionResult = Result<(), AudioRecordingError>;
pub type AudioRecordingControlStartOutputSaveResult = Result<(), AudioRecordingError>;
pub type AudioRecordingControlStopOutputSaveResult = Result<(), AudioRecordingError>;
pub trait AudioRecordingControlProxyInterface: Send + Sync {
type PutInputAudioResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#put_input_audio(&self, index: i32, audio_data: &[u8]) -> Self::PutInputAudioResponseFut;
type ClearInputAudioResponseFut: std::future::Future<
Output = Result<AudioRecordingControlClearInputAudioResult, fidl::Error>,
> + Send;
fn r#clear_input_audio(&self, index: i32) -> Self::ClearInputAudioResponseFut;
type GetOutputAudioResponseFut: std::future::Future<Output = Result<fidl::Vmo, fidl::Error>>
+ Send;
fn r#get_output_audio(&self) -> Self::GetOutputAudioResponseFut;
type StartInputInjectionResponseFut: std::future::Future<
Output = Result<AudioRecordingControlStartInputInjectionResult, fidl::Error>,
> + Send;
fn r#start_input_injection(&self, index: i32) -> Self::StartInputInjectionResponseFut;
type StopInputInjectionResponseFut: std::future::Future<
Output = Result<AudioRecordingControlStopInputInjectionResult, fidl::Error>,
> + Send;
fn r#stop_input_injection(&self) -> Self::StopInputInjectionResponseFut;
type StartOutputSaveResponseFut: std::future::Future<
Output = Result<AudioRecordingControlStartOutputSaveResult, fidl::Error>,
> + Send;
fn r#start_output_save(&self) -> Self::StartOutputSaveResponseFut;
type StopOutputSaveResponseFut: std::future::Future<Output = Result<AudioRecordingControlStopOutputSaveResult, fidl::Error>>
+ Send;
fn r#stop_output_save(&self) -> Self::StopOutputSaveResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioRecordingControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioRecordingControlSynchronousProxy {
type Proxy = AudioRecordingControlProxy;
type Protocol = AudioRecordingControlMarker;
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 AudioRecordingControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioRecordingControlMarker 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::Time,
) -> Result<AudioRecordingControlEvent, fidl::Error> {
AudioRecordingControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#put_input_audio(
&self,
mut index: i32,
mut audio_data: &[u8],
___deadline: zx::Time,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<
AudioRecordingControlPutInputAudioRequest,
AudioRecordingControlPutInputAudioResponse,
>(
(index, audio_data,),
0x42a394940006dd11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.byte_count)
}
pub fn r#clear_input_audio(
&self,
mut index: i32,
___deadline: zx::Time,
) -> Result<AudioRecordingControlClearInputAudioResult, fidl::Error> {
let _response = self.client.send_query::<
AudioRecordingControlClearInputAudioRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
>(
(index,),
0x670c5fc508b90a5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_output_audio(&self, ___deadline: zx::Time) -> Result<fidl::Vmo, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
AudioRecordingControlGetOutputAudioResponse,
>(
(),
0x7378fc9b36a657ab,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.audio_data)
}
pub fn r#start_input_injection(
&self,
mut index: i32,
___deadline: zx::Time,
) -> Result<AudioRecordingControlStartInputInjectionResult, fidl::Error> {
let _response = self.client.send_query::<
AudioRecordingControlStartInputInjectionRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
>(
(index,),
0x22f3ce3b8b505a09,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop_input_injection(
&self,
___deadline: zx::Time,
) -> Result<AudioRecordingControlStopInputInjectionResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
(),
0xe0d3fe377f4dff2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#start_output_save(
&self,
___deadline: zx::Time,
) -> Result<AudioRecordingControlStartOutputSaveResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
(),
0x70ce2b34fa5a3e08,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop_output_save(
&self,
___deadline: zx::Time,
) -> Result<AudioRecordingControlStopOutputSaveResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
(),
0x2264342c43c4f6b6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct AudioRecordingControlProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for AudioRecordingControlProxy {
type Protocol = AudioRecordingControlMarker;
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 AudioRecordingControlProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioRecordingControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioRecordingControlEventStream {
AudioRecordingControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#put_input_audio(
&self,
mut index: i32,
mut audio_data: &[u8],
) -> fidl::client::QueryResponseFut<i32> {
AudioRecordingControlProxyInterface::r#put_input_audio(self, index, audio_data)
}
pub fn r#clear_input_audio(
&self,
mut index: i32,
) -> fidl::client::QueryResponseFut<AudioRecordingControlClearInputAudioResult> {
AudioRecordingControlProxyInterface::r#clear_input_audio(self, index)
}
pub fn r#get_output_audio(&self) -> fidl::client::QueryResponseFut<fidl::Vmo> {
AudioRecordingControlProxyInterface::r#get_output_audio(self)
}
pub fn r#start_input_injection(
&self,
mut index: i32,
) -> fidl::client::QueryResponseFut<AudioRecordingControlStartInputInjectionResult> {
AudioRecordingControlProxyInterface::r#start_input_injection(self, index)
}
pub fn r#stop_input_injection(
&self,
) -> fidl::client::QueryResponseFut<AudioRecordingControlStopInputInjectionResult> {
AudioRecordingControlProxyInterface::r#stop_input_injection(self)
}
pub fn r#start_output_save(
&self,
) -> fidl::client::QueryResponseFut<AudioRecordingControlStartOutputSaveResult> {
AudioRecordingControlProxyInterface::r#start_output_save(self)
}
pub fn r#stop_output_save(
&self,
) -> fidl::client::QueryResponseFut<AudioRecordingControlStopOutputSaveResult> {
AudioRecordingControlProxyInterface::r#stop_output_save(self)
}
}
impl AudioRecordingControlProxyInterface for AudioRecordingControlProxy {
type PutInputAudioResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#put_input_audio(
&self,
mut index: i32,
mut audio_data: &[u8],
) -> Self::PutInputAudioResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRecordingControlPutInputAudioResponse,
0x42a394940006dd11,
>(_buf?)?;
Ok(_response.byte_count)
}
self.client.send_query_and_decode::<AudioRecordingControlPutInputAudioRequest, i32>(
(index, audio_data),
0x42a394940006dd11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ClearInputAudioResponseFut =
fidl::client::QueryResponseFut<AudioRecordingControlClearInputAudioResult>;
fn r#clear_input_audio(&self, mut index: i32) -> Self::ClearInputAudioResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioRecordingControlClearInputAudioResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
0x670c5fc508b90a5,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
AudioRecordingControlClearInputAudioRequest,
AudioRecordingControlClearInputAudioResult,
>(
(index,),
0x670c5fc508b90a5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetOutputAudioResponseFut = fidl::client::QueryResponseFut<fidl::Vmo>;
fn r#get_output_audio(&self) -> Self::GetOutputAudioResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Vmo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRecordingControlGetOutputAudioResponse,
0x7378fc9b36a657ab,
>(_buf?)?;
Ok(_response.audio_data)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Vmo>(
(),
0x7378fc9b36a657ab,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartInputInjectionResponseFut =
fidl::client::QueryResponseFut<AudioRecordingControlStartInputInjectionResult>;
fn r#start_input_injection(&self, mut index: i32) -> Self::StartInputInjectionResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioRecordingControlStartInputInjectionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
0x22f3ce3b8b505a09,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
AudioRecordingControlStartInputInjectionRequest,
AudioRecordingControlStartInputInjectionResult,
>(
(index,),
0x22f3ce3b8b505a09,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopInputInjectionResponseFut =
fidl::client::QueryResponseFut<AudioRecordingControlStopInputInjectionResult>;
fn r#stop_input_injection(&self) -> Self::StopInputInjectionResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioRecordingControlStopInputInjectionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
0xe0d3fe377f4dff2,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AudioRecordingControlStopInputInjectionResult,
>(
(),
0xe0d3fe377f4dff2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartOutputSaveResponseFut =
fidl::client::QueryResponseFut<AudioRecordingControlStartOutputSaveResult>;
fn r#start_output_save(&self) -> Self::StartOutputSaveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioRecordingControlStartOutputSaveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
0x70ce2b34fa5a3e08,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AudioRecordingControlStartOutputSaveResult,
>(
(),
0x70ce2b34fa5a3e08,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopOutputSaveResponseFut =
fidl::client::QueryResponseFut<AudioRecordingControlStopOutputSaveResult>;
fn r#stop_output_save(&self) -> Self::StopOutputSaveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<AudioRecordingControlStopOutputSaveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioRecordingError>,
0x2264342c43c4f6b6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AudioRecordingControlStopOutputSaveResult,
>(
(),
0x2264342c43c4f6b6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AudioRecordingControlEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for AudioRecordingControlEventStream {}
impl futures::stream::FusedStream for AudioRecordingControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioRecordingControlEventStream {
type Item = Result<AudioRecordingControlEvent, 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(AudioRecordingControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioRecordingControlEvent {}
impl AudioRecordingControlEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<AudioRecordingControlEvent, 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:
<AudioRecordingControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioRecordingControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioRecordingControlRequestStream {}
impl futures::stream::FusedStream for AudioRecordingControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioRecordingControlRequestStream {
type Protocol = AudioRecordingControlMarker;
type ControlHandle = AudioRecordingControlControlHandle;
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 {
AudioRecordingControlControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for AudioRecordingControlRequestStream {
type Item = Result<AudioRecordingControlRequest, 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 AudioRecordingControlRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x42a394940006dd11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AudioRecordingControlPutInputAudioRequest);
fidl::encoding::Decoder::decode_into::<
AudioRecordingControlPutInputAudioRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::PutInputAudio {
index: req.index,
audio_data: req.audio_data,
responder: AudioRecordingControlPutInputAudioResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x670c5fc508b90a5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AudioRecordingControlClearInputAudioRequest);
fidl::encoding::Decoder::decode_into::<
AudioRecordingControlClearInputAudioRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::ClearInputAudio {
index: req.index,
responder: AudioRecordingControlClearInputAudioResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7378fc9b36a657ab => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::GetOutputAudio {
responder: AudioRecordingControlGetOutputAudioResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x22f3ce3b8b505a09 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AudioRecordingControlStartInputInjectionRequest);
fidl::encoding::Decoder::decode_into::<
AudioRecordingControlStartInputInjectionRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::StartInputInjection {
index: req.index,
responder: AudioRecordingControlStartInputInjectionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe0d3fe377f4dff2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::StopInputInjection {
responder: AudioRecordingControlStopInputInjectionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x70ce2b34fa5a3e08 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::StartOutputSave {
responder: AudioRecordingControlStartOutputSaveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2264342c43c4f6b6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
AudioRecordingControlControlHandle { inner: this.inner.clone() };
Ok(AudioRecordingControlRequest::StopOutputSave {
responder: AudioRecordingControlStopOutputSaveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioRecordingControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum AudioRecordingControlRequest {
PutInputAudio {
index: i32,
audio_data: Vec<u8>,
responder: AudioRecordingControlPutInputAudioResponder,
},
ClearInputAudio { index: i32, responder: AudioRecordingControlClearInputAudioResponder },
GetOutputAudio { responder: AudioRecordingControlGetOutputAudioResponder },
StartInputInjection { index: i32, responder: AudioRecordingControlStartInputInjectionResponder },
StopInputInjection { responder: AudioRecordingControlStopInputInjectionResponder },
StartOutputSave { responder: AudioRecordingControlStartOutputSaveResponder },
StopOutputSave { responder: AudioRecordingControlStopOutputSaveResponder },
}
impl AudioRecordingControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_put_input_audio(
self,
) -> Option<(i32, Vec<u8>, AudioRecordingControlPutInputAudioResponder)> {
if let AudioRecordingControlRequest::PutInputAudio { index, audio_data, responder } = self {
Some((index, audio_data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_clear_input_audio(
self,
) -> Option<(i32, AudioRecordingControlClearInputAudioResponder)> {
if let AudioRecordingControlRequest::ClearInputAudio { index, responder } = self {
Some((index, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_output_audio(self) -> Option<(AudioRecordingControlGetOutputAudioResponder)> {
if let AudioRecordingControlRequest::GetOutputAudio { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_input_injection(
self,
) -> Option<(i32, AudioRecordingControlStartInputInjectionResponder)> {
if let AudioRecordingControlRequest::StartInputInjection { index, responder } = self {
Some((index, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_input_injection(
self,
) -> Option<(AudioRecordingControlStopInputInjectionResponder)> {
if let AudioRecordingControlRequest::StopInputInjection { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_output_save(self) -> Option<(AudioRecordingControlStartOutputSaveResponder)> {
if let AudioRecordingControlRequest::StartOutputSave { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_output_save(self) -> Option<(AudioRecordingControlStopOutputSaveResponder)> {
if let AudioRecordingControlRequest::StopOutputSave { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioRecordingControlRequest::PutInputAudio { .. } => "put_input_audio",
AudioRecordingControlRequest::ClearInputAudio { .. } => "clear_input_audio",
AudioRecordingControlRequest::GetOutputAudio { .. } => "get_output_audio",
AudioRecordingControlRequest::StartInputInjection { .. } => "start_input_injection",
AudioRecordingControlRequest::StopInputInjection { .. } => "stop_input_injection",
AudioRecordingControlRequest::StartOutputSave { .. } => "start_output_save",
AudioRecordingControlRequest::StopOutputSave { .. } => "stop_output_save",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioRecordingControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for AudioRecordingControlControlHandle {
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()
}
}
impl AudioRecordingControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlPutInputAudioResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlPutInputAudioResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlPutInputAudioResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlPutInputAudioResponder {
pub fn send(self, mut byte_count: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(byte_count);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut byte_count: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(byte_count);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut byte_count: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRecordingControlPutInputAudioResponse>(
(byte_count,),
self.tx_id,
0x42a394940006dd11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlClearInputAudioResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlClearInputAudioResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlClearInputAudioResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlClearInputAudioResponder {
pub fn send(self, mut result: Result<(), AudioRecordingError>) -> 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<(), AudioRecordingError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), AudioRecordingError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
result,
self.tx_id,
0x670c5fc508b90a5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlGetOutputAudioResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlGetOutputAudioResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlGetOutputAudioResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlGetOutputAudioResponder {
pub fn send(self, mut audio_data: fidl::Vmo) -> Result<(), fidl::Error> {
let _result = self.send_raw(audio_data);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut audio_data: fidl::Vmo) -> Result<(), fidl::Error> {
let _result = self.send_raw(audio_data);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut audio_data: fidl::Vmo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRecordingControlGetOutputAudioResponse>(
(audio_data,),
self.tx_id,
0x7378fc9b36a657ab,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlStartInputInjectionResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlStartInputInjectionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlStartInputInjectionResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlStartInputInjectionResponder {
pub fn send(self, mut result: Result<(), AudioRecordingError>) -> 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<(), AudioRecordingError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), AudioRecordingError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
result,
self.tx_id,
0x22f3ce3b8b505a09,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlStopInputInjectionResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlStopInputInjectionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlStopInputInjectionResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlStopInputInjectionResponder {
pub fn send(self, mut result: Result<(), AudioRecordingError>) -> 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<(), AudioRecordingError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), AudioRecordingError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
result,
self.tx_id,
0xe0d3fe377f4dff2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlStartOutputSaveResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlStartOutputSaveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlStartOutputSaveResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlStartOutputSaveResponder {
pub fn send(self, mut result: Result<(), AudioRecordingError>) -> 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<(), AudioRecordingError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), AudioRecordingError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
result,
self.tx_id,
0x70ce2b34fa5a3e08,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRecordingControlStopOutputSaveResponder {
control_handle: std::mem::ManuallyDrop<AudioRecordingControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRecordingControlStopOutputSaveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRecordingControlStopOutputSaveResponder {
type ControlHandle = AudioRecordingControlControlHandle;
fn control_handle(&self) -> &AudioRecordingControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRecordingControlStopOutputSaveResponder {
pub fn send(self, mut result: Result<(), AudioRecordingError>) -> 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<(), AudioRecordingError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), AudioRecordingError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AudioRecordingError,
>>(
result,
self.tx_id,
0x2264342c43c4f6b6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AudioRecordingError {
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 AudioRecordingError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AudioRecordingError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioRecordingError {
#[inline(always)]
fn new_empty() -> Self {
Self::Fail
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 AudioRecordingControlClearInputAudioRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRecordingControlClearInputAudioRequest {
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::Encode<AudioRecordingControlClearInputAudioRequest>
for &mut AudioRecordingControlClearInputAudioRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlClearInputAudioRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRecordingControlClearInputAudioRequest).write_unaligned(
(self as *const AudioRecordingControlClearInputAudioRequest).read(),
);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>>
fidl::encoding::Encode<AudioRecordingControlClearInputAudioRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlClearInputAudioRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioRecordingControlClearInputAudioRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { index: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRecordingControlGetOutputAudioResponse {
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
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRecordingControlGetOutputAudioResponse {
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::Encode<AudioRecordingControlGetOutputAudioResponse>
for &mut AudioRecordingControlGetOutputAudioResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlGetOutputAudioResponse>(offset);
fidl::encoding::Encode::<AudioRecordingControlGetOutputAudioResponse>::encode(
(<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.audio_data
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<AudioRecordingControlGetOutputAudioResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlGetOutputAudioResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioRecordingControlGetOutputAudioResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
audio_data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.audio_data, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRecordingControlPutInputAudioRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRecordingControlPutInputAudioRequest {
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::Encode<AudioRecordingControlPutInputAudioRequest>
for &mut AudioRecordingControlPutInputAudioRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlPutInputAudioRequest>(offset);
fidl::encoding::Encode::<AudioRecordingControlPutInputAudioRequest>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
&self.audio_data,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>>,
> fidl::encoding::Encode<AudioRecordingControlPutInputAudioRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlPutInputAudioRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(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> for AudioRecordingControlPutInputAudioRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
index: fidl::new_empty!(i32),
audio_data: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, &mut self.index, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 8192>, &mut self.audio_data, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRecordingControlPutInputAudioResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for AudioRecordingControlPutInputAudioResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AudioRecordingControlPutInputAudioResponse>
for &AudioRecordingControlPutInputAudioResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlPutInputAudioResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRecordingControlPutInputAudioResponse).write_unaligned(
(self as *const AudioRecordingControlPutInputAudioResponse).read(),
);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>>
fidl::encoding::Encode<AudioRecordingControlPutInputAudioResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlPutInputAudioResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioRecordingControlPutInputAudioResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { byte_count: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRecordingControlStartInputInjectionRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRecordingControlStartInputInjectionRequest {
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::Encode<AudioRecordingControlStartInputInjectionRequest>
for &mut AudioRecordingControlStartInputInjectionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlStartInputInjectionRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRecordingControlStartInputInjectionRequest).write_unaligned(
(self as *const AudioRecordingControlStartInputInjectionRequest).read(),
);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>>
fidl::encoding::Encode<AudioRecordingControlStartInputInjectionRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRecordingControlStartInputInjectionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AudioRecordingControlStartInputInjectionRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { index: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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, 4);
}
Ok(())
}
}
}