#![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 CompressionType = String;
pub type EncryptionScheme = String;
pub type InitVector = Vec<u8>;
pub type KeyId = Vec<u8>;
pub const AUDIO_ENCODING_AAC: &str = "fuchsia.media.aac";
pub const AUDIO_ENCODING_AACLATM: &str = "fuchsia.media.aaclatm";
pub const AUDIO_ENCODING_AMRNB: &str = "fuchsia.media.amrnb";
pub const AUDIO_ENCODING_AMRWB: &str = "fuchsia.media.amrwb";
pub const AUDIO_ENCODING_APTX: &str = "fuchsia.media.aptx";
pub const AUDIO_ENCODING_FLAC: &str = "fuchsia.media.flac";
pub const AUDIO_ENCODING_GSMMS: &str = "fuchsia.media.gsmms";
pub const AUDIO_ENCODING_LPCM: &str = "fuchsia.media.lpcm";
pub const AUDIO_ENCODING_MP3: &str = "fuchsia.media.mp3";
pub const AUDIO_ENCODING_OPUS: &str = "fuchsia.media.opus";
pub const AUDIO_ENCODING_PCMALAW: &str = "fuchsia.media.pcmalaw";
pub const AUDIO_ENCODING_PCMMULAW: &str = "fuchsia.media.pcmmulaw";
pub const AUDIO_ENCODING_SBC: &str = "fuchsia.media.sbc";
pub const AUDIO_ENCODING_VORBIS: &str = "fuchsia.media.vorbis";
pub const CAPTURE_USAGE_COUNT: u8 = 4;
pub const ENCRYPTION_SCHEME_CBC1: &str = "cbc1";
pub const ENCRYPTION_SCHEME_CBCS: &str = "cbcs";
pub const ENCRYPTION_SCHEME_CENC: &str = "cenc";
pub const ENCRYPTION_SCHEME_CENS: &str = "cens";
pub const ENCRYPTION_SCHEME_UNENCRYPTED: &str = "unencrypted";
pub const MAX_ENCRYPTION_SCHEME_SIZE: u32 = 100;
pub const MAX_FRAMES_PER_RENDERER_PACKET: i64 = 262143;
pub const MAX_INIT_VECTOR_SIZE: u32 = 16;
pub const MAX_KEY_ID_SIZE: u32 = 16;
pub const MAX_PCM_CHANNEL_COUNT: u32 = 8;
pub const MAX_PCM_FRAMES_PER_SECOND: u32 = 192000;
pub const METADATA_LABEL_ALBUM: &str = "fuchsia.media.album";
pub const METADATA_LABEL_ARTIST: &str = "fuchsia.media.artist";
pub const METADATA_LABEL_COMPOSER: &str = "fuchsia.media.composer";
pub const METADATA_LABEL_EPISODE: &str = "fuchsia.media.episode";
pub const METADATA_LABEL_GENRE: &str = "fuchsia.media.genre";
pub const METADATA_LABEL_PUBLISHER: &str = "fuchsia.media.publisher";
pub const METADATA_LABEL_RELEASE_DATE: &str = "fuchsia.media.release_date";
pub const METADATA_LABEL_SEASON: &str = "fuchsia.media.season";
pub const METADATA_LABEL_STUDIO: &str = "fuchsia.media.studio";
pub const METADATA_LABEL_SUBTITLE: &str = "fuchsia.media.subtitle";
pub const METADATA_LABEL_TITLE: &str = "fuchsia.media.title";
pub const METADATA_LABEL_TRACK_NUMBER: &str = "fuchsia.media.track_number";
pub const METADATA_SOURCE_TITLE: &str = "fuchsia.media.source_title";
pub const MIN_PCM_CHANNEL_COUNT: u32 = 1;
pub const MIN_PCM_FRAMES_PER_SECOND: u32 = 1000;
pub const NO_TIMESTAMP: i64 = 9223372036854775807;
pub const RENDER_USAGE_COUNT: u8 = 5;
pub const STREAM_PACKET_FLAG_DISCONTINUITY: u32 = 4;
pub const STREAM_PACKET_FLAG_DROPPABLE: u32 = 2;
pub const STREAM_PACKET_FLAG_KEY_FRAME: u32 = 1;
pub const VIDEO_ENCODING_H263: &str = "fuchsia.media.h263";
pub const VIDEO_ENCODING_H264: &str = "fuchsia.media.h264";
pub const VIDEO_ENCODING_MPEG4: &str = "fuchsia.media.mpeg4";
pub const VIDEO_ENCODING_THEORA: &str = "fuchsia.media.theora";
pub const VIDEO_ENCODING_UNCOMPRESSED: &str = "fuchsia.media.uncompressed_video";
pub const VIDEO_ENCODING_VP3: &str = "fuchsia.media.vp3";
pub const VIDEO_ENCODING_VP8: &str = "fuchsia.media.vp8";
pub const VIDEO_ENCODING_VP9: &str = "fuchsia.media.vp9";
pub const MAX_OOB_BYTES_SIZE: u64 = 8192;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AudioConsumerStartFlags: u32 {
const LOW_LATENCY = 1;
const SUPPLY_DRIVEN = 2;
}
}
impl AudioConsumerStartFlags {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AudioGainInfoFlags: u32 {
const MUTE = 1;
const AGC_SUPPORTED = 2;
const AGC_ENABLED = 4;
}
}
impl AudioGainInfoFlags {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AudioGainValidFlags: u32 {
const GAIN_VALID = 1;
const MUTE_VALID = 2;
const AGC_VALID = 4;
}
}
impl AudioGainValidFlags {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AacAudioObjectType {
Mpeg2AacLc = 0,
Mpeg4AacLc = 1,
}
impl AacAudioObjectType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Mpeg2AacLc),
1 => Some(Self::Mpeg4AacLc),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AacChannelMode {
Mono = 0,
Stereo = 2,
}
impl AacChannelMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Mono),
2 => Some(Self::Stereo),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AacVariableBitRate {
V1 = 1,
V2 = 2,
V3 = 3,
V4 = 4,
V5 = 5,
}
impl AacVariableBitRate {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::V1),
2 => Some(Self::V2),
3 => Some(Self::V3),
4 => Some(Self::V4),
5 => Some(Self::V5),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioBitrateMode {
Unspecified = 0,
Cbr = 1,
Vbr = 2,
}
impl AudioBitrateMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unspecified),
1 => Some(Self::Cbr),
2 => Some(Self::Vbr),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioCaptureUsage {
Background = 0,
Foreground = 1,
SystemAgent = 2,
Communication = 3,
}
impl AudioCaptureUsage {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Background),
1 => Some(Self::Foreground),
2 => Some(Self::SystemAgent),
3 => Some(Self::Communication),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioChannelId {
Skip = 0,
Lf = 1,
Rf = 2,
Cf = 3,
Ls = 4,
Rs = 5,
Lfe = 6,
Cs = 7,
Lr = 8,
Rr = 9,
EndDefined = 10,
ExtendedChannelIdBase = 1862270976,
Max = 2147483647,
}
impl AudioChannelId {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Skip),
1 => Some(Self::Lf),
2 => Some(Self::Rf),
3 => Some(Self::Cf),
4 => Some(Self::Ls),
5 => Some(Self::Rs),
6 => Some(Self::Lfe),
7 => Some(Self::Cs),
8 => Some(Self::Lr),
9 => Some(Self::Rr),
10 => Some(Self::EndDefined),
1862270976 => Some(Self::ExtendedChannelIdBase),
2147483647 => Some(Self::Max),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioOutputRoutingPolicy {
AllPluggedOutputs = 0,
LastPluggedOutput = 1,
}
impl AudioOutputRoutingPolicy {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::AllPluggedOutputs),
1 => Some(Self::LastPluggedOutput),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioPcmMode {
Linear = 0,
Alaw = 1,
Mulaw = 2,
}
impl AudioPcmMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Linear),
1 => Some(Self::Alaw),
2 => Some(Self::Mulaw),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioRenderUsage {
Background = 0,
Media = 1,
Interruption = 2,
SystemAgent = 3,
Communication = 4,
}
impl AudioRenderUsage {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Background),
1 => Some(Self::Media),
2 => Some(Self::Interruption),
3 => Some(Self::SystemAgent),
4 => Some(Self::Communication),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AudioSampleFormat {
Unsigned8 = 1,
Signed16 = 2,
Signed24In32 = 3,
Float = 4,
}
impl AudioSampleFormat {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unsigned8),
2 => Some(Self::Signed16),
3 => Some(Self::Signed24In32),
4 => Some(Self::Float),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Behavior {
None = 0,
Duck = 1,
Mute = 2,
}
impl Behavior {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::None),
1 => Some(Self::Duck),
2 => Some(Self::Mute),
_ => 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 CodecProfile {
H264ProfileBaseline,
H264ProfileMain,
H264ProfileExtended,
H264ProfileHigh,
H264ProfileHigh10Profile,
H264ProfileHigh422Profile,
H264ProfileHigh444Predictiveprofile,
H264ProfileScalablebaseline,
H264ProfileScalablehigh,
H264ProfileStereohigh,
H264ProfileMultiviewhigh,
Vp8ProfileAny,
Vp9ProfileProfile0,
Vp9ProfileProfile1,
Vp9ProfileProfile2,
Vp9ProfileProfile3,
HevcprofileMain,
HevcprofileMain10,
HevcprofileMainStillPicture,
MjpegBaseline,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! CodecProfileUnknown {
() => {
_
};
}
impl CodecProfile {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::H264ProfileBaseline),
1 => Some(Self::H264ProfileMain),
2 => Some(Self::H264ProfileExtended),
3 => Some(Self::H264ProfileHigh),
4 => Some(Self::H264ProfileHigh10Profile),
5 => Some(Self::H264ProfileHigh422Profile),
6 => Some(Self::H264ProfileHigh444Predictiveprofile),
7 => Some(Self::H264ProfileScalablebaseline),
8 => Some(Self::H264ProfileScalablehigh),
9 => Some(Self::H264ProfileStereohigh),
10 => Some(Self::H264ProfileMultiviewhigh),
11 => Some(Self::Vp8ProfileAny),
12 => Some(Self::Vp9ProfileProfile0),
13 => Some(Self::Vp9ProfileProfile1),
14 => Some(Self::Vp9ProfileProfile2),
15 => Some(Self::Vp9ProfileProfile3),
16 => Some(Self::HevcprofileMain),
17 => Some(Self::HevcprofileMain10),
18 => Some(Self::HevcprofileMainStillPicture),
19 => Some(Self::MjpegBaseline),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::H264ProfileBaseline,
1 => Self::H264ProfileMain,
2 => Self::H264ProfileExtended,
3 => Self::H264ProfileHigh,
4 => Self::H264ProfileHigh10Profile,
5 => Self::H264ProfileHigh422Profile,
6 => Self::H264ProfileHigh444Predictiveprofile,
7 => Self::H264ProfileScalablebaseline,
8 => Self::H264ProfileScalablehigh,
9 => Self::H264ProfileStereohigh,
10 => Self::H264ProfileMultiviewhigh,
11 => Self::Vp8ProfileAny,
12 => Self::Vp9ProfileProfile0,
13 => Self::Vp9ProfileProfile1,
14 => Self::Vp9ProfileProfile2,
15 => Self::Vp9ProfileProfile3,
16 => Self::HevcprofileMain,
17 => Self::HevcprofileMain10,
18 => Self::HevcprofileMainStillPicture,
19 => Self::MjpegBaseline,
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::H264ProfileBaseline => 0,
Self::H264ProfileMain => 1,
Self::H264ProfileExtended => 2,
Self::H264ProfileHigh => 3,
Self::H264ProfileHigh10Profile => 4,
Self::H264ProfileHigh422Profile => 5,
Self::H264ProfileHigh444Predictiveprofile => 6,
Self::H264ProfileScalablebaseline => 7,
Self::H264ProfileScalablehigh => 8,
Self::H264ProfileStereohigh => 9,
Self::H264ProfileMultiviewhigh => 10,
Self::Vp8ProfileAny => 11,
Self::Vp9ProfileProfile0 => 12,
Self::Vp9ProfileProfile1 => 13,
Self::Vp9ProfileProfile2 => 14,
Self::Vp9ProfileProfile3 => 15,
Self::HevcprofileMain => 16,
Self::HevcprofileMain10 => 17,
Self::HevcprofileMainStillPicture => 18,
Self::MjpegBaseline => 19,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ColorSpace {
Unknown = 0,
NotApplicable = 1,
Jpeg = 2,
HdRec709 = 3,
SdRec601 = 4,
}
impl ColorSpace {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unknown),
1 => Some(Self::NotApplicable),
2 => Some(Self::Jpeg),
3 => Some(Self::HdRec709),
4 => Some(Self::SdRec601),
_ => 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 Lc3FrameDuration {
D10Ms,
D7P5Ms,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! Lc3FrameDurationUnknown {
() => {
_
};
}
impl Lc3FrameDuration {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::D10Ms),
2 => Some(Self::D7P5Ms),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::D10Ms,
2 => Self::D7P5Ms,
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::D10Ms => 1,
Self::D7P5Ms => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum SbcAllocation {
AllocLoudness = 0,
AllocSnr = 1,
}
impl SbcAllocation {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::AllocLoudness),
1 => Some(Self::AllocSnr),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum SbcBlockCount {
BlockCount4 = 4,
BlockCount8 = 8,
BlockCount12 = 12,
BlockCount16 = 16,
}
impl SbcBlockCount {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
4 => Some(Self::BlockCount4),
8 => Some(Self::BlockCount8),
12 => Some(Self::BlockCount12),
16 => Some(Self::BlockCount16),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum SbcChannelMode {
Mono = 0,
Dual = 1,
Stereo = 2,
JointStereo = 3,
}
impl SbcChannelMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Mono),
1 => Some(Self::Dual),
2 => Some(Self::Stereo),
3 => Some(Self::JointStereo),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum SbcSubBands {
SubBands4 = 4,
SubBands8 = 8,
}
impl SbcSubBands {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
4 => Some(Self::SubBands4),
8 => Some(Self::SubBands8),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum StreamError {
Unknown = 1,
InvalidInputFormatDetails = 2,
IncompatibleBuffersProvided = 3,
EosProcessing = 4,
DecoderUnknown = 16777217,
DecoderDataParsing = 16777218,
EncoderUnknown = 33554433,
DecryptorUnknown = 50331649,
DecryptorNoKey = 50331650,
}
impl StreamError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unknown),
2 => Some(Self::InvalidInputFormatDetails),
3 => Some(Self::IncompatibleBuffersProvided),
4 => Some(Self::EosProcessing),
16777217 => Some(Self::DecoderUnknown),
16777218 => Some(Self::DecoderDataParsing),
33554433 => Some(Self::EncoderUnknown),
50331649 => Some(Self::DecryptorUnknown),
50331650 => Some(Self::DecryptorNoKey),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum VideoColorSpace {
Invalid = 0,
}
impl VideoColorSpace {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Invalid),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AacConstantBitRate {
pub bit_rate: u32,
}
impl fidl::Persistable for AacConstantBitRate {}
#[derive(Clone, Debug, PartialEq)]
pub struct AacEncoderSettings {
pub transport: AacTransport,
pub channel_mode: AacChannelMode,
pub bit_rate: AacBitRate,
pub aot: AacAudioObjectType,
}
impl fidl::Persistable for AacEncoderSettings {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AacTransportAdts;
impl fidl::Persistable for AacTransportAdts {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AacTransportLatm {
pub mux_config_present: bool,
}
impl fidl::Persistable for AacTransportLatm {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AacTransportRaw;
impl fidl::Persistable for AacTransportRaw {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ActivityReporterWatchCaptureActivityResponse {
pub active_usages: Vec<AudioCaptureUsage>,
}
impl fidl::Persistable for ActivityReporterWatchCaptureActivityResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ActivityReporterWatchRenderActivityResponse {
pub active_usages: Vec<AudioRenderUsage>,
}
impl fidl::Persistable for ActivityReporterWatchRenderActivityResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerBindGainControlRequest {
pub gain_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerBindGainControlRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioCapturerCaptureAtRequest {
pub payload_buffer_id: u32,
pub payload_offset: u32,
pub frames: u32,
}
impl fidl::Persistable for AudioCapturerCaptureAtRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioCapturerCaptureAtResponse {
pub captured_packet: StreamPacket,
}
impl fidl::Persistable for AudioCapturerCaptureAtResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerGetReferenceClockResponse {
pub reference_clock: fidl::Clock,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerGetReferenceClockResponse
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerGetStreamTypeResponse {
pub stream_type: StreamType,
}
impl fidl::Persistable for AudioCapturerGetStreamTypeResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerSetPcmStreamTypeRequest {
pub stream_type: AudioStreamType,
}
impl fidl::Persistable for AudioCapturerSetPcmStreamTypeRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerSetReferenceClockRequest {
pub reference_clock: Option<fidl::Clock>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerSetReferenceClockRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCapturerSetUsageRequest {
pub usage: AudioCaptureUsage,
}
impl fidl::Persistable for AudioCapturerSetUsageRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioCapturerStartAsyncCaptureRequest {
pub frames_per_packet: u32,
}
impl fidl::Persistable for AudioCapturerStartAsyncCaptureRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCompressedFormatAac;
impl fidl::Persistable for AudioCompressedFormatAac {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCompressedFormatSbc;
impl fidl::Persistable for AudioCompressedFormatSbc {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioConsumerBindVolumeControlRequest {
pub volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioConsumerBindVolumeControlRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioConsumerCreateStreamSinkRequest {
pub buffers: Vec<fidl::Vmo>,
pub stream_type: AudioStreamType,
pub compression: Option<Box<Compression>>,
pub stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioConsumerCreateStreamSinkRequest
{
}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioConsumerSetRateRequest {
pub rate: f32,
}
impl fidl::Persistable for AudioConsumerSetRateRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioConsumerStartRequest {
pub flags: AudioConsumerStartFlags,
pub reference_time: i64,
pub media_time: i64,
}
impl fidl::Persistable for AudioConsumerStartRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct AudioConsumerWatchStatusResponse {
pub status: AudioConsumerStatus,
}
impl fidl::Persistable for AudioConsumerWatchStatusResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCoreBindUsageVolumeControlRequest {
pub usage: Usage,
pub volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreBindUsageVolumeControlRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCoreCreateAudioCapturerRequest {
pub loopback: bool,
pub audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioCapturerRequest
{
}
#[derive(Debug, PartialEq)]
pub struct AudioCoreCreateAudioCapturerWithConfigurationRequest {
pub stream_type: AudioStreamType,
pub configuration: AudioCapturerConfiguration,
pub audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioCapturerWithConfigurationRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCoreCreateAudioRendererRequest {
pub audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioRendererRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCoreEnableDeviceSettingsRequest {
pub enabled: bool,
}
impl fidl::Persistable for AudioCoreEnableDeviceSettingsRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreGetDbFromVolumeRequest {
pub usage: Usage,
pub volume: f32,
}
impl fidl::Persistable for AudioCoreGetDbFromVolumeRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreGetDbFromVolumeResponse {
pub gain_db: f32,
}
impl fidl::Persistable for AudioCoreGetDbFromVolumeResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreGetVolumeFromDbRequest {
pub usage: Usage,
pub gain_db: f32,
}
impl fidl::Persistable for AudioCoreGetVolumeFromDbRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreGetVolumeFromDbResponse {
pub volume: f32,
}
impl fidl::Persistable for AudioCoreGetVolumeFromDbResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreSetCaptureUsageGainRequest {
pub usage: AudioCaptureUsage,
pub gain_db: f32,
}
impl fidl::Persistable for AudioCoreSetCaptureUsageGainRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCoreSetInteractionRequest {
pub active: Usage,
pub affected: Usage,
pub behavior: Behavior,
}
impl fidl::Persistable for AudioCoreSetInteractionRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioCoreSetRenderUsageGainRequest {
pub usage: AudioRenderUsage,
pub gain_db: f32,
}
impl fidl::Persistable for AudioCoreSetRenderUsageGainRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCreateAudioCapturerRequest {
pub audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
pub loopback: bool,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCreateAudioCapturerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioCreateAudioRendererRequest {
pub audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCreateAudioRendererRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorAddDeviceByChannelRequest {
pub device_name: String,
pub is_input: bool,
pub channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioDeviceEnumeratorAddDeviceByChannelRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioDeviceEnumeratorGetDeviceGainRequest {
pub device_token: u64,
}
impl fidl::Persistable for AudioDeviceEnumeratorGetDeviceGainRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorGetDeviceGainResponse {
pub device_token: u64,
pub gain_info: AudioGainInfo,
}
impl fidl::Persistable for AudioDeviceEnumeratorGetDeviceGainResponse {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorGetDevicesResponse {
pub devices: Vec<AudioDeviceInfo>,
}
impl fidl::Persistable for AudioDeviceEnumeratorGetDevicesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
pub old_default_token: u64,
pub new_default_token: u64,
}
impl fidl::Persistable for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorOnDeviceAddedRequest {
pub device: AudioDeviceInfo,
}
impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceAddedRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorOnDeviceGainChangedRequest {
pub device_token: u64,
pub gain_info: AudioGainInfo,
}
impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceGainChangedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioDeviceEnumeratorOnDeviceRemovedRequest {
pub device_token: u64,
}
impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceRemovedRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceEnumeratorSetDeviceGainRequest {
pub device_token: u64,
pub gain_info: AudioGainInfo,
pub valid_flags: AudioGainValidFlags,
}
impl fidl::Persistable for AudioDeviceEnumeratorSetDeviceGainRequest {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct AudioDeviceInfo {
pub name: String,
pub unique_id: String,
pub token_id: u64,
pub is_input: bool,
pub gain_info: AudioGainInfo,
pub is_default: bool,
}
impl fidl::Persistable for AudioDeviceInfo {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioGainInfo {
pub gain_db: f32,
pub flags: AudioGainInfoFlags,
}
impl fidl::Persistable for AudioGainInfo {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererBindGainControlRequest {
pub gain_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererBindGainControlRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererEnableMinLeadTimeEventsRequest {
pub enabled: bool,
}
impl fidl::Persistable for AudioRendererEnableMinLeadTimeEventsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererGetMinLeadTimeResponse {
pub min_lead_time_nsec: i64,
}
impl fidl::Persistable for AudioRendererGetMinLeadTimeResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererGetReferenceClockResponse {
pub reference_clock: fidl::Clock,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererGetReferenceClockResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererOnMinLeadTimeChangedRequest {
pub min_lead_time_nsec: i64,
}
impl fidl::Persistable for AudioRendererOnMinLeadTimeChangedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererPauseResponse {
pub reference_time: i64,
pub media_time: i64,
}
impl fidl::Persistable for AudioRendererPauseResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererPlayNoReplyRequest {
pub reference_time: i64,
pub media_time: i64,
}
impl fidl::Persistable for AudioRendererPlayNoReplyRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererPlayRequest {
pub reference_time: i64,
pub media_time: i64,
}
impl fidl::Persistable for AudioRendererPlayRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererPlayResponse {
pub reference_time: i64,
pub media_time: i64,
}
impl fidl::Persistable for AudioRendererPlayResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererSetPcmStreamTypeRequest {
pub type_: AudioStreamType,
}
impl fidl::Persistable for AudioRendererSetPcmStreamTypeRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AudioRendererSetPtsContinuityThresholdRequest {
pub threshold_seconds: f32,
}
impl fidl::Persistable for AudioRendererSetPtsContinuityThresholdRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct AudioRendererSetPtsUnitsRequest {
pub tick_per_second_numerator: u32,
pub tick_per_second_denominator: u32,
}
impl fidl::Persistable for AudioRendererSetPtsUnitsRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererSetReferenceClockRequest {
pub reference_clock: Option<fidl::Clock>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererSetReferenceClockRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioRendererSetUsageRequest {
pub usage: AudioRenderUsage,
}
impl fidl::Persistable for AudioRendererSetUsageRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioStreamType {
pub sample_format: AudioSampleFormat,
pub channels: u32,
pub frames_per_second: u32,
}
impl fidl::Persistable for AudioStreamType {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Compression {
pub type_: String,
pub parameters: Option<Vec<u8>>,
}
impl fidl::Persistable for Compression {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct EncryptionPattern {
pub clear_blocks: u32,
pub encrypted_blocks: u32,
}
impl fidl::Persistable for EncryptionPattern {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Metadata {
pub properties: Vec<Property>,
}
impl fidl::Persistable for Metadata {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Parameter {
pub scope: String,
pub name: String,
pub value: Value,
}
impl fidl::Persistable for Parameter {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PcmFormat {
pub pcm_mode: AudioPcmMode,
pub bits_per_sample: u32,
pub frames_per_second: u32,
pub channel_map: Vec<AudioChannelId>,
}
impl fidl::Persistable for PcmFormat {}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct ProfileProviderRegisterHandlerWithCapacityRequest {
pub thread_handle: fidl::Thread,
pub name: String,
pub period: i64,
pub capacity: f32,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderRegisterHandlerWithCapacityRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ProfileProviderRegisterHandlerWithCapacityResponse {
pub period: i64,
pub capacity: i64,
}
impl fidl::Persistable for ProfileProviderRegisterHandlerWithCapacityResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderRegisterMemoryRangeRequest {
pub vmar_handle: fidl::Vmar,
pub name: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderRegisterMemoryRangeRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderUnregisterHandlerRequest {
pub thread_handle: fidl::Thread,
pub name: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderUnregisterHandlerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProfileProviderUnregisterMemoryRangeRequest {
pub vmar_handle: fidl::Vmar,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderUnregisterMemoryRangeRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Property {
pub label: String,
pub value: String,
}
impl fidl::Persistable for Property {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SbcEncoderSettings {
pub sub_bands: SbcSubBands,
pub allocation: SbcAllocation,
pub block_count: SbcBlockCount,
pub channel_mode: SbcChannelMode,
pub bit_pool: u64,
}
impl fidl::Persistable for SbcEncoderSettings {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionAudioConsumerFactoryCreateAudioConsumerRequest {
pub session_id: u64,
pub audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for SessionAudioConsumerFactoryCreateAudioConsumerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamBufferSetAddPayloadBufferRequest {
pub id: u32,
pub payload_buffer: fidl::Vmo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamBufferSetAddPayloadBufferRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamBufferSetRemovePayloadBufferRequest {
pub id: u32,
}
impl fidl::Persistable for StreamBufferSetRemovePayloadBufferRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamPacket {
pub pts: i64,
pub payload_buffer_id: u32,
pub payload_offset: u64,
pub payload_size: u64,
pub flags: u32,
pub buffer_config: u64,
pub stream_segment_id: u64,
}
impl fidl::Persistable for StreamPacket {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamProcessorCloseCurrentStreamRequest {
pub stream_lifetime_ordinal: u64,
pub release_input_buffers: bool,
pub release_output_buffers: bool,
}
impl fidl::Persistable for StreamProcessorCloseCurrentStreamRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamProcessorCompleteOutputBufferPartialSettingsRequest {
pub buffer_lifetime_ordinal: u64,
}
impl fidl::Persistable for StreamProcessorCompleteOutputBufferPartialSettingsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
pub stream_lifetime_ordinal: u64,
}
impl fidl::Persistable for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorOnFreeInputPacketRequest {
pub free_input_packet: PacketHeader,
}
impl fidl::Persistable for StreamProcessorOnFreeInputPacketRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorOnInputConstraintsRequest {
pub input_constraints: StreamBufferConstraints,
}
impl fidl::Persistable for StreamProcessorOnInputConstraintsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorOnOutputConstraintsRequest {
pub output_config: StreamOutputConstraints,
}
impl fidl::Persistable for StreamProcessorOnOutputConstraintsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamProcessorOnOutputEndOfStreamRequest {
pub stream_lifetime_ordinal: u64,
pub error_detected_before: bool,
}
impl fidl::Persistable for StreamProcessorOnOutputEndOfStreamRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorOnOutputFormatRequest {
pub output_format: StreamOutputFormat,
}
impl fidl::Persistable for StreamProcessorOnOutputFormatRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorOnOutputPacketRequest {
pub output_packet: Packet,
pub error_detected_before: bool,
pub error_detected_during: bool,
}
impl fidl::Persistable for StreamProcessorOnOutputPacketRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamProcessorOnStreamFailedRequest {
pub stream_lifetime_ordinal: u64,
pub error: StreamError,
}
impl fidl::Persistable for StreamProcessorOnStreamFailedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamProcessorQueueInputEndOfStreamRequest {
pub stream_lifetime_ordinal: u64,
}
impl fidl::Persistable for StreamProcessorQueueInputEndOfStreamRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorQueueInputFormatDetailsRequest {
pub stream_lifetime_ordinal: u64,
pub format_details: FormatDetails,
}
impl fidl::Persistable for StreamProcessorQueueInputFormatDetailsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorQueueInputPacketRequest {
pub packet: Packet,
}
impl fidl::Persistable for StreamProcessorQueueInputPacketRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StreamProcessorRecycleOutputPacketRequest {
pub available_output_packet: PacketHeader,
}
impl fidl::Persistable for StreamProcessorRecycleOutputPacketRequest {}
#[derive(Debug, PartialEq)]
pub struct StreamProcessorSetInputBufferPartialSettingsRequest {
pub input_settings: StreamBufferPartialSettings,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamProcessorSetInputBufferPartialSettingsRequest
{
}
#[derive(Debug, PartialEq)]
pub struct StreamProcessorSetOutputBufferPartialSettingsRequest {
pub output_settings: StreamBufferPartialSettings,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamProcessorSetOutputBufferPartialSettingsRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamSinkSendPacketNoReplyRequest {
pub packet: StreamPacket,
}
impl fidl::Persistable for StreamSinkSendPacketNoReplyRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamSinkSendPacketRequest {
pub packet: StreamPacket,
}
impl fidl::Persistable for StreamSinkSendPacketRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamSourceOnPacketProducedRequest {
pub packet: StreamPacket,
}
impl fidl::Persistable for StreamSourceOnPacketProducedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct StreamSourceReleasePacketRequest {
pub packet: StreamPacket,
}
impl fidl::Persistable for StreamSourceReleasePacketRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamType {
pub medium_specific: MediumSpecificStreamType,
pub encoding: String,
pub encoding_parameters: Option<Vec<u8>>,
}
impl fidl::Persistable for StreamType {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SubpictureStreamType;
impl fidl::Persistable for SubpictureStreamType {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SubsampleEntry {
pub clear_bytes: u32,
pub encrypted_bytes: u32,
}
impl fidl::Persistable for SubsampleEntry {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TextStreamType;
impl fidl::Persistable for TextStreamType {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct TimelineFunction {
pub subject_time: i64,
pub reference_time: i64,
pub subject_delta: u32,
pub reference_delta: u32,
}
impl fidl::Persistable for TimelineFunction {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsageAudioConsumerFactoryCreateAudioConsumerRequest {
pub usage: AudioRenderUsage,
pub audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for UsageAudioConsumerFactoryCreateAudioConsumerRequest
{
}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct UsageGainListenerOnGainMuteChangedRequest {
pub muted: bool,
pub gain_dbfs: f32,
}
impl fidl::Persistable for UsageGainListenerOnGainMuteChangedRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsageGainReporterRegisterListenerRequest {
pub device_unique_id: String,
pub usage: Usage,
pub usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for UsageGainReporterRegisterListenerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsageReporterWatchRequest {
pub usage: Usage,
pub usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for UsageReporterWatchRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct UsageWatcherOnStateChangedRequest {
pub usage: Usage,
pub state: UsageState,
}
impl fidl::Persistable for UsageWatcherOnStateChangedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VideoStreamType {
pub pixel_format: fidl_fuchsia_images::PixelFormat,
pub color_space: ColorSpace,
pub width: u32,
pub height: u32,
pub coded_width: u32,
pub coded_height: u32,
pub pixel_aspect_ratio_width: u32,
pub pixel_aspect_ratio_height: u32,
pub stride: u32,
}
impl fidl::Persistable for VideoStreamType {}
#[derive(Clone, Debug, PartialEq)]
pub struct VideoUncompressedFormat {
pub image_format: fidl_fuchsia_sysmem::ImageFormat2,
pub fourcc: u32,
pub primary_width_pixels: u32,
pub primary_height_pixels: u32,
pub secondary_width_pixels: u32,
pub secondary_height_pixels: u32,
pub planar: bool,
pub swizzled: bool,
pub primary_line_stride_bytes: u32,
pub secondary_line_stride_bytes: u32,
pub primary_start_offset: u32,
pub secondary_start_offset: u32,
pub tertiary_start_offset: u32,
pub primary_pixel_stride: u32,
pub secondary_pixel_stride: u32,
pub primary_display_width_pixels: u32,
pub primary_display_height_pixels: u32,
pub has_pixel_aspect_ratio: bool,
pub pixel_aspect_ratio_width: u32,
pub pixel_aspect_ratio_height: u32,
}
impl fidl::Persistable for VideoUncompressedFormat {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Void;
impl fidl::Persistable for Void {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioCompressedFormatCvsd {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioCompressedFormatCvsd {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioCompressedFormatLc3 {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioCompressedFormatLc3 {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioConsumerStatus {
pub error: Option<AudioConsumerError>,
pub presentation_timeline: Option<TimelineFunction>,
pub min_lead_time: Option<u64>,
pub max_lead_time: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioConsumerStatus {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CvsdEncoderSettings {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for CvsdEncoderSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DecryptedFormat {
pub ignore_this_field: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DecryptedFormat {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EncryptedFormat {
pub init_vector: Option<Vec<u8>>,
pub subsamples: Option<Vec<SubsampleEntry>>,
pub pattern: Option<EncryptionPattern>,
pub scheme: Option<String>,
pub key_id: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for EncryptedFormat {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FormatDetails {
pub format_details_version_ordinal: Option<u64>,
pub mime_type: Option<String>,
pub oob_bytes: Option<Vec<u8>>,
pub domain: Option<DomainFormat>,
pub pass_through_parameters: Option<Vec<Parameter>>,
pub encoder_settings: Option<EncoderSettings>,
pub timebase: Option<u64>,
pub profile: Option<CodecProfile>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for FormatDetails {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct H264EncoderSettings {
pub bit_rate: Option<u32>,
pub frame_rate: Option<u32>,
pub gop_size: Option<u32>,
pub variable_frame_rate: Option<bool>,
pub min_frame_rate: Option<u32>,
pub force_key_frame: Option<bool>,
pub quantization_params: Option<H264QuantizationParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for H264EncoderSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct H264QuantizationParameters {
pub i_base: Option<u32>,
pub i_min: Option<u32>,
pub i_max: Option<u32>,
pub p_base: Option<u32>,
pub p_min: Option<u32>,
pub p_max: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for H264QuantizationParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HevcEncoderSettings {
pub bit_rate: Option<u32>,
pub frame_rate: Option<u32>,
pub gop_size: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for HevcEncoderSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct InputAudioCapturerConfiguration {
pub usage: Option<AudioCaptureUsage>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for InputAudioCapturerConfiguration {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Lc3EncoderSettings {
pub nbytes: Option<u16>,
pub frame_duration: Option<Lc3FrameDuration>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Lc3EncoderSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LoopbackAudioCapturerConfiguration {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LoopbackAudioCapturerConfiguration {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MSbcEncoderSettings {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for MSbcEncoderSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Packet {
pub header: Option<PacketHeader>,
pub buffer_index: Option<u32>,
pub stream_lifetime_ordinal: Option<u64>,
pub start_offset: Option<u32>,
pub valid_length_bytes: Option<u32>,
pub timestamp_ish: Option<u64>,
pub start_access_unit: Option<bool>,
pub known_end_access_unit: Option<bool>,
pub key_frame: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Packet {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PacketHeader {
pub buffer_lifetime_ordinal: Option<u64>,
pub packet_index: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PacketHeader {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamBufferConstraints {
pub buffer_constraints_version_ordinal: Option<u64>,
pub default_settings: Option<StreamBufferSettings>,
pub per_packet_buffer_bytes_min: Option<u32>,
pub per_packet_buffer_bytes_recommended: Option<u32>,
pub per_packet_buffer_bytes_max: Option<u32>,
pub packet_count_for_server_min: Option<u32>,
pub packet_count_for_server_recommended: Option<u32>,
pub packet_count_for_server_recommended_max: Option<u32>,
pub packet_count_for_server_max: Option<u32>,
pub packet_count_for_client_min: Option<u32>,
pub packet_count_for_client_max: Option<u32>,
pub single_buffer_mode_allowed: Option<bool>,
pub is_physically_contiguous_required: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StreamBufferConstraints {}
#[derive(Debug, Default, PartialEq)]
pub struct StreamBufferPartialSettings {
pub buffer_lifetime_ordinal: Option<u64>,
pub buffer_constraints_version_ordinal: Option<u64>,
pub single_buffer_mode: Option<bool>,
pub packet_count_for_server: Option<u32>,
pub packet_count_for_client: Option<u32>,
pub sysmem_token:
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
pub sysmem2_token:
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamBufferPartialSettings
{
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamBufferSettings {
pub buffer_lifetime_ordinal: Option<u64>,
pub buffer_constraints_version_ordinal: Option<u64>,
pub packet_count_for_server: Option<u32>,
pub packet_count_for_client: Option<u32>,
pub per_packet_buffer_bytes: Option<u32>,
pub single_buffer_mode: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StreamBufferSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamOutputConstraints {
pub stream_lifetime_ordinal: Option<u64>,
pub buffer_constraints_action_required: Option<bool>,
pub buffer_constraints: Option<StreamBufferConstraints>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StreamOutputConstraints {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamOutputFormat {
pub stream_lifetime_ordinal: Option<u64>,
pub format_details: Option<FormatDetails>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StreamOutputFormat {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UsageStateDucked {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for UsageStateDucked {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UsageStateMuted {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for UsageStateMuted {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UsageStateUnadjusted {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for UsageStateUnadjusted {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum AacBitRate {
Constant(AacConstantBitRate),
Variable(AacVariableBitRate),
}
impl AacBitRate {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Constant(_) => 1,
Self::Variable(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for AacBitRate {}
#[derive(Clone, Debug)]
pub enum AacTransport {
Raw(AacTransportRaw),
Latm(AacTransportLatm),
Adts(AacTransportAdts),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AacTransportUnknown {
() => {
_
};
}
impl PartialEq for AacTransport {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Raw(x), Self::Raw(y)) => *x == *y,
(Self::Latm(x), Self::Latm(y)) => *x == *y,
(Self::Adts(x), Self::Adts(y)) => *x == *y,
_ => false,
}
}
}
impl AacTransport {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Raw(_) => 1,
Self::Latm(_) => 2,
Self::Adts(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for AacTransport {}
#[derive(Clone, Debug, PartialEq)]
pub enum AudioCapturerConfiguration {
Loopback(LoopbackAudioCapturerConfiguration),
Input(InputAudioCapturerConfiguration),
}
impl AudioCapturerConfiguration {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Loopback(_) => 1,
Self::Input(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for AudioCapturerConfiguration {}
#[derive(Clone, Debug)]
pub enum AudioCompressedFormat {
Aac(AudioCompressedFormatAac),
Sbc(AudioCompressedFormatSbc),
Cvsd(AudioCompressedFormatCvsd),
Lc3(AudioCompressedFormatLc3),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AudioCompressedFormatUnknown {
() => {
_
};
}
impl PartialEq for AudioCompressedFormat {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Aac(x), Self::Aac(y)) => *x == *y,
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Cvsd(x), Self::Cvsd(y)) => *x == *y,
(Self::Lc3(x), Self::Lc3(y)) => *x == *y,
_ => false,
}
}
}
impl AudioCompressedFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Aac(_) => 1,
Self::Sbc(_) => 2,
Self::Cvsd(_) => 3,
Self::Lc3(_) => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for AudioCompressedFormat {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum AudioConsumerError {
PlaceHolder(Void),
}
impl AudioConsumerError {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::PlaceHolder(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for AudioConsumerError {}
#[derive(Clone, Debug, PartialEq)]
pub enum AudioFormat {
Compressed(AudioCompressedFormat),
Uncompressed(AudioUncompressedFormat),
}
impl AudioFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Compressed(_) => 1,
Self::Uncompressed(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for AudioFormat {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum AudioUncompressedFormat {
Pcm(PcmFormat),
}
impl AudioUncompressedFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Pcm(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for AudioUncompressedFormat {}
#[derive(Clone, Debug)]
pub enum CryptoFormat {
Encrypted(EncryptedFormat),
Decrypted(DecryptedFormat),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! CryptoFormatUnknown {
() => {
_
};
}
impl PartialEq for CryptoFormat {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Encrypted(x), Self::Encrypted(y)) => *x == *y,
(Self::Decrypted(x), Self::Decrypted(y)) => *x == *y,
_ => false,
}
}
}
impl CryptoFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Encrypted(_) => 1,
Self::Decrypted(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for CryptoFormat {}
#[derive(Clone, Debug, PartialEq)]
pub enum DomainFormat {
Audio(AudioFormat),
Video(VideoFormat),
Crypto(CryptoFormat),
}
impl DomainFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Audio(_) => 1,
Self::Video(_) => 2,
Self::Crypto(_) => 3,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for DomainFormat {}
#[derive(Clone, Debug)]
pub enum EncoderSettings {
Sbc(SbcEncoderSettings),
Aac(AacEncoderSettings),
H264(H264EncoderSettings),
Hevc(HevcEncoderSettings),
Cvsd(CvsdEncoderSettings),
Lc3(Lc3EncoderSettings),
Msbc(MSbcEncoderSettings),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! EncoderSettingsUnknown {
() => {
_
};
}
impl PartialEq for EncoderSettings {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Aac(x), Self::Aac(y)) => *x == *y,
(Self::H264(x), Self::H264(y)) => *x == *y,
(Self::Hevc(x), Self::Hevc(y)) => *x == *y,
(Self::Cvsd(x), Self::Cvsd(y)) => *x == *y,
(Self::Lc3(x), Self::Lc3(y)) => *x == *y,
(Self::Msbc(x), Self::Msbc(y)) => *x == *y,
_ => false,
}
}
}
impl EncoderSettings {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Sbc(_) => 1,
Self::Aac(_) => 2,
Self::H264(_) => 3,
Self::Hevc(_) => 4,
Self::Cvsd(_) => 5,
Self::Lc3(_) => 6,
Self::Msbc(_) => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for EncoderSettings {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum MediumSpecificStreamType {
Audio(AudioStreamType),
Video(VideoStreamType),
Text(TextStreamType),
Subpicture(SubpictureStreamType),
}
impl MediumSpecificStreamType {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Audio(_) => 1,
Self::Video(_) => 2,
Self::Text(_) => 3,
Self::Subpicture(_) => 4,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for MediumSpecificStreamType {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Usage {
RenderUsage(AudioRenderUsage),
CaptureUsage(AudioCaptureUsage),
}
impl Usage {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::RenderUsage(_) => 1,
Self::CaptureUsage(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Usage {}
#[derive(Clone, Debug)]
pub enum UsageState {
Unadjusted(UsageStateUnadjusted),
Ducked(UsageStateDucked),
Muted(UsageStateMuted),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! UsageStateUnknown {
() => {
_
};
}
impl PartialEq for UsageState {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Unadjusted(x), Self::Unadjusted(y)) => *x == *y,
(Self::Ducked(x), Self::Ducked(y)) => *x == *y,
(Self::Muted(x), Self::Muted(y)) => *x == *y,
_ => false,
}
}
}
impl UsageState {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Unadjusted(_) => 1,
Self::Ducked(_) => 2,
Self::Muted(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for UsageState {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Value {
BoolValue(bool),
Uint64Value(u64),
Int64Value(i64),
StringValue(String),
BytesValue(Vec<u8>),
}
impl Value {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::BoolValue(_) => 1,
Self::Uint64Value(_) => 2,
Self::Int64Value(_) => 3,
Self::StringValue(_) => 4,
Self::BytesValue(_) => 5,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Value {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum VideoCompressedFormat {
TempFieldTodoRemove(u32),
}
impl VideoCompressedFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::TempFieldTodoRemove(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for VideoCompressedFormat {}
#[derive(Clone, Debug, PartialEq)]
pub enum VideoFormat {
Compressed(VideoCompressedFormat),
Uncompressed(VideoUncompressedFormat),
}
impl VideoFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Compressed(_) => 1,
Self::Uncompressed(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for VideoFormat {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ActivityReporterMarker;
impl fidl::endpoints::ProtocolMarker for ActivityReporterMarker {
type Proxy = ActivityReporterProxy;
type RequestStream = ActivityReporterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ActivityReporterSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.ActivityReporter";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ActivityReporterMarker {}
pub trait ActivityReporterProxyInterface: Send + Sync {
type WatchRenderActivityResponseFut: std::future::Future<Output = Result<Vec<AudioRenderUsage>, fidl::Error>>
+ Send;
fn r#watch_render_activity(&self) -> Self::WatchRenderActivityResponseFut;
type WatchCaptureActivityResponseFut: std::future::Future<Output = Result<Vec<AudioCaptureUsage>, fidl::Error>>
+ Send;
fn r#watch_capture_activity(&self) -> Self::WatchCaptureActivityResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ActivityReporterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ActivityReporterSynchronousProxy {
type Proxy = ActivityReporterProxy;
type Protocol = ActivityReporterMarker;
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 ActivityReporterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ActivityReporterMarker 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<ActivityReporterEvent, fidl::Error> {
ActivityReporterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_render_activity(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<AudioRenderUsage>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
ActivityReporterWatchRenderActivityResponse,
>(
(),
0x2974e9f5880b2f1f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.active_usages)
}
pub fn r#watch_capture_activity(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<AudioCaptureUsage>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
ActivityReporterWatchCaptureActivityResponse,
>(
(),
0x70e7038e9658e128,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.active_usages)
}
}
#[derive(Debug, Clone)]
pub struct ActivityReporterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ActivityReporterProxy {
type Protocol = ActivityReporterMarker;
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 ActivityReporterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ActivityReporterEventStream {
ActivityReporterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_render_activity(
&self,
) -> fidl::client::QueryResponseFut<
Vec<AudioRenderUsage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ActivityReporterProxyInterface::r#watch_render_activity(self)
}
pub fn r#watch_capture_activity(
&self,
) -> fidl::client::QueryResponseFut<
Vec<AudioCaptureUsage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ActivityReporterProxyInterface::r#watch_capture_activity(self)
}
}
impl ActivityReporterProxyInterface for ActivityReporterProxy {
type WatchRenderActivityResponseFut = fidl::client::QueryResponseFut<
Vec<AudioRenderUsage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_render_activity(&self) -> Self::WatchRenderActivityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<AudioRenderUsage>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ActivityReporterWatchRenderActivityResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2974e9f5880b2f1f,
>(_buf?)?;
Ok(_response.active_usages)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioRenderUsage>>(
(),
0x2974e9f5880b2f1f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchCaptureActivityResponseFut = fidl::client::QueryResponseFut<
Vec<AudioCaptureUsage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_capture_activity(&self) -> Self::WatchCaptureActivityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<AudioCaptureUsage>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ActivityReporterWatchCaptureActivityResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x70e7038e9658e128,
>(_buf?)?;
Ok(_response.active_usages)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioCaptureUsage>>(
(),
0x70e7038e9658e128,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ActivityReporterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ActivityReporterEventStream {}
impl futures::stream::FusedStream for ActivityReporterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ActivityReporterEventStream {
type Item = Result<ActivityReporterEvent, 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(ActivityReporterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ActivityReporterEvent {}
impl ActivityReporterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ActivityReporterEvent, 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:
<ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ActivityReporterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ActivityReporterRequestStream {}
impl futures::stream::FusedStream for ActivityReporterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ActivityReporterRequestStream {
type Protocol = ActivityReporterMarker;
type ControlHandle = ActivityReporterControlHandle;
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 {
ActivityReporterControlHandle { 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 ActivityReporterRequestStream {
type Item = Result<ActivityReporterRequest, 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 ActivityReporterRequestStream 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 {
0x2974e9f5880b2f1f => {
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 =
ActivityReporterControlHandle { inner: this.inner.clone() };
Ok(ActivityReporterRequest::WatchRenderActivity {
responder: ActivityReporterWatchRenderActivityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x70e7038e9658e128 => {
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 =
ActivityReporterControlHandle { inner: this.inner.clone() };
Ok(ActivityReporterRequest::WatchCaptureActivity {
responder: ActivityReporterWatchCaptureActivityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ActivityReporterRequest {
WatchRenderActivity { responder: ActivityReporterWatchRenderActivityResponder },
WatchCaptureActivity { responder: ActivityReporterWatchCaptureActivityResponder },
}
impl ActivityReporterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_render_activity(
self,
) -> Option<(ActivityReporterWatchRenderActivityResponder)> {
if let ActivityReporterRequest::WatchRenderActivity { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_capture_activity(
self,
) -> Option<(ActivityReporterWatchCaptureActivityResponder)> {
if let ActivityReporterRequest::WatchCaptureActivity { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ActivityReporterRequest::WatchRenderActivity { .. } => "watch_render_activity",
ActivityReporterRequest::WatchCaptureActivity { .. } => "watch_capture_activity",
}
}
}
#[derive(Debug, Clone)]
pub struct ActivityReporterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ActivityReporterControlHandle {
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 ActivityReporterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ActivityReporterWatchRenderActivityResponder {
control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ActivityReporterWatchRenderActivityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ActivityReporterWatchRenderActivityResponder {
type ControlHandle = ActivityReporterControlHandle;
fn control_handle(&self) -> &ActivityReporterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ActivityReporterWatchRenderActivityResponder {
pub fn send(self, mut active_usages: &[AudioRenderUsage]) -> Result<(), fidl::Error> {
let _result = self.send_raw(active_usages);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut active_usages: &[AudioRenderUsage],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(active_usages);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut active_usages: &[AudioRenderUsage]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ActivityReporterWatchRenderActivityResponse>(
(active_usages,),
self.tx_id,
0x2974e9f5880b2f1f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ActivityReporterWatchCaptureActivityResponder {
control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ActivityReporterWatchCaptureActivityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ActivityReporterWatchCaptureActivityResponder {
type ControlHandle = ActivityReporterControlHandle;
fn control_handle(&self) -> &ActivityReporterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ActivityReporterWatchCaptureActivityResponder {
pub fn send(self, mut active_usages: &[AudioCaptureUsage]) -> Result<(), fidl::Error> {
let _result = self.send_raw(active_usages);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut active_usages: &[AudioCaptureUsage],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(active_usages);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut active_usages: &[AudioCaptureUsage]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ActivityReporterWatchCaptureActivityResponse>(
(active_usages,),
self.tx_id,
0x70e7038e9658e128,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioMarker;
impl fidl::endpoints::ProtocolMarker for AudioMarker {
type Proxy = AudioProxy;
type RequestStream = AudioRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.Audio";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AudioMarker {}
pub trait AudioProxyInterface: Send + Sync {
fn r#create_audio_renderer(
&self,
audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error>;
fn r#create_audio_capturer(
&self,
audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
loopback: bool,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioSynchronousProxy {
type Proxy = AudioProxy;
type Protocol = AudioMarker;
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 AudioSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioMarker 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<AudioEvent, fidl::Error> {
AudioEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_audio_renderer(
&self,
mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCreateAudioRendererRequest>(
(audio_renderer_request,),
0x572f413566fd58f1,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_audio_capturer(
&self,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
mut loopback: bool,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCreateAudioCapturerRequest>(
(audio_capturer_request, loopback),
0x44660fc63a6202f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct AudioProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioProxy {
type Protocol = AudioMarker;
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 AudioProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioEventStream {
AudioEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_audio_renderer(
&self,
mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
AudioProxyInterface::r#create_audio_renderer(self, audio_renderer_request)
}
pub fn r#create_audio_capturer(
&self,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
mut loopback: bool,
) -> Result<(), fidl::Error> {
AudioProxyInterface::r#create_audio_capturer(self, audio_capturer_request, loopback)
}
}
impl AudioProxyInterface for AudioProxy {
fn r#create_audio_renderer(
&self,
mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCreateAudioRendererRequest>(
(audio_renderer_request,),
0x572f413566fd58f1,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_audio_capturer(
&self,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
mut loopback: bool,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCreateAudioCapturerRequest>(
(audio_capturer_request, loopback),
0x44660fc63a6202f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct AudioEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioEventStream {}
impl futures::stream::FusedStream for AudioEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioEventStream {
type Item = Result<AudioEvent, 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(AudioEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioEvent {}
impl AudioEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioEvent, 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: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioRequestStream {}
impl futures::stream::FusedStream for AudioRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioRequestStream {
type Protocol = AudioMarker;
type ControlHandle = AudioControlHandle;
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 {
AudioControlHandle { 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 AudioRequestStream {
type Item = Result<AudioRequest, 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 AudioRequestStream 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 {
0x572f413566fd58f1 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCreateAudioRendererRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCreateAudioRendererRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioControlHandle { inner: this.inner.clone() };
Ok(AudioRequest::CreateAudioRenderer {
audio_renderer_request: req.audio_renderer_request,
control_handle,
})
}
0x44660fc63a6202f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCreateAudioCapturerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCreateAudioCapturerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioControlHandle { inner: this.inner.clone() };
Ok(AudioRequest::CreateAudioCapturer {
audio_capturer_request: req.audio_capturer_request,
loopback: req.loopback,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioRequest {
CreateAudioRenderer {
audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
control_handle: AudioControlHandle,
},
CreateAudioCapturer {
audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
loopback: bool,
control_handle: AudioControlHandle,
},
}
impl AudioRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_renderer(
self,
) -> Option<(fidl::endpoints::ServerEnd<AudioRendererMarker>, AudioControlHandle)> {
if let AudioRequest::CreateAudioRenderer { audio_renderer_request, control_handle } = self {
Some((audio_renderer_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_capturer(
self,
) -> Option<(fidl::endpoints::ServerEnd<AudioCapturerMarker>, bool, AudioControlHandle)> {
if let AudioRequest::CreateAudioCapturer {
audio_capturer_request,
loopback,
control_handle,
} = self
{
Some((audio_capturer_request, loopback, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioRequest::CreateAudioRenderer { .. } => "create_audio_renderer",
AudioRequest::CreateAudioCapturer { .. } => "create_audio_capturer",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioControlHandle {
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 AudioControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioCapturerMarker;
impl fidl::endpoints::ProtocolMarker for AudioCapturerMarker {
type Proxy = AudioCapturerProxy;
type RequestStream = AudioCapturerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioCapturerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioCapturer";
}
pub trait AudioCapturerProxyInterface: Send + Sync {
fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
fn r#release_packet(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
fn r#set_pcm_stream_type(&self, stream_type: &AudioStreamType) -> Result<(), fidl::Error>;
type CaptureAtResponseFut: std::future::Future<Output = Result<StreamPacket, fidl::Error>>
+ Send;
fn r#capture_at(
&self,
payload_buffer_id: u32,
payload_offset: u32,
frames: u32,
) -> Self::CaptureAtResponseFut;
fn r#start_async_capture(&self, frames_per_packet: u32) -> Result<(), fidl::Error>;
type StopAsyncCaptureResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#stop_async_capture(&self) -> Self::StopAsyncCaptureResponseFut;
fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error>;
fn r#bind_gain_control(
&self,
gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error>;
type GetReferenceClockResponseFut: std::future::Future<Output = Result<fidl::Clock, fidl::Error>>
+ Send;
fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut;
fn r#set_reference_clock(
&self,
reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error>;
fn r#set_usage(&self, usage: AudioCaptureUsage) -> Result<(), fidl::Error>;
type GetStreamTypeResponseFut: std::future::Future<Output = Result<StreamType, fidl::Error>>
+ Send;
fn r#get_stream_type(&self) -> Self::GetStreamTypeResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioCapturerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioCapturerSynchronousProxy {
type Proxy = AudioCapturerProxy;
type Protocol = AudioCapturerMarker;
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 AudioCapturerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioCapturerMarker 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<AudioCapturerEvent, fidl::Error> {
AudioCapturerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSourceReleasePacketRequest>(
(packet,),
0x7a7b57f0f7d9e4bb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#discard_all_packets(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35f9d721e905b831,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_pcm_stream_type(
&self,
mut stream_type: &AudioStreamType,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetPcmStreamTypeRequest>(
(stream_type,),
0x1531ea9ea2c852cd,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#capture_at(
&self,
mut payload_buffer_id: u32,
mut payload_offset: u32,
mut frames: u32,
___deadline: zx::MonotonicInstant,
) -> Result<StreamPacket, fidl::Error> {
let _response = self
.client
.send_query::<AudioCapturerCaptureAtRequest, AudioCapturerCaptureAtResponse>(
(payload_buffer_id, payload_offset, frames),
0x784e25df72cea780,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.captured_packet)
}
pub fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerStartAsyncCaptureRequest>(
(frames_per_packet,),
0x7768adbb1ccfd7a6,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop_async_capture(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x5bfc8790a8cef8cb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x33223cb2962c95e3,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerBindGainControlRequest>(
(gain_control_request,),
0x658a6a17ddb3a8e0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_reference_clock(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::Clock, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioCapturerGetReferenceClockResponse>(
(),
0x50d037aa5a4b4d71,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.reference_clock)
}
pub fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetReferenceClockRequest>(
(reference_clock,),
0x732b2c496d521bcf,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetUsageRequest>(
(usage,),
0x42a16f392bd21b25,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_stream_type(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<StreamType, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioCapturerGetStreamTypeResponse>(
(),
0x5dcaaa670b433088,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.stream_type)
}
}
#[derive(Debug, Clone)]
pub struct AudioCapturerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioCapturerProxy {
type Protocol = AudioCapturerMarker;
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 AudioCapturerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioCapturerEventStream {
AudioCapturerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#remove_payload_buffer(self, id)
}
pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#release_packet(self, packet)
}
pub fn r#discard_all_packets(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioCapturerProxyInterface::r#discard_all_packets(self)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#discard_all_packets_no_reply(self)
}
pub fn r#set_pcm_stream_type(
&self,
mut stream_type: &AudioStreamType,
) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#set_pcm_stream_type(self, stream_type)
}
pub fn r#capture_at(
&self,
mut payload_buffer_id: u32,
mut payload_offset: u32,
mut frames: u32,
) -> fidl::client::QueryResponseFut<StreamPacket, fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioCapturerProxyInterface::r#capture_at(self, payload_buffer_id, payload_offset, frames)
}
pub fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#start_async_capture(self, frames_per_packet)
}
pub fn r#stop_async_capture(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioCapturerProxyInterface::r#stop_async_capture(self)
}
pub fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#stop_async_capture_no_reply(self)
}
pub fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#bind_gain_control(self, gain_control_request)
}
pub fn r#get_reference_clock(
&self,
) -> fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioCapturerProxyInterface::r#get_reference_clock(self)
}
pub fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#set_reference_clock(self, reference_clock)
}
pub fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
AudioCapturerProxyInterface::r#set_usage(self, usage)
}
pub fn r#get_stream_type(
&self,
) -> fidl::client::QueryResponseFut<StreamType, fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioCapturerProxyInterface::r#get_stream_type(self)
}
}
impl AudioCapturerProxyInterface for AudioCapturerProxy {
fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSourceReleasePacketRequest>(
(packet,),
0x7a7b57f0f7d9e4bb,
fidl::encoding::DynamicFlags::empty(),
)
}
type DiscardAllPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
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,
0x27afd605e97b09d2,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35f9d721e905b831,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_pcm_stream_type(&self, mut stream_type: &AudioStreamType) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetPcmStreamTypeRequest>(
(stream_type,),
0x1531ea9ea2c852cd,
fidl::encoding::DynamicFlags::empty(),
)
}
type CaptureAtResponseFut =
fidl::client::QueryResponseFut<StreamPacket, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#capture_at(
&self,
mut payload_buffer_id: u32,
mut payload_offset: u32,
mut frames: u32,
) -> Self::CaptureAtResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StreamPacket, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioCapturerCaptureAtResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x784e25df72cea780,
>(_buf?)?;
Ok(_response.captured_packet)
}
self.client.send_query_and_decode::<AudioCapturerCaptureAtRequest, StreamPacket>(
(payload_buffer_id, payload_offset, frames),
0x784e25df72cea780,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerStartAsyncCaptureRequest>(
(frames_per_packet,),
0x7768adbb1ccfd7a6,
fidl::encoding::DynamicFlags::empty(),
)
}
type StopAsyncCaptureResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#stop_async_capture(&self) -> Self::StopAsyncCaptureResponseFut {
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,
0x5bfc8790a8cef8cb,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x5bfc8790a8cef8cb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x33223cb2962c95e3,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerBindGainControlRequest>(
(gain_control_request,),
0x658a6a17ddb3a8e0,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetReferenceClockResponseFut =
fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Clock, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioCapturerGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x50d037aa5a4b4d71,
>(_buf?)?;
Ok(_response.reference_clock)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Clock>(
(),
0x50d037aa5a4b4d71,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetReferenceClockRequest>(
(reference_clock,),
0x732b2c496d521bcf,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
self.client.send::<AudioCapturerSetUsageRequest>(
(usage,),
0x42a16f392bd21b25,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetStreamTypeResponseFut =
fidl::client::QueryResponseFut<StreamType, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_stream_type(&self) -> Self::GetStreamTypeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StreamType, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioCapturerGetStreamTypeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5dcaaa670b433088,
>(_buf?)?;
Ok(_response.stream_type)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamType>(
(),
0x5dcaaa670b433088,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AudioCapturerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioCapturerEventStream {}
impl futures::stream::FusedStream for AudioCapturerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioCapturerEventStream {
type Item = Result<AudioCapturerEvent, 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(AudioCapturerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioCapturerEvent {
OnPacketProduced { packet: StreamPacket },
OnEndOfStream {},
}
impl AudioCapturerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_packet_produced(self) -> Option<StreamPacket> {
if let AudioCapturerEvent::OnPacketProduced { packet } = self {
Some((packet))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_end_of_stream(self) -> Option<()> {
if let AudioCapturerEvent::OnEndOfStream {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioCapturerEvent, 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 {
0x6bbe69746a3c8bd9 => {
let mut out = fidl::new_empty!(
StreamSourceOnPacketProducedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceOnPacketProducedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioCapturerEvent::OnPacketProduced { packet: out.packet }))
}
0x550e69b41d03e2c2 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioCapturerEvent::OnEndOfStream {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioCapturerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioCapturerRequestStream {}
impl futures::stream::FusedStream for AudioCapturerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioCapturerRequestStream {
type Protocol = AudioCapturerMarker;
type ControlHandle = AudioCapturerControlHandle;
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 {
AudioCapturerControlHandle { 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 AudioCapturerRequestStream {
type Item = Result<AudioCapturerRequest, 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 AudioCapturerRequestStream 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 {
0x3b3a37fc34fe5b56 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::AddPayloadBuffer {
id: req.id,
payload_buffer: req.payload_buffer,
control_handle,
})
}
0x5d1e4f74c3658262 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetRemovePayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::RemovePayloadBuffer { id: req.id, control_handle })
}
0x7a7b57f0f7d9e4bb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamSourceReleasePacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceReleasePacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::ReleasePacket {
packet: req.packet,
control_handle,
})
}
0x27afd605e97b09d2 => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::DiscardAllPackets {
responder: AudioCapturerDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35f9d721e905b831 => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::DiscardAllPacketsNoReply { control_handle })
}
0x1531ea9ea2c852cd => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCapturerSetPcmStreamTypeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetPcmStreamTypeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::SetPcmStreamType {
stream_type: req.stream_type,
control_handle,
})
}
0x784e25df72cea780 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioCapturerCaptureAtRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerCaptureAtRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::CaptureAt {
payload_buffer_id: req.payload_buffer_id,
payload_offset: req.payload_offset,
frames: req.frames,
responder: AudioCapturerCaptureAtResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7768adbb1ccfd7a6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCapturerStartAsyncCaptureRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerStartAsyncCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::StartAsyncCapture {
frames_per_packet: req.frames_per_packet,
control_handle,
})
}
0x5bfc8790a8cef8cb => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::StopAsyncCapture {
responder: AudioCapturerStopAsyncCaptureResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x33223cb2962c95e3 => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::StopAsyncCaptureNoReply { control_handle })
}
0x658a6a17ddb3a8e0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCapturerBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerBindGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::BindGainControl {
gain_control_request: req.gain_control_request,
control_handle,
})
}
0x50d037aa5a4b4d71 => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::GetReferenceClock {
responder: AudioCapturerGetReferenceClockResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x732b2c496d521bcf => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCapturerSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetReferenceClockRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::SetReferenceClock {
reference_clock: req.reference_clock,
control_handle,
})
}
0x42a16f392bd21b25 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCapturerSetUsageRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetUsageRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::SetUsage { usage: req.usage, control_handle })
}
0x5dcaaa670b433088 => {
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 =
AudioCapturerControlHandle { inner: this.inner.clone() };
Ok(AudioCapturerRequest::GetStreamType {
responder: AudioCapturerGetStreamTypeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioCapturerRequest {
AddPayloadBuffer {
id: u32,
payload_buffer: fidl::Vmo,
control_handle: AudioCapturerControlHandle,
},
RemovePayloadBuffer {
id: u32,
control_handle: AudioCapturerControlHandle,
},
ReleasePacket {
packet: StreamPacket,
control_handle: AudioCapturerControlHandle,
},
DiscardAllPackets {
responder: AudioCapturerDiscardAllPacketsResponder,
},
DiscardAllPacketsNoReply {
control_handle: AudioCapturerControlHandle,
},
SetPcmStreamType {
stream_type: AudioStreamType,
control_handle: AudioCapturerControlHandle,
},
CaptureAt {
payload_buffer_id: u32,
payload_offset: u32,
frames: u32,
responder: AudioCapturerCaptureAtResponder,
},
StartAsyncCapture {
frames_per_packet: u32,
control_handle: AudioCapturerControlHandle,
},
StopAsyncCapture {
responder: AudioCapturerStopAsyncCaptureResponder,
},
StopAsyncCaptureNoReply {
control_handle: AudioCapturerControlHandle,
},
BindGainControl {
gain_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
control_handle: AudioCapturerControlHandle,
},
GetReferenceClock {
responder: AudioCapturerGetReferenceClockResponder,
},
SetReferenceClock {
reference_clock: Option<fidl::Clock>,
control_handle: AudioCapturerControlHandle,
},
SetUsage {
usage: AudioCaptureUsage,
control_handle: AudioCapturerControlHandle,
},
GetStreamType {
responder: AudioCapturerGetStreamTypeResponder,
},
}
impl AudioCapturerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::AddPayloadBuffer { id, payload_buffer, control_handle } = self
{
Some((id, payload_buffer, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_payload_buffer(self) -> Option<(u32, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::RemovePayloadBuffer { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_release_packet(self) -> Option<(StreamPacket, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::ReleasePacket { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets(self) -> Option<(AudioCapturerDiscardAllPacketsResponder)> {
if let AudioCapturerRequest::DiscardAllPackets { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets_no_reply(self) -> Option<(AudioCapturerControlHandle)> {
if let AudioCapturerRequest::DiscardAllPacketsNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_pcm_stream_type(self) -> Option<(AudioStreamType, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::SetPcmStreamType { stream_type, control_handle } = self {
Some((stream_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_capture_at(self) -> Option<(u32, u32, u32, AudioCapturerCaptureAtResponder)> {
if let AudioCapturerRequest::CaptureAt {
payload_buffer_id,
payload_offset,
frames,
responder,
} = self
{
Some((payload_buffer_id, payload_offset, frames, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_async_capture(self) -> Option<(u32, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::StartAsyncCapture { frames_per_packet, control_handle } = self
{
Some((frames_per_packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_async_capture(self) -> Option<(AudioCapturerStopAsyncCaptureResponder)> {
if let AudioCapturerRequest::StopAsyncCapture { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_async_capture_no_reply(self) -> Option<(AudioCapturerControlHandle)> {
if let AudioCapturerRequest::StopAsyncCaptureNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_gain_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
AudioCapturerControlHandle,
)> {
if let AudioCapturerRequest::BindGainControl { gain_control_request, control_handle } = self
{
Some((gain_control_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_reference_clock(self) -> Option<(AudioCapturerGetReferenceClockResponder)> {
if let AudioCapturerRequest::GetReferenceClock { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_reference_clock(
self,
) -> Option<(Option<fidl::Clock>, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::SetReferenceClock { reference_clock, control_handle } = self {
Some((reference_clock, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_usage(self) -> Option<(AudioCaptureUsage, AudioCapturerControlHandle)> {
if let AudioCapturerRequest::SetUsage { usage, control_handle } = self {
Some((usage, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_stream_type(self) -> Option<(AudioCapturerGetStreamTypeResponder)> {
if let AudioCapturerRequest::GetStreamType { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioCapturerRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
AudioCapturerRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
AudioCapturerRequest::ReleasePacket { .. } => "release_packet",
AudioCapturerRequest::DiscardAllPackets { .. } => "discard_all_packets",
AudioCapturerRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
AudioCapturerRequest::SetPcmStreamType { .. } => "set_pcm_stream_type",
AudioCapturerRequest::CaptureAt { .. } => "capture_at",
AudioCapturerRequest::StartAsyncCapture { .. } => "start_async_capture",
AudioCapturerRequest::StopAsyncCapture { .. } => "stop_async_capture",
AudioCapturerRequest::StopAsyncCaptureNoReply { .. } => "stop_async_capture_no_reply",
AudioCapturerRequest::BindGainControl { .. } => "bind_gain_control",
AudioCapturerRequest::GetReferenceClock { .. } => "get_reference_clock",
AudioCapturerRequest::SetReferenceClock { .. } => "set_reference_clock",
AudioCapturerRequest::SetUsage { .. } => "set_usage",
AudioCapturerRequest::GetStreamType { .. } => "get_stream_type",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioCapturerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioCapturerControlHandle {
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 AudioCapturerControlHandle {
pub fn send_on_packet_produced(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.inner.send::<StreamSourceOnPacketProducedRequest>(
(packet,),
0,
0x6bbe69746a3c8bd9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x550e69b41d03e2c2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCapturerDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCapturerDiscardAllPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCapturerDiscardAllPacketsResponder {
type ControlHandle = AudioCapturerControlHandle;
fn control_handle(&self) -> &AudioCapturerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCapturerDiscardAllPacketsResponder {
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,
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCapturerCaptureAtResponder {
control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCapturerCaptureAtResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCapturerCaptureAtResponder {
type ControlHandle = AudioCapturerControlHandle;
fn control_handle(&self) -> &AudioCapturerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCapturerCaptureAtResponder {
pub fn send(self, mut captured_packet: &StreamPacket) -> Result<(), fidl::Error> {
let _result = self.send_raw(captured_packet);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut captured_packet: &StreamPacket,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(captured_packet);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut captured_packet: &StreamPacket) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioCapturerCaptureAtResponse>(
(captured_packet,),
self.tx_id,
0x784e25df72cea780,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCapturerStopAsyncCaptureResponder {
control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCapturerStopAsyncCaptureResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCapturerStopAsyncCaptureResponder {
type ControlHandle = AudioCapturerControlHandle;
fn control_handle(&self) -> &AudioCapturerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCapturerStopAsyncCaptureResponder {
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,
0x5bfc8790a8cef8cb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCapturerGetReferenceClockResponder {
control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCapturerGetReferenceClockResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCapturerGetReferenceClockResponder {
type ControlHandle = AudioCapturerControlHandle;
fn control_handle(&self) -> &AudioCapturerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCapturerGetReferenceClockResponder {
pub fn send(self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_clock);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut reference_clock: fidl::Clock,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_clock);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioCapturerGetReferenceClockResponse>(
(reference_clock,),
self.tx_id,
0x50d037aa5a4b4d71,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCapturerGetStreamTypeResponder {
control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCapturerGetStreamTypeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCapturerGetStreamTypeResponder {
type ControlHandle = AudioCapturerControlHandle;
fn control_handle(&self) -> &AudioCapturerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCapturerGetStreamTypeResponder {
pub fn send(self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
let _result = self.send_raw(stream_type);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
let _result = self.send_raw(stream_type);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioCapturerGetStreamTypeResponse>(
(stream_type,),
self.tx_id,
0x5dcaaa670b433088,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioConsumerMarker;
impl fidl::endpoints::ProtocolMarker for AudioConsumerMarker {
type Proxy = AudioConsumerProxy;
type RequestStream = AudioConsumerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioConsumerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioConsumer";
}
pub trait AudioConsumerProxyInterface: Send + Sync {
fn r#create_stream_sink(
&self,
buffers: Vec<fidl::Vmo>,
stream_type: &AudioStreamType,
compression: Option<&Compression>,
stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
) -> Result<(), fidl::Error>;
fn r#start(
&self,
flags: AudioConsumerStartFlags,
reference_time: i64,
media_time: i64,
) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
fn r#set_rate(&self, rate: f32) -> Result<(), fidl::Error>;
fn r#bind_volume_control(
&self,
volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error>;
type WatchStatusResponseFut: std::future::Future<Output = Result<AudioConsumerStatus, fidl::Error>>
+ Send;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioConsumerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioConsumerSynchronousProxy {
type Proxy = AudioConsumerProxy;
type Protocol = AudioConsumerMarker;
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 AudioConsumerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioConsumerMarker 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<AudioConsumerEvent, fidl::Error> {
AudioConsumerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_stream_sink(
&self,
mut buffers: Vec<fidl::Vmo>,
mut stream_type: &AudioStreamType,
mut compression: Option<&Compression>,
mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerCreateStreamSinkRequest>(
(buffers.as_mut(), stream_type, compression, stream_sink_request),
0x525b3b97fdf7d884,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#start(
&self,
mut flags: AudioConsumerStartFlags,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerStartRequest>(
(flags, reference_time, media_time),
0x4fdbd44b3f2a3a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3d46c3741686c40d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerSetRateRequest>(
(rate,),
0x45342b73968bfafe,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerBindVolumeControlRequest>(
(volume_control_request,),
0x6f1b01fd887f5748,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_status(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AudioConsumerStatus, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioConsumerWatchStatusResponse>(
(),
0x35cf702c721e2cc6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct AudioConsumerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioConsumerProxy {
type Protocol = AudioConsumerMarker;
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 AudioConsumerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioConsumerEventStream {
AudioConsumerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_stream_sink(
&self,
mut buffers: Vec<fidl::Vmo>,
mut stream_type: &AudioStreamType,
mut compression: Option<&Compression>,
mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
) -> Result<(), fidl::Error> {
AudioConsumerProxyInterface::r#create_stream_sink(
self,
buffers,
stream_type,
compression,
stream_sink_request,
)
}
pub fn r#start(
&self,
mut flags: AudioConsumerStartFlags,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
AudioConsumerProxyInterface::r#start(self, flags, reference_time, media_time)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
AudioConsumerProxyInterface::r#stop(self)
}
pub fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
AudioConsumerProxyInterface::r#set_rate(self, rate)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
AudioConsumerProxyInterface::r#bind_volume_control(self, volume_control_request)
}
pub fn r#watch_status(
&self,
) -> fidl::client::QueryResponseFut<
AudioConsumerStatus,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioConsumerProxyInterface::r#watch_status(self)
}
}
impl AudioConsumerProxyInterface for AudioConsumerProxy {
fn r#create_stream_sink(
&self,
mut buffers: Vec<fidl::Vmo>,
mut stream_type: &AudioStreamType,
mut compression: Option<&Compression>,
mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerCreateStreamSinkRequest>(
(buffers.as_mut(), stream_type, compression, stream_sink_request),
0x525b3b97fdf7d884,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#start(
&self,
mut flags: AudioConsumerStartFlags,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerStartRequest>(
(flags, reference_time, media_time),
0x4fdbd44b3f2a3a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3d46c3741686c40d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerSetRateRequest>(
(rate,),
0x45342b73968bfafe,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioConsumerBindVolumeControlRequest>(
(volume_control_request,),
0x6f1b01fd887f5748,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchStatusResponseFut = fidl::client::QueryResponseFut<
AudioConsumerStatus,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AudioConsumerStatus, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioConsumerWatchStatusResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35cf702c721e2cc6,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioConsumerStatus>(
(),
0x35cf702c721e2cc6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AudioConsumerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioConsumerEventStream {}
impl futures::stream::FusedStream for AudioConsumerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioConsumerEventStream {
type Item = Result<AudioConsumerEvent, 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(AudioConsumerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioConsumerEvent {
OnEndOfStream {},
}
impl AudioConsumerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_end_of_stream(self) -> Option<()> {
if let AudioConsumerEvent::OnEndOfStream {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioConsumerEvent, 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 {
0x53a64e6d0e8f8a20 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioConsumerEvent::OnEndOfStream {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioConsumerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioConsumerRequestStream {}
impl futures::stream::FusedStream for AudioConsumerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioConsumerRequestStream {
type Protocol = AudioConsumerMarker;
type ControlHandle = AudioConsumerControlHandle;
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 {
AudioConsumerControlHandle { 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 AudioConsumerRequestStream {
type Item = Result<AudioConsumerRequest, 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 AudioConsumerRequestStream 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 {
0x525b3b97fdf7d884 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioConsumerCreateStreamSinkRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerCreateStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::CreateStreamSink {
buffers: req.buffers,
stream_type: req.stream_type,
compression: req.compression,
stream_sink_request: req.stream_sink_request,
control_handle,
})
}
0x4fdbd44b3f2a3a3c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioConsumerStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::Start {
flags: req.flags,
reference_time: req.reference_time,
media_time: req.media_time,
control_handle,
})
}
0x3d46c3741686c40d => {
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 =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::Stop { control_handle })
}
0x45342b73968bfafe => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioConsumerSetRateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerSetRateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::SetRate { rate: req.rate, control_handle })
}
0x6f1b01fd887f5748 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioConsumerBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::BindVolumeControl {
volume_control_request: req.volume_control_request,
control_handle,
})
}
0x35cf702c721e2cc6 => {
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 =
AudioConsumerControlHandle { inner: this.inner.clone() };
Ok(AudioConsumerRequest::WatchStatus {
responder: AudioConsumerWatchStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioConsumerRequest {
CreateStreamSink {
buffers: Vec<fidl::Vmo>,
stream_type: AudioStreamType,
compression: Option<Box<Compression>>,
stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
control_handle: AudioConsumerControlHandle,
},
Start {
flags: AudioConsumerStartFlags,
reference_time: i64,
media_time: i64,
control_handle: AudioConsumerControlHandle,
},
Stop { control_handle: AudioConsumerControlHandle },
SetRate { rate: f32, control_handle: AudioConsumerControlHandle },
BindVolumeControl {
volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
control_handle: AudioConsumerControlHandle,
},
WatchStatus { responder: AudioConsumerWatchStatusResponder },
}
impl AudioConsumerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_stream_sink(
self,
) -> Option<(
Vec<fidl::Vmo>,
AudioStreamType,
Option<Box<Compression>>,
fidl::endpoints::ServerEnd<StreamSinkMarker>,
AudioConsumerControlHandle,
)> {
if let AudioConsumerRequest::CreateStreamSink {
buffers,
stream_type,
compression,
stream_sink_request,
control_handle,
} = self
{
Some((buffers, stream_type, compression, stream_sink_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(AudioConsumerStartFlags, i64, i64, AudioConsumerControlHandle)> {
if let AudioConsumerRequest::Start { flags, reference_time, media_time, control_handle } =
self
{
Some((flags, reference_time, media_time, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(AudioConsumerControlHandle)> {
if let AudioConsumerRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_rate(self) -> Option<(f32, AudioConsumerControlHandle)> {
if let AudioConsumerRequest::SetRate { rate, control_handle } = self {
Some((rate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_volume_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
AudioConsumerControlHandle,
)> {
if let AudioConsumerRequest::BindVolumeControl { volume_control_request, control_handle } =
self
{
Some((volume_control_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_status(self) -> Option<(AudioConsumerWatchStatusResponder)> {
if let AudioConsumerRequest::WatchStatus { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioConsumerRequest::CreateStreamSink { .. } => "create_stream_sink",
AudioConsumerRequest::Start { .. } => "start",
AudioConsumerRequest::Stop { .. } => "stop",
AudioConsumerRequest::SetRate { .. } => "set_rate",
AudioConsumerRequest::BindVolumeControl { .. } => "bind_volume_control",
AudioConsumerRequest::WatchStatus { .. } => "watch_status",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioConsumerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioConsumerControlHandle {
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 AudioConsumerControlHandle {
pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x53a64e6d0e8f8a20,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioConsumerWatchStatusResponder {
control_handle: std::mem::ManuallyDrop<AudioConsumerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioConsumerWatchStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioConsumerWatchStatusResponder {
type ControlHandle = AudioConsumerControlHandle;
fn control_handle(&self) -> &AudioConsumerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioConsumerWatchStatusResponder {
pub fn send(self, mut status: &AudioConsumerStatus) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: &AudioConsumerStatus,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: &AudioConsumerStatus) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioConsumerWatchStatusResponse>(
(status,),
self.tx_id,
0x35cf702c721e2cc6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioCoreMarker;
impl fidl::endpoints::ProtocolMarker for AudioCoreMarker {
type Proxy = AudioCoreProxy;
type RequestStream = AudioCoreRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioCoreSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.AudioCore";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AudioCoreMarker {}
pub trait AudioCoreProxyInterface: Send + Sync {
fn r#create_audio_renderer(
&self,
audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error>;
fn r#create_audio_capturer_with_configuration(
&self,
stream_type: &AudioStreamType,
configuration: &AudioCapturerConfiguration,
audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error>;
fn r#create_audio_capturer(
&self,
loopback: bool,
audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error>;
fn r#enable_device_settings(&self, enabled: bool) -> Result<(), fidl::Error>;
fn r#set_render_usage_gain(
&self,
usage: AudioRenderUsage,
gain_db: f32,
) -> Result<(), fidl::Error>;
fn r#set_capture_usage_gain(
&self,
usage: AudioCaptureUsage,
gain_db: f32,
) -> Result<(), fidl::Error>;
fn r#bind_usage_volume_control(
&self,
usage: &Usage,
volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
) -> Result<(), fidl::Error>;
type GetVolumeFromDbResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
fn r#get_volume_from_db(&self, usage: &Usage, gain_db: f32)
-> Self::GetVolumeFromDbResponseFut;
type GetDbFromVolumeResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
fn r#get_db_from_volume(&self, usage: &Usage, volume: f32) -> Self::GetDbFromVolumeResponseFut;
fn r#set_interaction(
&self,
active: &Usage,
affected: &Usage,
behavior: Behavior,
) -> Result<(), fidl::Error>;
fn r#reset_interactions(&self) -> Result<(), fidl::Error>;
fn r#load_defaults(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioCoreSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioCoreSynchronousProxy {
type Proxy = AudioCoreProxy;
type Protocol = AudioCoreMarker;
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 AudioCoreSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioCoreMarker 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<AudioCoreEvent, fidl::Error> {
AudioCoreEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_audio_renderer(
&self,
mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioRendererRequest>(
(audio_out_request,),
0x2ac9beba47f83435,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_audio_capturer_with_configuration(
&self,
mut stream_type: &AudioStreamType,
mut configuration: &AudioCapturerConfiguration,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(
(stream_type, configuration, audio_capturer_request),
0x459de383b0d76d97,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_audio_capturer(
&self,
mut loopback: bool,
mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioCapturerRequest>(
(loopback, audio_in_request),
0x787db169df99aed0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreEnableDeviceSettingsRequest>(
(enabled,),
0x41107a1917269b3e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_render_usage_gain(
&self,
mut usage: AudioRenderUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetRenderUsageGainRequest>(
(usage, gain_db),
0x48097f45f6e2b8e7,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_capture_usage_gain(
&self,
mut usage: AudioCaptureUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetCaptureUsageGainRequest>(
(usage, gain_db),
0x457d29217d4ea248,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_usage_volume_control(
&self,
mut usage: &Usage,
mut volume_control: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreBindUsageVolumeControlRequest>(
(usage, volume_control),
0x7225be116aadc137,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_volume_from_db(
&self,
mut usage: &Usage,
mut gain_db: f32,
___deadline: zx::MonotonicInstant,
) -> Result<f32, fidl::Error> {
let _response = self
.client
.send_query::<AudioCoreGetVolumeFromDbRequest, AudioCoreGetVolumeFromDbResponse>(
(usage, gain_db),
0x50e3ca45509770bf,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.volume)
}
pub fn r#get_db_from_volume(
&self,
mut usage: &Usage,
mut volume: f32,
___deadline: zx::MonotonicInstant,
) -> Result<f32, fidl::Error> {
let _response = self
.client
.send_query::<AudioCoreGetDbFromVolumeRequest, AudioCoreGetDbFromVolumeResponse>(
(usage, volume),
0x3e8eec27dd5a8bda,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.gain_db)
}
pub fn r#set_interaction(
&self,
mut active: &Usage,
mut affected: &Usage,
mut behavior: Behavior,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetInteractionRequest>(
(active, affected, behavior),
0x7bfed14345ece7b7,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x65bd94d9d0a28b5e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#load_defaults(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x54a0bebca85f6b31,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct AudioCoreProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioCoreProxy {
type Protocol = AudioCoreMarker;
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 AudioCoreProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioCoreEventStream {
AudioCoreEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_audio_renderer(
&self,
mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#create_audio_renderer(self, audio_out_request)
}
pub fn r#create_audio_capturer_with_configuration(
&self,
mut stream_type: &AudioStreamType,
mut configuration: &AudioCapturerConfiguration,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#create_audio_capturer_with_configuration(
self,
stream_type,
configuration,
audio_capturer_request,
)
}
pub fn r#create_audio_capturer(
&self,
mut loopback: bool,
mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#create_audio_capturer(self, loopback, audio_in_request)
}
pub fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#enable_device_settings(self, enabled)
}
pub fn r#set_render_usage_gain(
&self,
mut usage: AudioRenderUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#set_render_usage_gain(self, usage, gain_db)
}
pub fn r#set_capture_usage_gain(
&self,
mut usage: AudioCaptureUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#set_capture_usage_gain(self, usage, gain_db)
}
pub fn r#bind_usage_volume_control(
&self,
mut usage: &Usage,
mut volume_control: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#bind_usage_volume_control(self, usage, volume_control)
}
pub fn r#get_volume_from_db(
&self,
mut usage: &Usage,
mut gain_db: f32,
) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioCoreProxyInterface::r#get_volume_from_db(self, usage, gain_db)
}
pub fn r#get_db_from_volume(
&self,
mut usage: &Usage,
mut volume: f32,
) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioCoreProxyInterface::r#get_db_from_volume(self, usage, volume)
}
pub fn r#set_interaction(
&self,
mut active: &Usage,
mut affected: &Usage,
mut behavior: Behavior,
) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#set_interaction(self, active, affected, behavior)
}
pub fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#reset_interactions(self)
}
pub fn r#load_defaults(&self) -> Result<(), fidl::Error> {
AudioCoreProxyInterface::r#load_defaults(self)
}
}
impl AudioCoreProxyInterface for AudioCoreProxy {
fn r#create_audio_renderer(
&self,
mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioRendererRequest>(
(audio_out_request,),
0x2ac9beba47f83435,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_audio_capturer_with_configuration(
&self,
mut stream_type: &AudioStreamType,
mut configuration: &AudioCapturerConfiguration,
mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(
(stream_type, configuration, audio_capturer_request),
0x459de383b0d76d97,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_audio_capturer(
&self,
mut loopback: bool,
mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreCreateAudioCapturerRequest>(
(loopback, audio_in_request),
0x787db169df99aed0,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreEnableDeviceSettingsRequest>(
(enabled,),
0x41107a1917269b3e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_render_usage_gain(
&self,
mut usage: AudioRenderUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetRenderUsageGainRequest>(
(usage, gain_db),
0x48097f45f6e2b8e7,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_capture_usage_gain(
&self,
mut usage: AudioCaptureUsage,
mut gain_db: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetCaptureUsageGainRequest>(
(usage, gain_db),
0x457d29217d4ea248,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_usage_volume_control(
&self,
mut usage: &Usage,
mut volume_control: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreBindUsageVolumeControlRequest>(
(usage, volume_control),
0x7225be116aadc137,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetVolumeFromDbResponseFut =
fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_volume_from_db(
&self,
mut usage: &Usage,
mut gain_db: f32,
) -> Self::GetVolumeFromDbResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioCoreGetVolumeFromDbResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x50e3ca45509770bf,
>(_buf?)?;
Ok(_response.volume)
}
self.client.send_query_and_decode::<AudioCoreGetVolumeFromDbRequest, f32>(
(usage, gain_db),
0x50e3ca45509770bf,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDbFromVolumeResponseFut =
fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_db_from_volume(
&self,
mut usage: &Usage,
mut volume: f32,
) -> Self::GetDbFromVolumeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioCoreGetDbFromVolumeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e8eec27dd5a8bda,
>(_buf?)?;
Ok(_response.gain_db)
}
self.client.send_query_and_decode::<AudioCoreGetDbFromVolumeRequest, f32>(
(usage, volume),
0x3e8eec27dd5a8bda,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_interaction(
&self,
mut active: &Usage,
mut affected: &Usage,
mut behavior: Behavior,
) -> Result<(), fidl::Error> {
self.client.send::<AudioCoreSetInteractionRequest>(
(active, affected, behavior),
0x7bfed14345ece7b7,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x65bd94d9d0a28b5e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#load_defaults(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x54a0bebca85f6b31,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct AudioCoreEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioCoreEventStream {}
impl futures::stream::FusedStream for AudioCoreEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioCoreEventStream {
type Item = Result<AudioCoreEvent, 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(AudioCoreEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioCoreEvent {}
impl AudioCoreEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioCoreEvent, 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: <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioCoreRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioCoreRequestStream {}
impl futures::stream::FusedStream for AudioCoreRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioCoreRequestStream {
type Protocol = AudioCoreMarker;
type ControlHandle = AudioCoreControlHandle;
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 {
AudioCoreControlHandle { 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 AudioCoreRequestStream {
type Item = Result<AudioCoreRequest, 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 AudioCoreRequestStream 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 {
0x2ac9beba47f83435 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreCreateAudioRendererRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioRendererRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::CreateAudioRenderer {
audio_out_request: req.audio_out_request,
control_handle,
})
}
0x459de383b0d76d97 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreCreateAudioCapturerWithConfigurationRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::CreateAudioCapturerWithConfiguration {
stream_type: req.stream_type,
configuration: req.configuration,
audio_capturer_request: req.audio_capturer_request,
control_handle,
})
}
0x787db169df99aed0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreCreateAudioCapturerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioCapturerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::CreateAudioCapturer {
loopback: req.loopback,
audio_in_request: req.audio_in_request,
control_handle,
})
}
0x41107a1917269b3e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreEnableDeviceSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreEnableDeviceSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::EnableDeviceSettings {
enabled: req.enabled,
control_handle,
})
}
0x48097f45f6e2b8e7 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreSetRenderUsageGainRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetRenderUsageGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::SetRenderUsageGain {
usage: req.usage,
gain_db: req.gain_db,
control_handle,
})
}
0x457d29217d4ea248 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreSetCaptureUsageGainRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetCaptureUsageGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::SetCaptureUsageGain {
usage: req.usage,
gain_db: req.gain_db,
control_handle,
})
}
0x7225be116aadc137 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreBindUsageVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreBindUsageVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::BindUsageVolumeControl {
usage: req.usage,
volume_control: req.volume_control,
control_handle,
})
}
0x50e3ca45509770bf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioCoreGetVolumeFromDbRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetVolumeFromDbRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::GetVolumeFromDb {
usage: req.usage,
gain_db: req.gain_db,
responder: AudioCoreGetVolumeFromDbResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3e8eec27dd5a8bda => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioCoreGetDbFromVolumeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetDbFromVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::GetDbFromVolume {
usage: req.usage,
volume: req.volume,
responder: AudioCoreGetDbFromVolumeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7bfed14345ece7b7 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioCoreSetInteractionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetInteractionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::SetInteraction {
active: req.active,
affected: req.affected,
behavior: req.behavior,
control_handle,
})
}
0x65bd94d9d0a28b5e => {
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 = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::ResetInteractions { control_handle })
}
0x54a0bebca85f6b31 => {
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 = AudioCoreControlHandle { inner: this.inner.clone() };
Ok(AudioCoreRequest::LoadDefaults { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioCoreRequest {
CreateAudioRenderer {
audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
control_handle: AudioCoreControlHandle,
},
CreateAudioCapturerWithConfiguration {
stream_type: AudioStreamType,
configuration: AudioCapturerConfiguration,
audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
control_handle: AudioCoreControlHandle,
},
CreateAudioCapturer {
loopback: bool,
audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
control_handle: AudioCoreControlHandle,
},
EnableDeviceSettings {
enabled: bool,
control_handle: AudioCoreControlHandle,
},
SetRenderUsageGain {
usage: AudioRenderUsage,
gain_db: f32,
control_handle: AudioCoreControlHandle,
},
SetCaptureUsageGain {
usage: AudioCaptureUsage,
gain_db: f32,
control_handle: AudioCoreControlHandle,
},
BindUsageVolumeControl {
usage: Usage,
volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
control_handle: AudioCoreControlHandle,
},
GetVolumeFromDb {
usage: Usage,
gain_db: f32,
responder: AudioCoreGetVolumeFromDbResponder,
},
GetDbFromVolume {
usage: Usage,
volume: f32,
responder: AudioCoreGetDbFromVolumeResponder,
},
SetInteraction {
active: Usage,
affected: Usage,
behavior: Behavior,
control_handle: AudioCoreControlHandle,
},
ResetInteractions {
control_handle: AudioCoreControlHandle,
},
LoadDefaults {
control_handle: AudioCoreControlHandle,
},
}
impl AudioCoreRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_renderer(
self,
) -> Option<(fidl::endpoints::ServerEnd<AudioRendererMarker>, AudioCoreControlHandle)> {
if let AudioCoreRequest::CreateAudioRenderer { audio_out_request, control_handle } = self {
Some((audio_out_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_capturer_with_configuration(
self,
) -> Option<(
AudioStreamType,
AudioCapturerConfiguration,
fidl::endpoints::ServerEnd<AudioCapturerMarker>,
AudioCoreControlHandle,
)> {
if let AudioCoreRequest::CreateAudioCapturerWithConfiguration {
stream_type,
configuration,
audio_capturer_request,
control_handle,
} = self
{
Some((stream_type, configuration, audio_capturer_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_capturer(
self,
) -> Option<(bool, fidl::endpoints::ServerEnd<AudioCapturerMarker>, AudioCoreControlHandle)>
{
if let AudioCoreRequest::CreateAudioCapturer {
loopback,
audio_in_request,
control_handle,
} = self
{
Some((loopback, audio_in_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_device_settings(self) -> Option<(bool, AudioCoreControlHandle)> {
if let AudioCoreRequest::EnableDeviceSettings { enabled, control_handle } = self {
Some((enabled, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_render_usage_gain(
self,
) -> Option<(AudioRenderUsage, f32, AudioCoreControlHandle)> {
if let AudioCoreRequest::SetRenderUsageGain { usage, gain_db, control_handle } = self {
Some((usage, gain_db, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_capture_usage_gain(
self,
) -> Option<(AudioCaptureUsage, f32, AudioCoreControlHandle)> {
if let AudioCoreRequest::SetCaptureUsageGain { usage, gain_db, control_handle } = self {
Some((usage, gain_db, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_usage_volume_control(
self,
) -> Option<(
Usage,
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
AudioCoreControlHandle,
)> {
if let AudioCoreRequest::BindUsageVolumeControl { usage, volume_control, control_handle } =
self
{
Some((usage, volume_control, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_volume_from_db(
self,
) -> Option<(Usage, f32, AudioCoreGetVolumeFromDbResponder)> {
if let AudioCoreRequest::GetVolumeFromDb { usage, gain_db, responder } = self {
Some((usage, gain_db, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_db_from_volume(
self,
) -> Option<(Usage, f32, AudioCoreGetDbFromVolumeResponder)> {
if let AudioCoreRequest::GetDbFromVolume { usage, volume, responder } = self {
Some((usage, volume, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_interaction(self) -> Option<(Usage, Usage, Behavior, AudioCoreControlHandle)> {
if let AudioCoreRequest::SetInteraction { active, affected, behavior, control_handle } =
self
{
Some((active, affected, behavior, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_interactions(self) -> Option<(AudioCoreControlHandle)> {
if let AudioCoreRequest::ResetInteractions { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_load_defaults(self) -> Option<(AudioCoreControlHandle)> {
if let AudioCoreRequest::LoadDefaults { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioCoreRequest::CreateAudioRenderer { .. } => "create_audio_renderer",
AudioCoreRequest::CreateAudioCapturerWithConfiguration { .. } => {
"create_audio_capturer_with_configuration"
}
AudioCoreRequest::CreateAudioCapturer { .. } => "create_audio_capturer",
AudioCoreRequest::EnableDeviceSettings { .. } => "enable_device_settings",
AudioCoreRequest::SetRenderUsageGain { .. } => "set_render_usage_gain",
AudioCoreRequest::SetCaptureUsageGain { .. } => "set_capture_usage_gain",
AudioCoreRequest::BindUsageVolumeControl { .. } => "bind_usage_volume_control",
AudioCoreRequest::GetVolumeFromDb { .. } => "get_volume_from_db",
AudioCoreRequest::GetDbFromVolume { .. } => "get_db_from_volume",
AudioCoreRequest::SetInteraction { .. } => "set_interaction",
AudioCoreRequest::ResetInteractions { .. } => "reset_interactions",
AudioCoreRequest::LoadDefaults { .. } => "load_defaults",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioCoreControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioCoreControlHandle {
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 AudioCoreControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCoreGetVolumeFromDbResponder {
control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCoreGetVolumeFromDbResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCoreGetVolumeFromDbResponder {
type ControlHandle = AudioCoreControlHandle;
fn control_handle(&self) -> &AudioCoreControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCoreGetVolumeFromDbResponder {
pub fn send(self, mut volume: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(volume);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut volume: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(volume);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut volume: f32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioCoreGetVolumeFromDbResponse>(
(volume,),
self.tx_id,
0x50e3ca45509770bf,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioCoreGetDbFromVolumeResponder {
control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioCoreGetDbFromVolumeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioCoreGetDbFromVolumeResponder {
type ControlHandle = AudioCoreControlHandle;
fn control_handle(&self) -> &AudioCoreControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioCoreGetDbFromVolumeResponder {
pub fn send(self, mut gain_db: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain_db);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut gain_db: f32) -> Result<(), fidl::Error> {
let _result = self.send_raw(gain_db);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioCoreGetDbFromVolumeResponse>(
(gain_db,),
self.tx_id,
0x3e8eec27dd5a8bda,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioDeviceEnumeratorMarker;
impl fidl::endpoints::ProtocolMarker for AudioDeviceEnumeratorMarker {
type Proxy = AudioDeviceEnumeratorProxy;
type RequestStream = AudioDeviceEnumeratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioDeviceEnumeratorSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.AudioDeviceEnumerator";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AudioDeviceEnumeratorMarker {}
pub trait AudioDeviceEnumeratorProxyInterface: Send + Sync {
type GetDevicesResponseFut: std::future::Future<Output = Result<Vec<AudioDeviceInfo>, fidl::Error>>
+ Send;
fn r#get_devices(&self) -> Self::GetDevicesResponseFut;
type GetDeviceGainResponseFut: std::future::Future<Output = Result<(u64, AudioGainInfo), fidl::Error>>
+ Send;
fn r#get_device_gain(&self, device_token: u64) -> Self::GetDeviceGainResponseFut;
fn r#set_device_gain(
&self,
device_token: u64,
gain_info: &AudioGainInfo,
valid_flags: AudioGainValidFlags,
) -> Result<(), fidl::Error>;
fn r#add_device_by_channel(
&self,
device_name: &str,
is_input: bool,
channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioDeviceEnumeratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioDeviceEnumeratorSynchronousProxy {
type Proxy = AudioDeviceEnumeratorProxy;
type Protocol = AudioDeviceEnumeratorMarker;
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 AudioDeviceEnumeratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioDeviceEnumeratorMarker 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<AudioDeviceEnumeratorEvent, fidl::Error> {
AudioDeviceEnumeratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_devices(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<AudioDeviceInfo>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioDeviceEnumeratorGetDevicesResponse>(
(),
0x4ce1aa218aeb12a6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.devices)
}
pub fn r#get_device_gain(
&self,
mut device_token: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(u64, AudioGainInfo), fidl::Error> {
let _response = self.client.send_query::<
AudioDeviceEnumeratorGetDeviceGainRequest,
AudioDeviceEnumeratorGetDeviceGainResponse,
>(
(device_token,),
0x25dd4723403c414b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.device_token, _response.gain_info))
}
pub fn r#set_device_gain(
&self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
mut valid_flags: AudioGainValidFlags,
) -> Result<(), fidl::Error> {
self.client.send::<AudioDeviceEnumeratorSetDeviceGainRequest>(
(device_token, gain_info, valid_flags),
0x5bdabc8ebe83591,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#add_device_by_channel(
&self,
mut device_name: &str,
mut is_input: bool,
mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(
(device_name, is_input, channel),
0x72cdbada4d70ed67,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct AudioDeviceEnumeratorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioDeviceEnumeratorProxy {
type Protocol = AudioDeviceEnumeratorMarker;
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 AudioDeviceEnumeratorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioDeviceEnumeratorEventStream {
AudioDeviceEnumeratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_devices(
&self,
) -> fidl::client::QueryResponseFut<
Vec<AudioDeviceInfo>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioDeviceEnumeratorProxyInterface::r#get_devices(self)
}
pub fn r#get_device_gain(
&self,
mut device_token: u64,
) -> fidl::client::QueryResponseFut<
(u64, AudioGainInfo),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioDeviceEnumeratorProxyInterface::r#get_device_gain(self, device_token)
}
pub fn r#set_device_gain(
&self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
mut valid_flags: AudioGainValidFlags,
) -> Result<(), fidl::Error> {
AudioDeviceEnumeratorProxyInterface::r#set_device_gain(
self,
device_token,
gain_info,
valid_flags,
)
}
pub fn r#add_device_by_channel(
&self,
mut device_name: &str,
mut is_input: bool,
mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
) -> Result<(), fidl::Error> {
AudioDeviceEnumeratorProxyInterface::r#add_device_by_channel(
self,
device_name,
is_input,
channel,
)
}
}
impl AudioDeviceEnumeratorProxyInterface for AudioDeviceEnumeratorProxy {
type GetDevicesResponseFut = fidl::client::QueryResponseFut<
Vec<AudioDeviceInfo>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<AudioDeviceInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioDeviceEnumeratorGetDevicesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4ce1aa218aeb12a6,
>(_buf?)?;
Ok(_response.devices)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioDeviceInfo>>(
(),
0x4ce1aa218aeb12a6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDeviceGainResponseFut = fidl::client::QueryResponseFut<
(u64, AudioGainInfo),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_device_gain(&self, mut device_token: u64) -> Self::GetDeviceGainResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u64, AudioGainInfo), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioDeviceEnumeratorGetDeviceGainResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x25dd4723403c414b,
>(_buf?)?;
Ok((_response.device_token, _response.gain_info))
}
self.client.send_query_and_decode::<
AudioDeviceEnumeratorGetDeviceGainRequest,
(u64, AudioGainInfo),
>(
(device_token,),
0x25dd4723403c414b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_device_gain(
&self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
mut valid_flags: AudioGainValidFlags,
) -> Result<(), fidl::Error> {
self.client.send::<AudioDeviceEnumeratorSetDeviceGainRequest>(
(device_token, gain_info, valid_flags),
0x5bdabc8ebe83591,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#add_device_by_channel(
&self,
mut device_name: &str,
mut is_input: bool,
mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(
(device_name, is_input, channel),
0x72cdbada4d70ed67,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct AudioDeviceEnumeratorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioDeviceEnumeratorEventStream {}
impl futures::stream::FusedStream for AudioDeviceEnumeratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioDeviceEnumeratorEventStream {
type Item = Result<AudioDeviceEnumeratorEvent, 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(AudioDeviceEnumeratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioDeviceEnumeratorEvent {
OnDeviceAdded { device: AudioDeviceInfo },
OnDeviceRemoved { device_token: u64 },
OnDeviceGainChanged { device_token: u64, gain_info: AudioGainInfo },
OnDefaultDeviceChanged { old_default_token: u64, new_default_token: u64 },
}
impl AudioDeviceEnumeratorEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_device_added(self) -> Option<AudioDeviceInfo> {
if let AudioDeviceEnumeratorEvent::OnDeviceAdded { device } = self {
Some((device))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_device_removed(self) -> Option<u64> {
if let AudioDeviceEnumeratorEvent::OnDeviceRemoved { device_token } = self {
Some((device_token))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_device_gain_changed(self) -> Option<(u64, AudioGainInfo)> {
if let AudioDeviceEnumeratorEvent::OnDeviceGainChanged { device_token, gain_info } = self {
Some((device_token, gain_info))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_default_device_changed(self) -> Option<(u64, u64)> {
if let AudioDeviceEnumeratorEvent::OnDefaultDeviceChanged {
old_default_token,
new_default_token,
} = self
{
Some((old_default_token, new_default_token))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioDeviceEnumeratorEvent, 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 {
0xe0fbe40057c4b44 => {
let mut out = fidl::new_empty!(
AudioDeviceEnumeratorOnDeviceAddedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceAddedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioDeviceEnumeratorEvent::OnDeviceAdded { device: out.device }))
}
0x6f3b7574463d9ff8 => {
let mut out = fidl::new_empty!(
AudioDeviceEnumeratorOnDeviceRemovedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioDeviceEnumeratorEvent::OnDeviceRemoved { device_token: out.device_token }))
}
0x14aefcbbb076b0e9 => {
let mut out = fidl::new_empty!(
AudioDeviceEnumeratorOnDeviceGainChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioDeviceEnumeratorEvent::OnDeviceGainChanged {
device_token: out.device_token,
gain_info: out.gain_info,
}))
}
0x16357b42d4c16e11 => {
let mut out = fidl::new_empty!(
AudioDeviceEnumeratorOnDefaultDeviceChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioDeviceEnumeratorEvent::OnDefaultDeviceChanged {
old_default_token: out.old_default_token,
new_default_token: out.new_default_token,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioDeviceEnumeratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioDeviceEnumeratorRequestStream {}
impl futures::stream::FusedStream for AudioDeviceEnumeratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioDeviceEnumeratorRequestStream {
type Protocol = AudioDeviceEnumeratorMarker;
type ControlHandle = AudioDeviceEnumeratorControlHandle;
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 {
AudioDeviceEnumeratorControlHandle { 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 AudioDeviceEnumeratorRequestStream {
type Item = Result<AudioDeviceEnumeratorRequest, 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 AudioDeviceEnumeratorRequestStream 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 {
0x4ce1aa218aeb12a6 => {
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 = AudioDeviceEnumeratorControlHandle {
inner: this.inner.clone(),
};
Ok(AudioDeviceEnumeratorRequest::GetDevices {
responder: AudioDeviceEnumeratorGetDevicesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x25dd4723403c414b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AudioDeviceEnumeratorGetDeviceGainRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorGetDeviceGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioDeviceEnumeratorControlHandle {
inner: this.inner.clone(),
};
Ok(AudioDeviceEnumeratorRequest::GetDeviceGain {device_token: req.device_token,
responder: AudioDeviceEnumeratorGetDeviceGainResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5bdabc8ebe83591 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(AudioDeviceEnumeratorSetDeviceGainRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorSetDeviceGainRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioDeviceEnumeratorControlHandle {
inner: this.inner.clone(),
};
Ok(AudioDeviceEnumeratorRequest::SetDeviceGain {device_token: req.device_token,
gain_info: req.gain_info,
valid_flags: req.valid_flags,
control_handle,
})
}
0x72cdbada4d70ed67 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(AudioDeviceEnumeratorAddDeviceByChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AudioDeviceEnumeratorControlHandle {
inner: this.inner.clone(),
};
Ok(AudioDeviceEnumeratorRequest::AddDeviceByChannel {device_name: req.device_name,
is_input: req.is_input,
channel: req.channel,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioDeviceEnumeratorRequest {
GetDevices { responder: AudioDeviceEnumeratorGetDevicesResponder },
GetDeviceGain { device_token: u64, responder: AudioDeviceEnumeratorGetDeviceGainResponder },
SetDeviceGain {
device_token: u64,
gain_info: AudioGainInfo,
valid_flags: AudioGainValidFlags,
control_handle: AudioDeviceEnumeratorControlHandle,
},
AddDeviceByChannel {
device_name: String,
is_input: bool,
channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
control_handle: AudioDeviceEnumeratorControlHandle,
},
}
impl AudioDeviceEnumeratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_devices(self) -> Option<(AudioDeviceEnumeratorGetDevicesResponder)> {
if let AudioDeviceEnumeratorRequest::GetDevices { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_gain(
self,
) -> Option<(u64, AudioDeviceEnumeratorGetDeviceGainResponder)> {
if let AudioDeviceEnumeratorRequest::GetDeviceGain { device_token, responder } = self {
Some((device_token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_device_gain(
self,
) -> Option<(u64, AudioGainInfo, AudioGainValidFlags, AudioDeviceEnumeratorControlHandle)> {
if let AudioDeviceEnumeratorRequest::SetDeviceGain {
device_token,
gain_info,
valid_flags,
control_handle,
} = self
{
Some((device_token, gain_info, valid_flags, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_device_by_channel(
self,
) -> Option<(
String,
bool,
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
AudioDeviceEnumeratorControlHandle,
)> {
if let AudioDeviceEnumeratorRequest::AddDeviceByChannel {
device_name,
is_input,
channel,
control_handle,
} = self
{
Some((device_name, is_input, channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioDeviceEnumeratorRequest::GetDevices { .. } => "get_devices",
AudioDeviceEnumeratorRequest::GetDeviceGain { .. } => "get_device_gain",
AudioDeviceEnumeratorRequest::SetDeviceGain { .. } => "set_device_gain",
AudioDeviceEnumeratorRequest::AddDeviceByChannel { .. } => "add_device_by_channel",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioDeviceEnumeratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioDeviceEnumeratorControlHandle {
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 AudioDeviceEnumeratorControlHandle {
pub fn send_on_device_added(&self, mut device: &AudioDeviceInfo) -> Result<(), fidl::Error> {
self.inner.send::<AudioDeviceEnumeratorOnDeviceAddedRequest>(
(device,),
0,
0xe0fbe40057c4b44,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_device_removed(&self, mut device_token: u64) -> Result<(), fidl::Error> {
self.inner.send::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(
(device_token,),
0,
0x6f3b7574463d9ff8,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_device_gain_changed(
&self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
) -> Result<(), fidl::Error> {
self.inner.send::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(
(device_token, gain_info),
0,
0x14aefcbbb076b0e9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_default_device_changed(
&self,
mut old_default_token: u64,
mut new_default_token: u64,
) -> Result<(), fidl::Error> {
self.inner.send::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(
(old_default_token, new_default_token),
0,
0x16357b42d4c16e11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioDeviceEnumeratorGetDevicesResponder {
control_handle: std::mem::ManuallyDrop<AudioDeviceEnumeratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioDeviceEnumeratorGetDevicesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioDeviceEnumeratorGetDevicesResponder {
type ControlHandle = AudioDeviceEnumeratorControlHandle;
fn control_handle(&self) -> &AudioDeviceEnumeratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioDeviceEnumeratorGetDevicesResponder {
pub fn send(self, mut devices: &[AudioDeviceInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(devices);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut devices: &[AudioDeviceInfo],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(devices);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut devices: &[AudioDeviceInfo]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioDeviceEnumeratorGetDevicesResponse>(
(devices,),
self.tx_id,
0x4ce1aa218aeb12a6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioDeviceEnumeratorGetDeviceGainResponder {
control_handle: std::mem::ManuallyDrop<AudioDeviceEnumeratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioDeviceEnumeratorGetDeviceGainResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioDeviceEnumeratorGetDeviceGainResponder {
type ControlHandle = AudioDeviceEnumeratorControlHandle;
fn control_handle(&self) -> &AudioDeviceEnumeratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioDeviceEnumeratorGetDeviceGainResponder {
pub fn send(
self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(device_token, gain_info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(device_token, gain_info);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut device_token: u64,
mut gain_info: &AudioGainInfo,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioDeviceEnumeratorGetDeviceGainResponse>(
(device_token, gain_info),
self.tx_id,
0x25dd4723403c414b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioRendererMarker;
impl fidl::endpoints::ProtocolMarker for AudioRendererMarker {
type Proxy = AudioRendererProxy;
type RequestStream = AudioRendererRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioRendererSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioRenderer";
}
pub trait AudioRendererProxyInterface: Send + Sync {
fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
fn r#bind_gain_control(
&self,
gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error>;
fn r#set_pts_units(
&self,
tick_per_second_numerator: u32,
tick_per_second_denominator: u32,
) -> Result<(), fidl::Error>;
fn r#set_pts_continuity_threshold(&self, threshold_seconds: f32) -> Result<(), fidl::Error>;
type GetReferenceClockResponseFut: std::future::Future<Output = Result<fidl::Clock, fidl::Error>>
+ Send;
fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut;
fn r#set_reference_clock(
&self,
reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error>;
fn r#set_usage(&self, usage: AudioRenderUsage) -> Result<(), fidl::Error>;
fn r#set_pcm_stream_type(&self, type_: &AudioStreamType) -> Result<(), fidl::Error>;
fn r#enable_min_lead_time_events(&self, enabled: bool) -> Result<(), fidl::Error>;
type GetMinLeadTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#get_min_lead_time(&self) -> Self::GetMinLeadTimeResponseFut;
type PlayResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>> + Send;
fn r#play(&self, reference_time: i64, media_time: i64) -> Self::PlayResponseFut;
fn r#play_no_reply(&self, reference_time: i64, media_time: i64) -> Result<(), fidl::Error>;
type PauseResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>> + Send;
fn r#pause(&self) -> Self::PauseResponseFut;
fn r#pause_no_reply(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioRendererSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioRendererSynchronousProxy {
type Proxy = AudioRendererProxy;
type Protocol = AudioRendererMarker;
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 AudioRendererSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioRendererMarker 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<AudioRendererEvent, fidl::Error> {
AudioRendererEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#discard_all_packets(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererBindGainControlRequest>(
(gain_control_request,),
0x293f5c7f8fba2bdc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_pts_units(
&self,
mut tick_per_second_numerator: u32,
mut tick_per_second_denominator: u32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPtsUnitsRequest>(
(tick_per_second_numerator, tick_per_second_denominator),
0xf68cd108785a27c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_pts_continuity_threshold(
&self,
mut threshold_seconds: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPtsContinuityThresholdRequest>(
(threshold_seconds,),
0x2849ba571d1971ba,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_reference_clock(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::Clock, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioRendererGetReferenceClockResponse>(
(),
0x2f7a7f011a172f7e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.reference_clock)
}
pub fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetReferenceClockRequest>(
(reference_clock,),
0x39acd05d832b5fed,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetUsageRequest>(
(usage,),
0x3994bd23b55a733e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPcmStreamTypeRequest>(
(type_,),
0x27aa715d8901fa19,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererEnableMinLeadTimeEventsRequest>(
(enabled,),
0x62808dfad72bf890,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_min_lead_time(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<i64, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, AudioRendererGetMinLeadTimeResponse>(
(),
0x1cf3c3ecd8fec26b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.min_lead_time_nsec)
}
pub fn r#play(
&self,
mut reference_time: i64,
mut media_time: i64,
___deadline: zx::MonotonicInstant,
) -> Result<(i64, i64), fidl::Error> {
let _response =
self.client.send_query::<AudioRendererPlayRequest, AudioRendererPlayResponse>(
(reference_time, media_time),
0x3c0162db084f74a3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.reference_time, _response.media_time))
}
pub fn r#play_no_reply(
&self,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererPlayNoReplyRequest>(
(reference_time, media_time),
0x1b7fe832b68c22ef,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#pause(&self, ___deadline: zx::MonotonicInstant) -> Result<(i64, i64), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, AudioRendererPauseResponse>(
(),
0x41d557588d93d153,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.reference_time, _response.media_time))
}
pub fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x24cc45d4f3855ab,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct AudioRendererProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioRendererProxy {
type Protocol = AudioRendererMarker;
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 AudioRendererProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioRendererEventStream {
AudioRendererEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#remove_payload_buffer(self, id)
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioRendererProxyInterface::r#send_packet(self, packet)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#send_packet_no_reply(self, packet)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#end_of_stream(self)
}
pub fn r#discard_all_packets(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioRendererProxyInterface::r#discard_all_packets(self)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#discard_all_packets_no_reply(self)
}
pub fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#bind_gain_control(self, gain_control_request)
}
pub fn r#set_pts_units(
&self,
mut tick_per_second_numerator: u32,
mut tick_per_second_denominator: u32,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#set_pts_units(
self,
tick_per_second_numerator,
tick_per_second_denominator,
)
}
pub fn r#set_pts_continuity_threshold(
&self,
mut threshold_seconds: f32,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#set_pts_continuity_threshold(self, threshold_seconds)
}
pub fn r#get_reference_clock(
&self,
) -> fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioRendererProxyInterface::r#get_reference_clock(self)
}
pub fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#set_reference_clock(self, reference_clock)
}
pub fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#set_usage(self, usage)
}
pub fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#set_pcm_stream_type(self, type_)
}
pub fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#enable_min_lead_time_events(self, enabled)
}
pub fn r#get_min_lead_time(
&self,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioRendererProxyInterface::r#get_min_lead_time(self)
}
pub fn r#play(
&self,
mut reference_time: i64,
mut media_time: i64,
) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioRendererProxyInterface::r#play(self, reference_time, media_time)
}
pub fn r#play_no_reply(
&self,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#play_no_reply(self, reference_time, media_time)
}
pub fn r#pause(
&self,
) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
{
AudioRendererProxyInterface::r#pause(self)
}
pub fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
AudioRendererProxyInterface::r#pause_no_reply(self)
}
}
impl AudioRendererProxyInterface for AudioRendererProxy {
fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
type SendPacketResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
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,
0x67cddd607442775f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
type DiscardAllPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
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,
0x6f4dad7af2917665,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_gain_control(
&self,
mut gain_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::GainControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererBindGainControlRequest>(
(gain_control_request,),
0x293f5c7f8fba2bdc,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_pts_units(
&self,
mut tick_per_second_numerator: u32,
mut tick_per_second_denominator: u32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPtsUnitsRequest>(
(tick_per_second_numerator, tick_per_second_denominator),
0xf68cd108785a27c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_pts_continuity_threshold(
&self,
mut threshold_seconds: f32,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPtsContinuityThresholdRequest>(
(threshold_seconds,),
0x2849ba571d1971ba,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetReferenceClockResponseFut =
fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Clock, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRendererGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2f7a7f011a172f7e,
>(_buf?)?;
Ok(_response.reference_clock)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Clock>(
(),
0x2f7a7f011a172f7e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_reference_clock(
&self,
mut reference_clock: Option<fidl::Clock>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetReferenceClockRequest>(
(reference_clock,),
0x39acd05d832b5fed,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetUsageRequest>(
(usage,),
0x3994bd23b55a733e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererSetPcmStreamTypeRequest>(
(type_,),
0x27aa715d8901fa19,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererEnableMinLeadTimeEventsRequest>(
(enabled,),
0x62808dfad72bf890,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetMinLeadTimeResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_min_lead_time(&self) -> Self::GetMinLeadTimeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRendererGetMinLeadTimeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1cf3c3ecd8fec26b,
>(_buf?)?;
Ok(_response.min_lead_time_nsec)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x1cf3c3ecd8fec26b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PlayResponseFut =
fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#play(&self, mut reference_time: i64, mut media_time: i64) -> Self::PlayResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i64, i64), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRendererPlayResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3c0162db084f74a3,
>(_buf?)?;
Ok((_response.reference_time, _response.media_time))
}
self.client.send_query_and_decode::<AudioRendererPlayRequest, (i64, i64)>(
(reference_time, media_time),
0x3c0162db084f74a3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#play_no_reply(
&self,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
self.client.send::<AudioRendererPlayNoReplyRequest>(
(reference_time, media_time),
0x1b7fe832b68c22ef,
fidl::encoding::DynamicFlags::empty(),
)
}
type PauseResponseFut =
fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#pause(&self) -> Self::PauseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i64, i64), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AudioRendererPauseResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x41d557588d93d153,
>(_buf?)?;
Ok((_response.reference_time, _response.media_time))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i64, i64)>(
(),
0x41d557588d93d153,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x24cc45d4f3855ab,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct AudioRendererEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioRendererEventStream {}
impl futures::stream::FusedStream for AudioRendererEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioRendererEventStream {
type Item = Result<AudioRendererEvent, 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(AudioRendererEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioRendererEvent {
OnMinLeadTimeChanged { min_lead_time_nsec: i64 },
}
impl AudioRendererEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_min_lead_time_changed(self) -> Option<i64> {
if let AudioRendererEvent::OnMinLeadTimeChanged { min_lead_time_nsec } = self {
Some((min_lead_time_nsec))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioRendererEvent, 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 {
0x4feff7d278978c4e => {
let mut out = fidl::new_empty!(
AudioRendererOnMinLeadTimeChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererOnMinLeadTimeChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioRendererEvent::OnMinLeadTimeChanged {
min_lead_time_nsec: out.min_lead_time_nsec,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioRendererRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioRendererRequestStream {}
impl futures::stream::FusedStream for AudioRendererRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioRendererRequestStream {
type Protocol = AudioRendererMarker;
type ControlHandle = AudioRendererControlHandle;
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 {
AudioRendererControlHandle { 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 AudioRendererRequestStream {
type Item = Result<AudioRendererRequest, 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 AudioRendererRequestStream 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 {
0x3b3a37fc34fe5b56 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::AddPayloadBuffer {
id: req.id,
payload_buffer: req.payload_buffer,
control_handle,
})
}
0x5d1e4f74c3658262 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetRemovePayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::RemovePayloadBuffer { id: req.id, control_handle })
}
0x67cddd607442775f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SendPacket {
packet: req.packet,
responder: AudioRendererSendPacketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x8d9b8b413ceba9d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketNoReplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SendPacketNoReply {
packet: req.packet,
control_handle,
})
}
0x6180fd6f7e793b71 => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::EndOfStream { control_handle })
}
0x6f4dad7af2917665 => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::DiscardAllPackets {
responder: AudioRendererDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x50d36d0d23081bc4 => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::DiscardAllPacketsNoReply { control_handle })
}
0x293f5c7f8fba2bdc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererBindGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::BindGainControl {
gain_control_request: req.gain_control_request,
control_handle,
})
}
0xf68cd108785a27c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererSetPtsUnitsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPtsUnitsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SetPtsUnits {
tick_per_second_numerator: req.tick_per_second_numerator,
tick_per_second_denominator: req.tick_per_second_denominator,
control_handle,
})
}
0x2849ba571d1971ba => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererSetPtsContinuityThresholdRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPtsContinuityThresholdRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SetPtsContinuityThreshold {
threshold_seconds: req.threshold_seconds,
control_handle,
})
}
0x2f7a7f011a172f7e => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::GetReferenceClock {
responder: AudioRendererGetReferenceClockResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x39acd05d832b5fed => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetReferenceClockRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SetReferenceClock {
reference_clock: req.reference_clock,
control_handle,
})
}
0x3994bd23b55a733e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererSetUsageRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetUsageRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SetUsage { usage: req.usage, control_handle })
}
0x27aa715d8901fa19 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererSetPcmStreamTypeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPcmStreamTypeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::SetPcmStreamType {
type_: req.type_,
control_handle,
})
}
0x62808dfad72bf890 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererEnableMinLeadTimeEventsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererEnableMinLeadTimeEventsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::EnableMinLeadTimeEvents {
enabled: req.enabled,
control_handle,
})
}
0x1cf3c3ecd8fec26b => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::GetMinLeadTime {
responder: AudioRendererGetMinLeadTimeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3c0162db084f74a3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioRendererPlayRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererPlayRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::Play {
reference_time: req.reference_time,
media_time: req.media_time,
responder: AudioRendererPlayResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1b7fe832b68c22ef => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioRendererPlayNoReplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererPlayNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::PlayNoReply {
reference_time: req.reference_time,
media_time: req.media_time,
control_handle,
})
}
0x41d557588d93d153 => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::Pause {
responder: AudioRendererPauseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x24cc45d4f3855ab => {
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 =
AudioRendererControlHandle { inner: this.inner.clone() };
Ok(AudioRendererRequest::PauseNoReply { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioRendererRequest {
AddPayloadBuffer {
id: u32,
payload_buffer: fidl::Vmo,
control_handle: AudioRendererControlHandle,
},
RemovePayloadBuffer {
id: u32,
control_handle: AudioRendererControlHandle,
},
SendPacket {
packet: StreamPacket,
responder: AudioRendererSendPacketResponder,
},
SendPacketNoReply {
packet: StreamPacket,
control_handle: AudioRendererControlHandle,
},
EndOfStream {
control_handle: AudioRendererControlHandle,
},
DiscardAllPackets {
responder: AudioRendererDiscardAllPacketsResponder,
},
DiscardAllPacketsNoReply {
control_handle: AudioRendererControlHandle,
},
BindGainControl {
gain_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
control_handle: AudioRendererControlHandle,
},
SetPtsUnits {
tick_per_second_numerator: u32,
tick_per_second_denominator: u32,
control_handle: AudioRendererControlHandle,
},
SetPtsContinuityThreshold {
threshold_seconds: f32,
control_handle: AudioRendererControlHandle,
},
GetReferenceClock {
responder: AudioRendererGetReferenceClockResponder,
},
SetReferenceClock {
reference_clock: Option<fidl::Clock>,
control_handle: AudioRendererControlHandle,
},
SetUsage {
usage: AudioRenderUsage,
control_handle: AudioRendererControlHandle,
},
SetPcmStreamType {
type_: AudioStreamType,
control_handle: AudioRendererControlHandle,
},
EnableMinLeadTimeEvents {
enabled: bool,
control_handle: AudioRendererControlHandle,
},
GetMinLeadTime {
responder: AudioRendererGetMinLeadTimeResponder,
},
Play {
reference_time: i64,
media_time: i64,
responder: AudioRendererPlayResponder,
},
PlayNoReply {
reference_time: i64,
media_time: i64,
control_handle: AudioRendererControlHandle,
},
Pause {
responder: AudioRendererPauseResponder,
},
PauseNoReply {
control_handle: AudioRendererControlHandle,
},
}
impl AudioRendererRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, AudioRendererControlHandle)> {
if let AudioRendererRequest::AddPayloadBuffer { id, payload_buffer, control_handle } = self
{
Some((id, payload_buffer, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_payload_buffer(self) -> Option<(u32, AudioRendererControlHandle)> {
if let AudioRendererRequest::RemovePayloadBuffer { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet(self) -> Option<(StreamPacket, AudioRendererSendPacketResponder)> {
if let AudioRendererRequest::SendPacket { packet, responder } = self {
Some((packet, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet_no_reply(self) -> Option<(StreamPacket, AudioRendererControlHandle)> {
if let AudioRendererRequest::SendPacketNoReply { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_end_of_stream(self) -> Option<(AudioRendererControlHandle)> {
if let AudioRendererRequest::EndOfStream { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets(self) -> Option<(AudioRendererDiscardAllPacketsResponder)> {
if let AudioRendererRequest::DiscardAllPackets { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets_no_reply(self) -> Option<(AudioRendererControlHandle)> {
if let AudioRendererRequest::DiscardAllPacketsNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_gain_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
AudioRendererControlHandle,
)> {
if let AudioRendererRequest::BindGainControl { gain_control_request, control_handle } = self
{
Some((gain_control_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_pts_units(self) -> Option<(u32, u32, AudioRendererControlHandle)> {
if let AudioRendererRequest::SetPtsUnits {
tick_per_second_numerator,
tick_per_second_denominator,
control_handle,
} = self
{
Some((tick_per_second_numerator, tick_per_second_denominator, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_pts_continuity_threshold(self) -> Option<(f32, AudioRendererControlHandle)> {
if let AudioRendererRequest::SetPtsContinuityThreshold {
threshold_seconds,
control_handle,
} = self
{
Some((threshold_seconds, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_reference_clock(self) -> Option<(AudioRendererGetReferenceClockResponder)> {
if let AudioRendererRequest::GetReferenceClock { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_reference_clock(
self,
) -> Option<(Option<fidl::Clock>, AudioRendererControlHandle)> {
if let AudioRendererRequest::SetReferenceClock { reference_clock, control_handle } = self {
Some((reference_clock, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_usage(self) -> Option<(AudioRenderUsage, AudioRendererControlHandle)> {
if let AudioRendererRequest::SetUsage { usage, control_handle } = self {
Some((usage, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_pcm_stream_type(self) -> Option<(AudioStreamType, AudioRendererControlHandle)> {
if let AudioRendererRequest::SetPcmStreamType { type_, control_handle } = self {
Some((type_, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_min_lead_time_events(self) -> Option<(bool, AudioRendererControlHandle)> {
if let AudioRendererRequest::EnableMinLeadTimeEvents { enabled, control_handle } = self {
Some((enabled, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_min_lead_time(self) -> Option<(AudioRendererGetMinLeadTimeResponder)> {
if let AudioRendererRequest::GetMinLeadTime { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_play(self) -> Option<(i64, i64, AudioRendererPlayResponder)> {
if let AudioRendererRequest::Play { reference_time, media_time, responder } = self {
Some((reference_time, media_time, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_play_no_reply(self) -> Option<(i64, i64, AudioRendererControlHandle)> {
if let AudioRendererRequest::PlayNoReply { reference_time, media_time, control_handle } =
self
{
Some((reference_time, media_time, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause(self) -> Option<(AudioRendererPauseResponder)> {
if let AudioRendererRequest::Pause { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause_no_reply(self) -> Option<(AudioRendererControlHandle)> {
if let AudioRendererRequest::PauseNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioRendererRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
AudioRendererRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
AudioRendererRequest::SendPacket { .. } => "send_packet",
AudioRendererRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
AudioRendererRequest::EndOfStream { .. } => "end_of_stream",
AudioRendererRequest::DiscardAllPackets { .. } => "discard_all_packets",
AudioRendererRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
AudioRendererRequest::BindGainControl { .. } => "bind_gain_control",
AudioRendererRequest::SetPtsUnits { .. } => "set_pts_units",
AudioRendererRequest::SetPtsContinuityThreshold { .. } => {
"set_pts_continuity_threshold"
}
AudioRendererRequest::GetReferenceClock { .. } => "get_reference_clock",
AudioRendererRequest::SetReferenceClock { .. } => "set_reference_clock",
AudioRendererRequest::SetUsage { .. } => "set_usage",
AudioRendererRequest::SetPcmStreamType { .. } => "set_pcm_stream_type",
AudioRendererRequest::EnableMinLeadTimeEvents { .. } => "enable_min_lead_time_events",
AudioRendererRequest::GetMinLeadTime { .. } => "get_min_lead_time",
AudioRendererRequest::Play { .. } => "play",
AudioRendererRequest::PlayNoReply { .. } => "play_no_reply",
AudioRendererRequest::Pause { .. } => "pause",
AudioRendererRequest::PauseNoReply { .. } => "pause_no_reply",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioRendererControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioRendererControlHandle {
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 AudioRendererControlHandle {
pub fn send_on_min_lead_time_changed(
&self,
mut min_lead_time_nsec: i64,
) -> Result<(), fidl::Error> {
self.inner.send::<AudioRendererOnMinLeadTimeChangedRequest>(
(min_lead_time_nsec,),
0,
0x4feff7d278978c4e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererSendPacketResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererSendPacketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererSendPacketResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererSendPacketResponder {
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,
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererDiscardAllPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererDiscardAllPacketsResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererDiscardAllPacketsResponder {
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,
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererGetReferenceClockResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererGetReferenceClockResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererGetReferenceClockResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererGetReferenceClockResponder {
pub fn send(self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_clock);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut reference_clock: fidl::Clock,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_clock);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRendererGetReferenceClockResponse>(
(reference_clock,),
self.tx_id,
0x2f7a7f011a172f7e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererGetMinLeadTimeResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererGetMinLeadTimeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererGetMinLeadTimeResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererGetMinLeadTimeResponder {
pub fn send(self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(min_lead_time_nsec);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(min_lead_time_nsec);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRendererGetMinLeadTimeResponse>(
(min_lead_time_nsec,),
self.tx_id,
0x1cf3c3ecd8fec26b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererPlayResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererPlayResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererPlayResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererPlayResponder {
pub fn send(self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_time, media_time);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_time, media_time);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRendererPlayResponse>(
(reference_time, media_time),
self.tx_id,
0x3c0162db084f74a3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioRendererPauseResponder {
control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioRendererPauseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioRendererPauseResponder {
type ControlHandle = AudioRendererControlHandle;
fn control_handle(&self) -> &AudioRendererControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioRendererPauseResponder {
pub fn send(self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_time, media_time);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut reference_time: i64,
mut media_time: i64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(reference_time, media_time);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AudioRendererPauseResponse>(
(reference_time, media_time),
self.tx_id,
0x41d557588d93d153,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProfileProviderMarker;
impl fidl::endpoints::ProtocolMarker for ProfileProviderMarker {
type Proxy = ProfileProviderProxy;
type RequestStream = ProfileProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.ProfileProvider";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileProviderMarker {}
pub trait ProfileProviderProxyInterface: Send + Sync {
type RegisterHandlerWithCapacityResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>>
+ Send;
fn r#register_handler_with_capacity(
&self,
thread_handle: fidl::Thread,
name: &str,
period: i64,
capacity: f32,
) -> Self::RegisterHandlerWithCapacityResponseFut;
type UnregisterHandlerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#unregister_handler(
&self,
thread_handle: fidl::Thread,
name: &str,
) -> Self::UnregisterHandlerResponseFut;
type RegisterMemoryRangeResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#register_memory_range(
&self,
vmar_handle: fidl::Vmar,
name: &str,
) -> Self::RegisterMemoryRangeResponseFut;
type UnregisterMemoryRangeResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#unregister_memory_range(
&self,
vmar_handle: fidl::Vmar,
) -> Self::UnregisterMemoryRangeResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileProviderSynchronousProxy {
type Proxy = ProfileProviderProxy;
type Protocol = ProfileProviderMarker;
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 ProfileProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileProviderMarker 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<ProfileProviderEvent, fidl::Error> {
ProfileProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_handler_with_capacity(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
mut period: i64,
mut capacity: f32,
___deadline: zx::MonotonicInstant,
) -> Result<(i64, i64), fidl::Error> {
let _response = self.client.send_query::<
ProfileProviderRegisterHandlerWithCapacityRequest,
ProfileProviderRegisterHandlerWithCapacityResponse,
>(
(thread_handle, name, period, capacity,),
0x60459ecef7458176,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.period, _response.capacity))
}
pub fn r#unregister_handler(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ProfileProviderUnregisterHandlerRequest, fidl::encoding::EmptyPayload>(
(thread_handle, name),
0x724d9d5fd8ef544c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#register_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
mut name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ProfileProviderRegisterMemoryRangeRequest, fidl::encoding::EmptyPayload>(
(vmar_handle, name),
0x2f509d3523e9562d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#unregister_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ProfileProviderUnregisterMemoryRangeRequest,
fidl::encoding::EmptyPayload,
>(
(vmar_handle,),
0x2dc313d6aa81ad27,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ProfileProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProfileProviderProxy {
type Protocol = ProfileProviderMarker;
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 ProfileProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileProviderEventStream {
ProfileProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_handler_with_capacity(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
mut period: i64,
mut capacity: f32,
) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
{
ProfileProviderProxyInterface::r#register_handler_with_capacity(
self,
thread_handle,
name,
period,
capacity,
)
}
pub fn r#unregister_handler(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ProfileProviderProxyInterface::r#unregister_handler(self, thread_handle, name)
}
pub fn r#register_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
mut name: &str,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ProfileProviderProxyInterface::r#register_memory_range(self, vmar_handle, name)
}
pub fn r#unregister_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ProfileProviderProxyInterface::r#unregister_memory_range(self, vmar_handle)
}
}
impl ProfileProviderProxyInterface for ProfileProviderProxy {
type RegisterHandlerWithCapacityResponseFut =
fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_handler_with_capacity(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
mut period: i64,
mut capacity: f32,
) -> Self::RegisterHandlerWithCapacityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i64, i64), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ProfileProviderRegisterHandlerWithCapacityResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x60459ecef7458176,
>(_buf?)?;
Ok((_response.period, _response.capacity))
}
self.client
.send_query_and_decode::<ProfileProviderRegisterHandlerWithCapacityRequest, (i64, i64)>(
(thread_handle, name, period, capacity),
0x60459ecef7458176,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UnregisterHandlerResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#unregister_handler(
&self,
mut thread_handle: fidl::Thread,
mut name: &str,
) -> Self::UnregisterHandlerResponseFut {
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,
0x724d9d5fd8ef544c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ProfileProviderUnregisterHandlerRequest, ()>(
(thread_handle, name),
0x724d9d5fd8ef544c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RegisterMemoryRangeResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
mut name: &str,
) -> Self::RegisterMemoryRangeResponseFut {
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,
0x2f509d3523e9562d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ProfileProviderRegisterMemoryRangeRequest, ()>(
(vmar_handle, name),
0x2f509d3523e9562d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UnregisterMemoryRangeResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#unregister_memory_range(
&self,
mut vmar_handle: fidl::Vmar,
) -> Self::UnregisterMemoryRangeResponseFut {
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,
0x2dc313d6aa81ad27,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ProfileProviderUnregisterMemoryRangeRequest, ()>(
(vmar_handle,),
0x2dc313d6aa81ad27,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProfileProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProfileProviderEventStream {}
impl futures::stream::FusedStream for ProfileProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileProviderEventStream {
type Item = Result<ProfileProviderEvent, 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(ProfileProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileProviderEvent {}
impl ProfileProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProfileProviderEvent, 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:
<ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileProviderRequestStream {}
impl futures::stream::FusedStream for ProfileProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileProviderRequestStream {
type Protocol = ProfileProviderMarker;
type ControlHandle = ProfileProviderControlHandle;
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 {
ProfileProviderControlHandle { 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 ProfileProviderRequestStream {
type Item = Result<ProfileProviderRequest, 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 ProfileProviderRequestStream 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 {
0x60459ecef7458176 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderRegisterHandlerWithCapacityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderRegisterHandlerWithCapacityRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::RegisterHandlerWithCapacity {
thread_handle: req.thread_handle,
name: req.name,
period: req.period,
capacity: req.capacity,
responder: ProfileProviderRegisterHandlerWithCapacityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x724d9d5fd8ef544c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderUnregisterHandlerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderUnregisterHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::UnregisterHandler {
thread_handle: req.thread_handle,
name: req.name,
responder: ProfileProviderUnregisterHandlerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2f509d3523e9562d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderRegisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderRegisterMemoryRangeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::RegisterMemoryRange {
vmar_handle: req.vmar_handle,
name: req.name,
responder: ProfileProviderRegisterMemoryRangeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2dc313d6aa81ad27 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileProviderUnregisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderUnregisterMemoryRangeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ProfileProviderControlHandle { inner: this.inner.clone() };
Ok(ProfileProviderRequest::UnregisterMemoryRange {
vmar_handle: req.vmar_handle,
responder: ProfileProviderUnregisterMemoryRangeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProfileProviderRequest {
RegisterHandlerWithCapacity {
thread_handle: fidl::Thread,
name: String,
period: i64,
capacity: f32,
responder: ProfileProviderRegisterHandlerWithCapacityResponder,
},
UnregisterHandler {
thread_handle: fidl::Thread,
name: String,
responder: ProfileProviderUnregisterHandlerResponder,
},
RegisterMemoryRange {
vmar_handle: fidl::Vmar,
name: String,
responder: ProfileProviderRegisterMemoryRangeResponder,
},
UnregisterMemoryRange {
vmar_handle: fidl::Vmar,
responder: ProfileProviderUnregisterMemoryRangeResponder,
},
}
impl ProfileProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_handler_with_capacity(
self,
) -> Option<(fidl::Thread, String, i64, f32, ProfileProviderRegisterHandlerWithCapacityResponder)>
{
if let ProfileProviderRequest::RegisterHandlerWithCapacity {
thread_handle,
name,
period,
capacity,
responder,
} = self
{
Some((thread_handle, name, period, capacity, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unregister_handler(
self,
) -> Option<(fidl::Thread, String, ProfileProviderUnregisterHandlerResponder)> {
if let ProfileProviderRequest::UnregisterHandler { thread_handle, name, responder } = self {
Some((thread_handle, name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_memory_range(
self,
) -> Option<(fidl::Vmar, String, ProfileProviderRegisterMemoryRangeResponder)> {
if let ProfileProviderRequest::RegisterMemoryRange { vmar_handle, name, responder } = self {
Some((vmar_handle, name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unregister_memory_range(
self,
) -> Option<(fidl::Vmar, ProfileProviderUnregisterMemoryRangeResponder)> {
if let ProfileProviderRequest::UnregisterMemoryRange { vmar_handle, responder } = self {
Some((vmar_handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileProviderRequest::RegisterHandlerWithCapacity { .. } => {
"register_handler_with_capacity"
}
ProfileProviderRequest::UnregisterHandler { .. } => "unregister_handler",
ProfileProviderRequest::RegisterMemoryRange { .. } => "register_memory_range",
ProfileProviderRequest::UnregisterMemoryRange { .. } => "unregister_memory_range",
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProfileProviderControlHandle {
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 ProfileProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderRegisterHandlerWithCapacityResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderRegisterHandlerWithCapacityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderRegisterHandlerWithCapacityResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderRegisterHandlerWithCapacityResponder {
pub fn send(self, mut period: i64, mut capacity: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(period, capacity);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut period: i64,
mut capacity: i64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(period, capacity);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut period: i64, mut capacity: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ProfileProviderRegisterHandlerWithCapacityResponse>(
(period, capacity),
self.tx_id,
0x60459ecef7458176,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderUnregisterHandlerResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderUnregisterHandlerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderUnregisterHandlerResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderUnregisterHandlerResponder {
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,
0x724d9d5fd8ef544c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderRegisterMemoryRangeResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderRegisterMemoryRangeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderRegisterMemoryRangeResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderRegisterMemoryRangeResponder {
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,
0x2f509d3523e9562d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileProviderUnregisterMemoryRangeResponder {
control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileProviderUnregisterMemoryRangeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileProviderUnregisterMemoryRangeResponder {
type ControlHandle = ProfileProviderControlHandle;
fn control_handle(&self) -> &ProfileProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileProviderUnregisterMemoryRangeResponder {
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,
0x2dc313d6aa81ad27,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SessionAudioConsumerFactoryMarker;
impl fidl::endpoints::ProtocolMarker for SessionAudioConsumerFactoryMarker {
type Proxy = SessionAudioConsumerFactoryProxy;
type RequestStream = SessionAudioConsumerFactoryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SessionAudioConsumerFactorySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.SessionAudioConsumerFactory";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SessionAudioConsumerFactoryMarker {}
pub trait SessionAudioConsumerFactoryProxyInterface: Send + Sync {
fn r#create_audio_consumer(
&self,
session_id: u64,
audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SessionAudioConsumerFactorySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SessionAudioConsumerFactorySynchronousProxy {
type Proxy = SessionAudioConsumerFactoryProxy;
type Protocol = SessionAudioConsumerFactoryMarker;
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 SessionAudioConsumerFactorySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<SessionAudioConsumerFactoryMarker 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<SessionAudioConsumerFactoryEvent, fidl::Error> {
SessionAudioConsumerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_audio_consumer(
&self,
mut session_id: u64,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
(session_id, audio_consumer_request),
0x6fab96f988e7d7fb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct SessionAudioConsumerFactoryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SessionAudioConsumerFactoryProxy {
type Protocol = SessionAudioConsumerFactoryMarker;
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 SessionAudioConsumerFactoryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SessionAudioConsumerFactoryEventStream {
SessionAudioConsumerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_audio_consumer(
&self,
mut session_id: u64,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
SessionAudioConsumerFactoryProxyInterface::r#create_audio_consumer(
self,
session_id,
audio_consumer_request,
)
}
}
impl SessionAudioConsumerFactoryProxyInterface for SessionAudioConsumerFactoryProxy {
fn r#create_audio_consumer(
&self,
mut session_id: u64,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
(session_id, audio_consumer_request),
0x6fab96f988e7d7fb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct SessionAudioConsumerFactoryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SessionAudioConsumerFactoryEventStream {}
impl futures::stream::FusedStream for SessionAudioConsumerFactoryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SessionAudioConsumerFactoryEventStream {
type Item = Result<SessionAudioConsumerFactoryEvent, 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(SessionAudioConsumerFactoryEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SessionAudioConsumerFactoryEvent {}
impl SessionAudioConsumerFactoryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SessionAudioConsumerFactoryEvent, 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: <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct SessionAudioConsumerFactoryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SessionAudioConsumerFactoryRequestStream {}
impl futures::stream::FusedStream for SessionAudioConsumerFactoryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SessionAudioConsumerFactoryRequestStream {
type Protocol = SessionAudioConsumerFactoryMarker;
type ControlHandle = SessionAudioConsumerFactoryControlHandle;
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 {
SessionAudioConsumerFactoryControlHandle { 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 SessionAudioConsumerFactoryRequestStream {
type Item = Result<SessionAudioConsumerFactoryRequest, 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 SessionAudioConsumerFactoryRequestStream 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 {
0x6fab96f988e7d7fb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(SessionAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SessionAudioConsumerFactoryControlHandle {
inner: this.inner.clone(),
};
Ok(SessionAudioConsumerFactoryRequest::CreateAudioConsumer {session_id: req.session_id,
audio_consumer_request: req.audio_consumer_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SessionAudioConsumerFactoryRequest {
CreateAudioConsumer {
session_id: u64,
audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
control_handle: SessionAudioConsumerFactoryControlHandle,
},
}
impl SessionAudioConsumerFactoryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_consumer(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<AudioConsumerMarker>,
SessionAudioConsumerFactoryControlHandle,
)> {
if let SessionAudioConsumerFactoryRequest::CreateAudioConsumer {
session_id,
audio_consumer_request,
control_handle,
} = self
{
Some((session_id, audio_consumer_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SessionAudioConsumerFactoryRequest::CreateAudioConsumer { .. } => {
"create_audio_consumer"
}
}
}
}
#[derive(Debug, Clone)]
pub struct SessionAudioConsumerFactoryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SessionAudioConsumerFactoryControlHandle {
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 SessionAudioConsumerFactoryControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SimpleStreamSinkMarker;
impl fidl::endpoints::ProtocolMarker for SimpleStreamSinkMarker {
type Proxy = SimpleStreamSinkProxy;
type RequestStream = SimpleStreamSinkRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SimpleStreamSinkSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SimpleStreamSink";
}
pub trait SimpleStreamSinkProxyInterface: Send + Sync {
fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SimpleStreamSinkSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SimpleStreamSinkSynchronousProxy {
type Proxy = SimpleStreamSinkProxy;
type Protocol = SimpleStreamSinkMarker;
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 SimpleStreamSinkSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SimpleStreamSinkMarker 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<SimpleStreamSinkEvent, fidl::Error> {
SimpleStreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#discard_all_packets(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct SimpleStreamSinkProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SimpleStreamSinkProxy {
type Protocol = SimpleStreamSinkMarker;
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 SimpleStreamSinkProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SimpleStreamSinkEventStream {
SimpleStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
SimpleStreamSinkProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
SimpleStreamSinkProxyInterface::r#remove_payload_buffer(self, id)
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SimpleStreamSinkProxyInterface::r#send_packet(self, packet)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
SimpleStreamSinkProxyInterface::r#send_packet_no_reply(self, packet)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
SimpleStreamSinkProxyInterface::r#end_of_stream(self)
}
pub fn r#discard_all_packets(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SimpleStreamSinkProxyInterface::r#discard_all_packets(self)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
SimpleStreamSinkProxyInterface::r#discard_all_packets_no_reply(self)
}
}
impl SimpleStreamSinkProxyInterface for SimpleStreamSinkProxy {
fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
type SendPacketResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
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,
0x67cddd607442775f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
type DiscardAllPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
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,
0x6f4dad7af2917665,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct SimpleStreamSinkEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SimpleStreamSinkEventStream {}
impl futures::stream::FusedStream for SimpleStreamSinkEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SimpleStreamSinkEventStream {
type Item = Result<SimpleStreamSinkEvent, 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(SimpleStreamSinkEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SimpleStreamSinkEvent {}
impl SimpleStreamSinkEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SimpleStreamSinkEvent, 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:
<SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SimpleStreamSinkRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SimpleStreamSinkRequestStream {}
impl futures::stream::FusedStream for SimpleStreamSinkRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SimpleStreamSinkRequestStream {
type Protocol = SimpleStreamSinkMarker;
type ControlHandle = SimpleStreamSinkControlHandle;
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 {
SimpleStreamSinkControlHandle { 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 SimpleStreamSinkRequestStream {
type Item = Result<SimpleStreamSinkRequest, 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 SimpleStreamSinkRequestStream 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 {
0x3b3a37fc34fe5b56 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::AddPayloadBuffer {
id: req.id,
payload_buffer: req.payload_buffer,
control_handle,
})
}
0x5d1e4f74c3658262 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetRemovePayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::RemovePayloadBuffer {
id: req.id,
control_handle,
})
}
0x67cddd607442775f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::SendPacket {
packet: req.packet,
responder: SimpleStreamSinkSendPacketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x8d9b8b413ceba9d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketNoReplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::SendPacketNoReply {
packet: req.packet,
control_handle,
})
}
0x6180fd6f7e793b71 => {
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 =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::EndOfStream { control_handle })
}
0x6f4dad7af2917665 => {
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 =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::DiscardAllPackets {
responder: SimpleStreamSinkDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x50d36d0d23081bc4 => {
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 =
SimpleStreamSinkControlHandle { inner: this.inner.clone() };
Ok(SimpleStreamSinkRequest::DiscardAllPacketsNoReply { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SimpleStreamSinkRequest {
AddPayloadBuffer {
id: u32,
payload_buffer: fidl::Vmo,
control_handle: SimpleStreamSinkControlHandle,
},
RemovePayloadBuffer { id: u32, control_handle: SimpleStreamSinkControlHandle },
SendPacket { packet: StreamPacket, responder: SimpleStreamSinkSendPacketResponder },
SendPacketNoReply { packet: StreamPacket, control_handle: SimpleStreamSinkControlHandle },
EndOfStream { control_handle: SimpleStreamSinkControlHandle },
DiscardAllPackets { responder: SimpleStreamSinkDiscardAllPacketsResponder },
DiscardAllPacketsNoReply { control_handle: SimpleStreamSinkControlHandle },
}
impl SimpleStreamSinkRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_payload_buffer(
self,
) -> Option<(u32, fidl::Vmo, SimpleStreamSinkControlHandle)> {
if let SimpleStreamSinkRequest::AddPayloadBuffer { id, payload_buffer, control_handle } =
self
{
Some((id, payload_buffer, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_payload_buffer(self) -> Option<(u32, SimpleStreamSinkControlHandle)> {
if let SimpleStreamSinkRequest::RemovePayloadBuffer { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet(self) -> Option<(StreamPacket, SimpleStreamSinkSendPacketResponder)> {
if let SimpleStreamSinkRequest::SendPacket { packet, responder } = self {
Some((packet, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet_no_reply(
self,
) -> Option<(StreamPacket, SimpleStreamSinkControlHandle)> {
if let SimpleStreamSinkRequest::SendPacketNoReply { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_end_of_stream(self) -> Option<(SimpleStreamSinkControlHandle)> {
if let SimpleStreamSinkRequest::EndOfStream { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets(self) -> Option<(SimpleStreamSinkDiscardAllPacketsResponder)> {
if let SimpleStreamSinkRequest::DiscardAllPackets { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets_no_reply(self) -> Option<(SimpleStreamSinkControlHandle)> {
if let SimpleStreamSinkRequest::DiscardAllPacketsNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SimpleStreamSinkRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
SimpleStreamSinkRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
SimpleStreamSinkRequest::SendPacket { .. } => "send_packet",
SimpleStreamSinkRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
SimpleStreamSinkRequest::EndOfStream { .. } => "end_of_stream",
SimpleStreamSinkRequest::DiscardAllPackets { .. } => "discard_all_packets",
SimpleStreamSinkRequest::DiscardAllPacketsNoReply { .. } => {
"discard_all_packets_no_reply"
}
}
}
}
#[derive(Debug, Clone)]
pub struct SimpleStreamSinkControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SimpleStreamSinkControlHandle {
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 SimpleStreamSinkControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SimpleStreamSinkSendPacketResponder {
control_handle: std::mem::ManuallyDrop<SimpleStreamSinkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SimpleStreamSinkSendPacketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SimpleStreamSinkSendPacketResponder {
type ControlHandle = SimpleStreamSinkControlHandle;
fn control_handle(&self) -> &SimpleStreamSinkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SimpleStreamSinkSendPacketResponder {
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,
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SimpleStreamSinkDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop<SimpleStreamSinkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SimpleStreamSinkDiscardAllPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SimpleStreamSinkDiscardAllPacketsResponder {
type ControlHandle = SimpleStreamSinkControlHandle;
fn control_handle(&self) -> &SimpleStreamSinkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SimpleStreamSinkDiscardAllPacketsResponder {
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,
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StreamBufferSetMarker;
impl fidl::endpoints::ProtocolMarker for StreamBufferSetMarker {
type Proxy = StreamBufferSetProxy;
type RequestStream = StreamBufferSetRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StreamBufferSetSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) StreamBufferSet";
}
pub trait StreamBufferSetProxyInterface: Send + Sync {
fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StreamBufferSetSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StreamBufferSetSynchronousProxy {
type Proxy = StreamBufferSetProxy;
type Protocol = StreamBufferSetMarker;
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 StreamBufferSetSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StreamBufferSetMarker 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<StreamBufferSetEvent, fidl::Error> {
StreamBufferSetEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StreamBufferSetProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StreamBufferSetProxy {
type Protocol = StreamBufferSetMarker;
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 StreamBufferSetProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StreamBufferSetEventStream {
StreamBufferSetEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
StreamBufferSetProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
}
pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
StreamBufferSetProxyInterface::r#remove_payload_buffer(self, id)
}
}
impl StreamBufferSetProxyInterface for StreamBufferSetProxy {
fn r#add_payload_buffer(
&self,
mut id: u32,
mut payload_buffer: fidl::Vmo,
) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
(id, payload_buffer),
0x3b3a37fc34fe5b56,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
(id,),
0x5d1e4f74c3658262,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StreamBufferSetEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StreamBufferSetEventStream {}
impl futures::stream::FusedStream for StreamBufferSetEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StreamBufferSetEventStream {
type Item = Result<StreamBufferSetEvent, 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(StreamBufferSetEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StreamBufferSetEvent {}
impl StreamBufferSetEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StreamBufferSetEvent, 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:
<StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StreamBufferSetRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StreamBufferSetRequestStream {}
impl futures::stream::FusedStream for StreamBufferSetRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StreamBufferSetRequestStream {
type Protocol = StreamBufferSetMarker;
type ControlHandle = StreamBufferSetControlHandle;
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 {
StreamBufferSetControlHandle { 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 StreamBufferSetRequestStream {
type Item = Result<StreamBufferSetRequest, 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 StreamBufferSetRequestStream 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 {
0x3b3a37fc34fe5b56 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamBufferSetControlHandle { inner: this.inner.clone() };
Ok(StreamBufferSetRequest::AddPayloadBuffer {
id: req.id,
payload_buffer: req.payload_buffer,
control_handle,
})
}
0x5d1e4f74c3658262 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamBufferSetRemovePayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamBufferSetControlHandle { inner: this.inner.clone() };
Ok(StreamBufferSetRequest::RemovePayloadBuffer {
id: req.id,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StreamBufferSetRequest {
AddPayloadBuffer {
id: u32,
payload_buffer: fidl::Vmo,
control_handle: StreamBufferSetControlHandle,
},
RemovePayloadBuffer { id: u32, control_handle: StreamBufferSetControlHandle },
}
impl StreamBufferSetRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, StreamBufferSetControlHandle)> {
if let StreamBufferSetRequest::AddPayloadBuffer { id, payload_buffer, control_handle } =
self
{
Some((id, payload_buffer, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_payload_buffer(self) -> Option<(u32, StreamBufferSetControlHandle)> {
if let StreamBufferSetRequest::RemovePayloadBuffer { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StreamBufferSetRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
StreamBufferSetRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
}
}
}
#[derive(Debug, Clone)]
pub struct StreamBufferSetControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StreamBufferSetControlHandle {
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 StreamBufferSetControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StreamProcessorMarker;
impl fidl::endpoints::ProtocolMarker for StreamProcessorMarker {
type Proxy = StreamProcessorProxy;
type RequestStream = StreamProcessorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StreamProcessorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) StreamProcessor";
}
pub trait StreamProcessorProxyInterface: Send + Sync {
fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error>;
fn r#set_input_buffer_partial_settings(
&self,
input_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error>;
fn r#set_output_buffer_partial_settings(
&self,
output_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error>;
fn r#complete_output_buffer_partial_settings(
&self,
buffer_lifetime_ordinal: u64,
) -> Result<(), fidl::Error>;
fn r#flush_end_of_stream_and_close_stream(
&self,
stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error>;
fn r#close_current_stream(
&self,
stream_lifetime_ordinal: u64,
release_input_buffers: bool,
release_output_buffers: bool,
) -> Result<(), fidl::Error>;
type SyncResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#sync(&self) -> Self::SyncResponseFut;
fn r#recycle_output_packet(
&self,
available_output_packet: &PacketHeader,
) -> Result<(), fidl::Error>;
fn r#queue_input_format_details(
&self,
stream_lifetime_ordinal: u64,
format_details: &FormatDetails,
) -> Result<(), fidl::Error>;
fn r#queue_input_packet(&self, packet: &Packet) -> Result<(), fidl::Error>;
fn r#queue_input_end_of_stream(&self, stream_lifetime_ordinal: u64) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StreamProcessorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StreamProcessorSynchronousProxy {
type Proxy = StreamProcessorProxy;
type Protocol = StreamProcessorMarker;
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 StreamProcessorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StreamProcessorMarker 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<StreamProcessorEvent, fidl::Error> {
StreamProcessorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3940929617dbf02b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_input_buffer_partial_settings(
&self,
mut input_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorSetInputBufferPartialSettingsRequest>(
(&mut input_settings,),
0xb02e0663a40e4c4,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_output_buffer_partial_settings(
&self,
mut output_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorSetOutputBufferPartialSettingsRequest>(
(&mut output_settings,),
0x118bb8c819a7bbbb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#complete_output_buffer_partial_settings(
&self,
mut buffer_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
(buffer_lifetime_ordinal,),
0x50529e5c680ae3ab,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#flush_end_of_stream_and_close_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(
(stream_lifetime_ordinal,),
0x2b62c3e26d0667e6,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#close_current_stream(
&self,
mut stream_lifetime_ordinal: u64,
mut release_input_buffers: bool,
mut release_output_buffers: bool,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorCloseCurrentStreamRequest>(
(stream_lifetime_ordinal, release_input_buffers, release_output_buffers),
0x1d8a67522170ca07,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#sync(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x4b3e44300b0ec6aa,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#recycle_output_packet(
&self,
mut available_output_packet: &PacketHeader,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorRecycleOutputPacketRequest>(
(available_output_packet,),
0x32763632b94e0bd5,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#queue_input_format_details(
&self,
mut stream_lifetime_ordinal: u64,
mut format_details: &FormatDetails,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputFormatDetailsRequest>(
(stream_lifetime_ordinal, format_details),
0x170dc0979d52231,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputPacketRequest>(
(packet,),
0x47173d2652d9df3b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#queue_input_end_of_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputEndOfStreamRequest>(
(stream_lifetime_ordinal,),
0x2051b6ad00f20b37,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StreamProcessorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StreamProcessorProxy {
type Protocol = StreamProcessorMarker;
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 StreamProcessorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StreamProcessorEventStream {
StreamProcessorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#enable_on_stream_failed(self)
}
pub fn r#set_input_buffer_partial_settings(
&self,
mut input_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#set_input_buffer_partial_settings(self, input_settings)
}
pub fn r#set_output_buffer_partial_settings(
&self,
mut output_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#set_output_buffer_partial_settings(self, output_settings)
}
pub fn r#complete_output_buffer_partial_settings(
&self,
mut buffer_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#complete_output_buffer_partial_settings(
self,
buffer_lifetime_ordinal,
)
}
pub fn r#flush_end_of_stream_and_close_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#flush_end_of_stream_and_close_stream(
self,
stream_lifetime_ordinal,
)
}
pub fn r#close_current_stream(
&self,
mut stream_lifetime_ordinal: u64,
mut release_input_buffers: bool,
mut release_output_buffers: bool,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#close_current_stream(
self,
stream_lifetime_ordinal,
release_input_buffers,
release_output_buffers,
)
}
pub fn r#sync(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
StreamProcessorProxyInterface::r#sync(self)
}
pub fn r#recycle_output_packet(
&self,
mut available_output_packet: &PacketHeader,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#recycle_output_packet(self, available_output_packet)
}
pub fn r#queue_input_format_details(
&self,
mut stream_lifetime_ordinal: u64,
mut format_details: &FormatDetails,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#queue_input_format_details(
self,
stream_lifetime_ordinal,
format_details,
)
}
pub fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#queue_input_packet(self, packet)
}
pub fn r#queue_input_end_of_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
StreamProcessorProxyInterface::r#queue_input_end_of_stream(self, stream_lifetime_ordinal)
}
}
impl StreamProcessorProxyInterface for StreamProcessorProxy {
fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3940929617dbf02b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_input_buffer_partial_settings(
&self,
mut input_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorSetInputBufferPartialSettingsRequest>(
(&mut input_settings,),
0xb02e0663a40e4c4,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_output_buffer_partial_settings(
&self,
mut output_settings: StreamBufferPartialSettings,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorSetOutputBufferPartialSettingsRequest>(
(&mut output_settings,),
0x118bb8c819a7bbbb,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#complete_output_buffer_partial_settings(
&self,
mut buffer_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
(buffer_lifetime_ordinal,),
0x50529e5c680ae3ab,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#flush_end_of_stream_and_close_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(
(stream_lifetime_ordinal,),
0x2b62c3e26d0667e6,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#close_current_stream(
&self,
mut stream_lifetime_ordinal: u64,
mut release_input_buffers: bool,
mut release_output_buffers: bool,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorCloseCurrentStreamRequest>(
(stream_lifetime_ordinal, release_input_buffers, release_output_buffers),
0x1d8a67522170ca07,
fidl::encoding::DynamicFlags::empty(),
)
}
type SyncResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#sync(&self) -> Self::SyncResponseFut {
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,
0x4b3e44300b0ec6aa,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x4b3e44300b0ec6aa,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#recycle_output_packet(
&self,
mut available_output_packet: &PacketHeader,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorRecycleOutputPacketRequest>(
(available_output_packet,),
0x32763632b94e0bd5,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#queue_input_format_details(
&self,
mut stream_lifetime_ordinal: u64,
mut format_details: &FormatDetails,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputFormatDetailsRequest>(
(stream_lifetime_ordinal, format_details),
0x170dc0979d52231,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputPacketRequest>(
(packet,),
0x47173d2652d9df3b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#queue_input_end_of_stream(
&self,
mut stream_lifetime_ordinal: u64,
) -> Result<(), fidl::Error> {
self.client.send::<StreamProcessorQueueInputEndOfStreamRequest>(
(stream_lifetime_ordinal,),
0x2051b6ad00f20b37,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StreamProcessorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StreamProcessorEventStream {}
impl futures::stream::FusedStream for StreamProcessorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StreamProcessorEventStream {
type Item = Result<StreamProcessorEvent, 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(StreamProcessorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StreamProcessorEvent {
OnStreamFailed {
stream_lifetime_ordinal: u64,
error: StreamError,
},
OnInputConstraints {
input_constraints: StreamBufferConstraints,
},
OnOutputConstraints {
output_config: StreamOutputConstraints,
},
OnOutputFormat {
output_format: StreamOutputFormat,
},
OnOutputPacket {
output_packet: Packet,
error_detected_before: bool,
error_detected_during: bool,
},
OnOutputEndOfStream {
stream_lifetime_ordinal: u64,
error_detected_before: bool,
},
OnFreeInputPacket {
free_input_packet: PacketHeader,
},
}
impl StreamProcessorEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_stream_failed(self) -> Option<(u64, StreamError)> {
if let StreamProcessorEvent::OnStreamFailed { stream_lifetime_ordinal, error } = self {
Some((stream_lifetime_ordinal, error))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_input_constraints(self) -> Option<StreamBufferConstraints> {
if let StreamProcessorEvent::OnInputConstraints { input_constraints } = self {
Some((input_constraints))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_output_constraints(self) -> Option<StreamOutputConstraints> {
if let StreamProcessorEvent::OnOutputConstraints { output_config } = self {
Some((output_config))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_output_format(self) -> Option<StreamOutputFormat> {
if let StreamProcessorEvent::OnOutputFormat { output_format } = self {
Some((output_format))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_output_packet(self) -> Option<(Packet, bool, bool)> {
if let StreamProcessorEvent::OnOutputPacket {
output_packet,
error_detected_before,
error_detected_during,
} = self
{
Some((output_packet, error_detected_before, error_detected_during))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_output_end_of_stream(self) -> Option<(u64, bool)> {
if let StreamProcessorEvent::OnOutputEndOfStream {
stream_lifetime_ordinal,
error_detected_before,
} = self
{
Some((stream_lifetime_ordinal, error_detected_before))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_free_input_packet(self) -> Option<PacketHeader> {
if let StreamProcessorEvent::OnFreeInputPacket { free_input_packet } = self {
Some((free_input_packet))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StreamProcessorEvent, 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 {
0x77ccf70bb061cf8e => {
let mut out = fidl::new_empty!(
StreamProcessorOnStreamFailedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnStreamFailedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnStreamFailed {
stream_lifetime_ordinal: out.stream_lifetime_ordinal,
error: out.error,
}))
}
0x211da9966a8ca0 => {
let mut out = fidl::new_empty!(
StreamProcessorOnInputConstraintsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnInputConstraintsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnInputConstraints {
input_constraints: out.input_constraints,
}))
}
0x40d8234504c170f3 => {
let mut out = fidl::new_empty!(
StreamProcessorOnOutputConstraintsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputConstraintsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnOutputConstraints { output_config: out.output_config }))
}
0x131b77ae120360bc => {
let mut out = fidl::new_empty!(
StreamProcessorOnOutputFormatRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputFormatRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnOutputFormat { output_format: out.output_format }))
}
0x5c2029be1090ce93 => {
let mut out = fidl::new_empty!(
StreamProcessorOnOutputPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputPacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnOutputPacket {
output_packet: out.output_packet,
error_detected_before: out.error_detected_before,
error_detected_during: out.error_detected_during,
}))
}
0x3bb65d237cfa50e6 => {
let mut out = fidl::new_empty!(
StreamProcessorOnOutputEndOfStreamRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputEndOfStreamRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnOutputEndOfStream {
stream_lifetime_ordinal: out.stream_lifetime_ordinal,
error_detected_before: out.error_detected_before,
}))
}
0xeef799b28708bbd => {
let mut out = fidl::new_empty!(
StreamProcessorOnFreeInputPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnFreeInputPacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamProcessorEvent::OnFreeInputPacket {
free_input_packet: out.free_input_packet,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StreamProcessorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StreamProcessorRequestStream {}
impl futures::stream::FusedStream for StreamProcessorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StreamProcessorRequestStream {
type Protocol = StreamProcessorMarker;
type ControlHandle = StreamProcessorControlHandle;
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 {
StreamProcessorControlHandle { 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 StreamProcessorRequestStream {
type Item = Result<StreamProcessorRequest, 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 StreamProcessorRequestStream 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 {
0x3940929617dbf02b => {
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 =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::EnableOnStreamFailed { control_handle })
}
0xb02e0663a40e4c4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorSetInputBufferPartialSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorSetInputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::SetInputBufferPartialSettings {
input_settings: req.input_settings,
control_handle,
})
}
0x118bb8c819a7bbbb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorSetOutputBufferPartialSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorSetOutputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::SetOutputBufferPartialSettings {
output_settings: req.output_settings,
control_handle,
})
}
0x50529e5c680ae3ab => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorCompleteOutputBufferPartialSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::CompleteOutputBufferPartialSettings {
buffer_lifetime_ordinal: req.buffer_lifetime_ordinal,
control_handle,
})
}
0x2b62c3e26d0667e6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorFlushEndOfStreamAndCloseStreamRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::FlushEndOfStreamAndCloseStream {
stream_lifetime_ordinal: req.stream_lifetime_ordinal,
control_handle,
})
}
0x1d8a67522170ca07 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorCloseCurrentStreamRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorCloseCurrentStreamRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::CloseCurrentStream {
stream_lifetime_ordinal: req.stream_lifetime_ordinal,
release_input_buffers: req.release_input_buffers,
release_output_buffers: req.release_output_buffers,
control_handle,
})
}
0x4b3e44300b0ec6aa => {
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 =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::Sync {
responder: StreamProcessorSyncResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x32763632b94e0bd5 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorRecycleOutputPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorRecycleOutputPacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::RecycleOutputPacket {
available_output_packet: req.available_output_packet,
control_handle,
})
}
0x170dc0979d52231 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorQueueInputFormatDetailsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputFormatDetailsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::QueueInputFormatDetails {
stream_lifetime_ordinal: req.stream_lifetime_ordinal,
format_details: req.format_details,
control_handle,
})
}
0x47173d2652d9df3b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorQueueInputPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputPacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::QueueInputPacket {
packet: req.packet,
control_handle,
})
}
0x2051b6ad00f20b37 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamProcessorQueueInputEndOfStreamRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputEndOfStreamRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamProcessorControlHandle { inner: this.inner.clone() };
Ok(StreamProcessorRequest::QueueInputEndOfStream {
stream_lifetime_ordinal: req.stream_lifetime_ordinal,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StreamProcessorRequest {
EnableOnStreamFailed { control_handle: StreamProcessorControlHandle },
SetInputBufferPartialSettings {
input_settings: StreamBufferPartialSettings,
control_handle: StreamProcessorControlHandle,
},
SetOutputBufferPartialSettings {
output_settings: StreamBufferPartialSettings,
control_handle: StreamProcessorControlHandle,
},
CompleteOutputBufferPartialSettings {
buffer_lifetime_ordinal: u64,
control_handle: StreamProcessorControlHandle,
},
FlushEndOfStreamAndCloseStream {
stream_lifetime_ordinal: u64,
control_handle: StreamProcessorControlHandle,
},
CloseCurrentStream {
stream_lifetime_ordinal: u64,
release_input_buffers: bool,
release_output_buffers: bool,
control_handle: StreamProcessorControlHandle,
},
Sync { responder: StreamProcessorSyncResponder },
RecycleOutputPacket {
available_output_packet: PacketHeader,
control_handle: StreamProcessorControlHandle,
},
QueueInputFormatDetails {
stream_lifetime_ordinal: u64,
format_details: FormatDetails,
control_handle: StreamProcessorControlHandle,
},
QueueInputPacket { packet: Packet, control_handle: StreamProcessorControlHandle },
QueueInputEndOfStream {
stream_lifetime_ordinal: u64,
control_handle: StreamProcessorControlHandle,
},
}
impl StreamProcessorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_enable_on_stream_failed(self) -> Option<(StreamProcessorControlHandle)> {
if let StreamProcessorRequest::EnableOnStreamFailed { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_input_buffer_partial_settings(
self,
) -> Option<(StreamBufferPartialSettings, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::SetInputBufferPartialSettings {
input_settings,
control_handle,
} = self
{
Some((input_settings, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_output_buffer_partial_settings(
self,
) -> Option<(StreamBufferPartialSettings, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::SetOutputBufferPartialSettings {
output_settings,
control_handle,
} = self
{
Some((output_settings, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_complete_output_buffer_partial_settings(
self,
) -> Option<(u64, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::CompleteOutputBufferPartialSettings {
buffer_lifetime_ordinal,
control_handle,
} = self
{
Some((buffer_lifetime_ordinal, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_flush_end_of_stream_and_close_stream(
self,
) -> Option<(u64, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::FlushEndOfStreamAndCloseStream {
stream_lifetime_ordinal,
control_handle,
} = self
{
Some((stream_lifetime_ordinal, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_close_current_stream(
self,
) -> Option<(u64, bool, bool, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::CloseCurrentStream {
stream_lifetime_ordinal,
release_input_buffers,
release_output_buffers,
control_handle,
} = self
{
Some((
stream_lifetime_ordinal,
release_input_buffers,
release_output_buffers,
control_handle,
))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_sync(self) -> Option<(StreamProcessorSyncResponder)> {
if let StreamProcessorRequest::Sync { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_recycle_output_packet(
self,
) -> Option<(PacketHeader, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::RecycleOutputPacket {
available_output_packet,
control_handle,
} = self
{
Some((available_output_packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_queue_input_format_details(
self,
) -> Option<(u64, FormatDetails, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::QueueInputFormatDetails {
stream_lifetime_ordinal,
format_details,
control_handle,
} = self
{
Some((stream_lifetime_ordinal, format_details, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_queue_input_packet(self) -> Option<(Packet, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::QueueInputPacket { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_queue_input_end_of_stream(self) -> Option<(u64, StreamProcessorControlHandle)> {
if let StreamProcessorRequest::QueueInputEndOfStream {
stream_lifetime_ordinal,
control_handle,
} = self
{
Some((stream_lifetime_ordinal, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StreamProcessorRequest::EnableOnStreamFailed { .. } => "enable_on_stream_failed",
StreamProcessorRequest::SetInputBufferPartialSettings { .. } => {
"set_input_buffer_partial_settings"
}
StreamProcessorRequest::SetOutputBufferPartialSettings { .. } => {
"set_output_buffer_partial_settings"
}
StreamProcessorRequest::CompleteOutputBufferPartialSettings { .. } => {
"complete_output_buffer_partial_settings"
}
StreamProcessorRequest::FlushEndOfStreamAndCloseStream { .. } => {
"flush_end_of_stream_and_close_stream"
}
StreamProcessorRequest::CloseCurrentStream { .. } => "close_current_stream",
StreamProcessorRequest::Sync { .. } => "sync",
StreamProcessorRequest::RecycleOutputPacket { .. } => "recycle_output_packet",
StreamProcessorRequest::QueueInputFormatDetails { .. } => "queue_input_format_details",
StreamProcessorRequest::QueueInputPacket { .. } => "queue_input_packet",
StreamProcessorRequest::QueueInputEndOfStream { .. } => "queue_input_end_of_stream",
}
}
}
#[derive(Debug, Clone)]
pub struct StreamProcessorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StreamProcessorControlHandle {
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 StreamProcessorControlHandle {
pub fn send_on_stream_failed(
&self,
mut stream_lifetime_ordinal: u64,
mut error: StreamError,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnStreamFailedRequest>(
(stream_lifetime_ordinal, error),
0,
0x77ccf70bb061cf8e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_input_constraints(
&self,
mut input_constraints: &StreamBufferConstraints,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnInputConstraintsRequest>(
(input_constraints,),
0,
0x211da9966a8ca0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_output_constraints(
&self,
mut output_config: &StreamOutputConstraints,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnOutputConstraintsRequest>(
(output_config,),
0,
0x40d8234504c170f3,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_output_format(
&self,
mut output_format: &StreamOutputFormat,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnOutputFormatRequest>(
(output_format,),
0,
0x131b77ae120360bc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_output_packet(
&self,
mut output_packet: &Packet,
mut error_detected_before: bool,
mut error_detected_during: bool,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnOutputPacketRequest>(
(output_packet, error_detected_before, error_detected_during),
0,
0x5c2029be1090ce93,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_output_end_of_stream(
&self,
mut stream_lifetime_ordinal: u64,
mut error_detected_before: bool,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnOutputEndOfStreamRequest>(
(stream_lifetime_ordinal, error_detected_before),
0,
0x3bb65d237cfa50e6,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_free_input_packet(
&self,
mut free_input_packet: &PacketHeader,
) -> Result<(), fidl::Error> {
self.inner.send::<StreamProcessorOnFreeInputPacketRequest>(
(free_input_packet,),
0,
0xeef799b28708bbd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StreamProcessorSyncResponder {
control_handle: std::mem::ManuallyDrop<StreamProcessorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StreamProcessorSyncResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StreamProcessorSyncResponder {
type ControlHandle = StreamProcessorControlHandle;
fn control_handle(&self) -> &StreamProcessorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StreamProcessorSyncResponder {
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,
0x4b3e44300b0ec6aa,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StreamSinkMarker;
impl fidl::endpoints::ProtocolMarker for StreamSinkMarker {
type Proxy = StreamSinkProxy;
type RequestStream = StreamSinkRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StreamSinkSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
}
pub trait StreamSinkProxyInterface: Send + Sync {
type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StreamSinkSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StreamSinkSynchronousProxy {
type Proxy = StreamSinkProxy;
type Protocol = StreamSinkMarker;
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 StreamSinkSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StreamSinkMarker 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<StreamSinkEvent, fidl::Error> {
StreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#discard_all_packets(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StreamSinkProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StreamSinkProxy {
type Protocol = StreamSinkMarker;
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 StreamSinkProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StreamSinkEventStream {
StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#send_packet(
&self,
mut packet: &StreamPacket,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
StreamSinkProxyInterface::r#send_packet(self, packet)
}
pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
StreamSinkProxyInterface::r#send_packet_no_reply(self, packet)
}
pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
StreamSinkProxyInterface::r#end_of_stream(self)
}
pub fn r#discard_all_packets(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
StreamSinkProxyInterface::r#discard_all_packets(self)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
StreamSinkProxyInterface::r#discard_all_packets_no_reply(self)
}
}
impl StreamSinkProxyInterface for StreamSinkProxy {
type SendPacketResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
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,
0x67cddd607442775f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
(packet,),
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSinkSendPacketNoReplyRequest>(
(packet,),
0x8d9b8b413ceba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6180fd6f7e793b71,
fidl::encoding::DynamicFlags::empty(),
)
}
type DiscardAllPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
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,
0x6f4dad7af2917665,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x50d36d0d23081bc4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StreamSinkEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StreamSinkEventStream {}
impl futures::stream::FusedStream for StreamSinkEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StreamSinkEventStream {
type Item = Result<StreamSinkEvent, 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(StreamSinkEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StreamSinkEvent {}
impl StreamSinkEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StreamSinkEvent, 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: <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StreamSinkRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StreamSinkRequestStream {}
impl futures::stream::FusedStream for StreamSinkRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StreamSinkRequestStream {
type Protocol = StreamSinkMarker;
type ControlHandle = StreamSinkControlHandle;
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 {
StreamSinkControlHandle { 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 StreamSinkRequestStream {
type Item = Result<StreamSinkRequest, 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 StreamSinkRequestStream 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 {
0x67cddd607442775f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
Ok(StreamSinkRequest::SendPacket {
packet: req.packet,
responder: StreamSinkSendPacketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x8d9b8b413ceba9d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamSinkSendPacketNoReplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
Ok(StreamSinkRequest::SendPacketNoReply {
packet: req.packet,
control_handle,
})
}
0x6180fd6f7e793b71 => {
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 = StreamSinkControlHandle { inner: this.inner.clone() };
Ok(StreamSinkRequest::EndOfStream { control_handle })
}
0x6f4dad7af2917665 => {
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 = StreamSinkControlHandle { inner: this.inner.clone() };
Ok(StreamSinkRequest::DiscardAllPackets {
responder: StreamSinkDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x50d36d0d23081bc4 => {
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 = StreamSinkControlHandle { inner: this.inner.clone() };
Ok(StreamSinkRequest::DiscardAllPacketsNoReply { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StreamSinkRequest {
SendPacket { packet: StreamPacket, responder: StreamSinkSendPacketResponder },
SendPacketNoReply { packet: StreamPacket, control_handle: StreamSinkControlHandle },
EndOfStream { control_handle: StreamSinkControlHandle },
DiscardAllPackets { responder: StreamSinkDiscardAllPacketsResponder },
DiscardAllPacketsNoReply { control_handle: StreamSinkControlHandle },
}
impl StreamSinkRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet(self) -> Option<(StreamPacket, StreamSinkSendPacketResponder)> {
if let StreamSinkRequest::SendPacket { packet, responder } = self {
Some((packet, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_packet_no_reply(self) -> Option<(StreamPacket, StreamSinkControlHandle)> {
if let StreamSinkRequest::SendPacketNoReply { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_end_of_stream(self) -> Option<(StreamSinkControlHandle)> {
if let StreamSinkRequest::EndOfStream { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets(self) -> Option<(StreamSinkDiscardAllPacketsResponder)> {
if let StreamSinkRequest::DiscardAllPackets { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets_no_reply(self) -> Option<(StreamSinkControlHandle)> {
if let StreamSinkRequest::DiscardAllPacketsNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StreamSinkRequest::SendPacket { .. } => "send_packet",
StreamSinkRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
StreamSinkRequest::EndOfStream { .. } => "end_of_stream",
StreamSinkRequest::DiscardAllPackets { .. } => "discard_all_packets",
StreamSinkRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
}
}
}
#[derive(Debug, Clone)]
pub struct StreamSinkControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StreamSinkControlHandle {
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 StreamSinkControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StreamSinkSendPacketResponder {
control_handle: std::mem::ManuallyDrop<StreamSinkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StreamSinkSendPacketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StreamSinkSendPacketResponder {
type ControlHandle = StreamSinkControlHandle;
fn control_handle(&self) -> &StreamSinkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StreamSinkSendPacketResponder {
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,
0x67cddd607442775f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StreamSinkDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop<StreamSinkControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StreamSinkDiscardAllPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StreamSinkDiscardAllPacketsResponder {
type ControlHandle = StreamSinkControlHandle;
fn control_handle(&self) -> &StreamSinkControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StreamSinkDiscardAllPacketsResponder {
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,
0x6f4dad7af2917665,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StreamSourceMarker;
impl fidl::endpoints::ProtocolMarker for StreamSourceMarker {
type Proxy = StreamSourceProxy;
type RequestStream = StreamSourceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StreamSourceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) StreamSource";
}
pub trait StreamSourceProxyInterface: Send + Sync {
fn r#release_packet(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StreamSourceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StreamSourceSynchronousProxy {
type Proxy = StreamSourceProxy;
type Protocol = StreamSourceMarker;
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 StreamSourceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StreamSourceMarker 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<StreamSourceEvent, fidl::Error> {
StreamSourceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSourceReleasePacketRequest>(
(packet,),
0x7a7b57f0f7d9e4bb,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#discard_all_packets(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35f9d721e905b831,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StreamSourceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StreamSourceProxy {
type Protocol = StreamSourceMarker;
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 StreamSourceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StreamSourceEventStream {
StreamSourceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
StreamSourceProxyInterface::r#release_packet(self, packet)
}
pub fn r#discard_all_packets(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
StreamSourceProxyInterface::r#discard_all_packets(self)
}
pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
StreamSourceProxyInterface::r#discard_all_packets_no_reply(self)
}
}
impl StreamSourceProxyInterface for StreamSourceProxy {
fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.client.send::<StreamSourceReleasePacketRequest>(
(packet,),
0x7a7b57f0f7d9e4bb,
fidl::encoding::DynamicFlags::empty(),
)
}
type DiscardAllPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
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,
0x27afd605e97b09d2,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x35f9d721e905b831,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StreamSourceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StreamSourceEventStream {}
impl futures::stream::FusedStream for StreamSourceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StreamSourceEventStream {
type Item = Result<StreamSourceEvent, 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(StreamSourceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StreamSourceEvent {
OnPacketProduced { packet: StreamPacket },
OnEndOfStream {},
}
impl StreamSourceEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_packet_produced(self) -> Option<StreamPacket> {
if let StreamSourceEvent::OnPacketProduced { packet } = self {
Some((packet))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_end_of_stream(self) -> Option<()> {
if let StreamSourceEvent::OnEndOfStream {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StreamSourceEvent, 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 {
0x6bbe69746a3c8bd9 => {
let mut out = fidl::new_empty!(
StreamSourceOnPacketProducedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceOnPacketProducedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamSourceEvent::OnPacketProduced { packet: out.packet }))
}
0x550e69b41d03e2c2 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((StreamSourceEvent::OnEndOfStream {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StreamSourceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StreamSourceRequestStream {}
impl futures::stream::FusedStream for StreamSourceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StreamSourceRequestStream {
type Protocol = StreamSourceMarker;
type ControlHandle = StreamSourceControlHandle;
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 {
StreamSourceControlHandle { 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 StreamSourceRequestStream {
type Item = Result<StreamSourceRequest, 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 StreamSourceRequestStream 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 {
0x7a7b57f0f7d9e4bb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StreamSourceReleasePacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceReleasePacketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StreamSourceControlHandle { inner: this.inner.clone() };
Ok(StreamSourceRequest::ReleasePacket {
packet: req.packet,
control_handle,
})
}
0x27afd605e97b09d2 => {
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 =
StreamSourceControlHandle { inner: this.inner.clone() };
Ok(StreamSourceRequest::DiscardAllPackets {
responder: StreamSourceDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35f9d721e905b831 => {
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 =
StreamSourceControlHandle { inner: this.inner.clone() };
Ok(StreamSourceRequest::DiscardAllPacketsNoReply { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StreamSourceRequest {
ReleasePacket {
packet: StreamPacket,
control_handle: StreamSourceControlHandle,
},
DiscardAllPackets {
responder: StreamSourceDiscardAllPacketsResponder,
},
DiscardAllPacketsNoReply {
control_handle: StreamSourceControlHandle,
},
}
impl StreamSourceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_release_packet(self) -> Option<(StreamPacket, StreamSourceControlHandle)> {
if let StreamSourceRequest::ReleasePacket { packet, control_handle } = self {
Some((packet, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets(self) -> Option<(StreamSourceDiscardAllPacketsResponder)> {
if let StreamSourceRequest::DiscardAllPackets { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_discard_all_packets_no_reply(self) -> Option<(StreamSourceControlHandle)> {
if let StreamSourceRequest::DiscardAllPacketsNoReply { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StreamSourceRequest::ReleasePacket { .. } => "release_packet",
StreamSourceRequest::DiscardAllPackets { .. } => "discard_all_packets",
StreamSourceRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
}
}
}
#[derive(Debug, Clone)]
pub struct StreamSourceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StreamSourceControlHandle {
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 StreamSourceControlHandle {
pub fn send_on_packet_produced(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
self.inner.send::<StreamSourceOnPacketProducedRequest>(
(packet,),
0,
0x6bbe69746a3c8bd9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x550e69b41d03e2c2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StreamSourceDiscardAllPacketsResponder {
control_handle: std::mem::ManuallyDrop<StreamSourceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StreamSourceDiscardAllPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StreamSourceDiscardAllPacketsResponder {
type ControlHandle = StreamSourceControlHandle;
fn control_handle(&self) -> &StreamSourceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StreamSourceDiscardAllPacketsResponder {
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,
0x27afd605e97b09d2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsageAudioConsumerFactoryMarker;
impl fidl::endpoints::ProtocolMarker for UsageAudioConsumerFactoryMarker {
type Proxy = UsageAudioConsumerFactoryProxy;
type RequestStream = UsageAudioConsumerFactoryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsageAudioConsumerFactorySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.UsageAudioConsumerFactory";
}
impl fidl::endpoints::DiscoverableProtocolMarker for UsageAudioConsumerFactoryMarker {}
pub trait UsageAudioConsumerFactoryProxyInterface: Send + Sync {
fn r#create_audio_consumer(
&self,
usage: AudioRenderUsage,
audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsageAudioConsumerFactorySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsageAudioConsumerFactorySynchronousProxy {
type Proxy = UsageAudioConsumerFactoryProxy;
type Protocol = UsageAudioConsumerFactoryMarker;
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 UsageAudioConsumerFactorySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<UsageAudioConsumerFactoryMarker 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<UsageAudioConsumerFactoryEvent, fidl::Error> {
UsageAudioConsumerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_audio_consumer(
&self,
mut usage: AudioRenderUsage,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(
(usage, audio_consumer_request),
0x4d975ca9b8f625a3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct UsageAudioConsumerFactoryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsageAudioConsumerFactoryProxy {
type Protocol = UsageAudioConsumerFactoryMarker;
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 UsageAudioConsumerFactoryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsageAudioConsumerFactoryEventStream {
UsageAudioConsumerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_audio_consumer(
&self,
mut usage: AudioRenderUsage,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
UsageAudioConsumerFactoryProxyInterface::r#create_audio_consumer(
self,
usage,
audio_consumer_request,
)
}
}
impl UsageAudioConsumerFactoryProxyInterface for UsageAudioConsumerFactoryProxy {
fn r#create_audio_consumer(
&self,
mut usage: AudioRenderUsage,
mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(
(usage, audio_consumer_request),
0x4d975ca9b8f625a3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct UsageAudioConsumerFactoryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsageAudioConsumerFactoryEventStream {}
impl futures::stream::FusedStream for UsageAudioConsumerFactoryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsageAudioConsumerFactoryEventStream {
type Item = Result<UsageAudioConsumerFactoryEvent, 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(UsageAudioConsumerFactoryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsageAudioConsumerFactoryEvent {}
impl UsageAudioConsumerFactoryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsageAudioConsumerFactoryEvent, 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:
<UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsageAudioConsumerFactoryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsageAudioConsumerFactoryRequestStream {}
impl futures::stream::FusedStream for UsageAudioConsumerFactoryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsageAudioConsumerFactoryRequestStream {
type Protocol = UsageAudioConsumerFactoryMarker;
type ControlHandle = UsageAudioConsumerFactoryControlHandle;
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 {
UsageAudioConsumerFactoryControlHandle { 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 UsageAudioConsumerFactoryRequestStream {
type Item = Result<UsageAudioConsumerFactoryRequest, 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 UsageAudioConsumerFactoryRequestStream 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 {
0x4d975ca9b8f625a3 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(UsageAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = UsageAudioConsumerFactoryControlHandle {
inner: this.inner.clone(),
};
Ok(UsageAudioConsumerFactoryRequest::CreateAudioConsumer {usage: req.usage,
audio_consumer_request: req.audio_consumer_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsageAudioConsumerFactoryRequest {
CreateAudioConsumer {
usage: AudioRenderUsage,
audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
control_handle: UsageAudioConsumerFactoryControlHandle,
},
}
impl UsageAudioConsumerFactoryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_audio_consumer(
self,
) -> Option<(
AudioRenderUsage,
fidl::endpoints::ServerEnd<AudioConsumerMarker>,
UsageAudioConsumerFactoryControlHandle,
)> {
if let UsageAudioConsumerFactoryRequest::CreateAudioConsumer {
usage,
audio_consumer_request,
control_handle,
} = self
{
Some((usage, audio_consumer_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsageAudioConsumerFactoryRequest::CreateAudioConsumer { .. } => "create_audio_consumer",
}
}
}
#[derive(Debug, Clone)]
pub struct UsageAudioConsumerFactoryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsageAudioConsumerFactoryControlHandle {
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 UsageAudioConsumerFactoryControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsageGainListenerMarker;
impl fidl::endpoints::ProtocolMarker for UsageGainListenerMarker {
type Proxy = UsageGainListenerProxy;
type RequestStream = UsageGainListenerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsageGainListenerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) UsageGainListener";
}
pub trait UsageGainListenerProxyInterface: Send + Sync {
type OnGainMuteChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_gain_mute_changed(
&self,
muted: bool,
gain_dbfs: f32,
) -> Self::OnGainMuteChangedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsageGainListenerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsageGainListenerSynchronousProxy {
type Proxy = UsageGainListenerProxy;
type Protocol = UsageGainListenerMarker;
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 UsageGainListenerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<UsageGainListenerMarker 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<UsageGainListenerEvent, fidl::Error> {
UsageGainListenerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_gain_mute_changed(
&self,
mut muted: bool,
mut gain_dbfs: f32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<UsageGainListenerOnGainMuteChangedRequest, fidl::encoding::EmptyPayload>(
(muted, gain_dbfs),
0x681570258eac3a8d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct UsageGainListenerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsageGainListenerProxy {
type Protocol = UsageGainListenerMarker;
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 UsageGainListenerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsageGainListenerEventStream {
UsageGainListenerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_gain_mute_changed(
&self,
mut muted: bool,
mut gain_dbfs: f32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
UsageGainListenerProxyInterface::r#on_gain_mute_changed(self, muted, gain_dbfs)
}
}
impl UsageGainListenerProxyInterface for UsageGainListenerProxy {
type OnGainMuteChangedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_gain_mute_changed(
&self,
mut muted: bool,
mut gain_dbfs: f32,
) -> Self::OnGainMuteChangedResponseFut {
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,
0x681570258eac3a8d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<UsageGainListenerOnGainMuteChangedRequest, ()>(
(muted, gain_dbfs),
0x681570258eac3a8d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct UsageGainListenerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsageGainListenerEventStream {}
impl futures::stream::FusedStream for UsageGainListenerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsageGainListenerEventStream {
type Item = Result<UsageGainListenerEvent, 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(UsageGainListenerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsageGainListenerEvent {}
impl UsageGainListenerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsageGainListenerEvent, 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:
<UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsageGainListenerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsageGainListenerRequestStream {}
impl futures::stream::FusedStream for UsageGainListenerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsageGainListenerRequestStream {
type Protocol = UsageGainListenerMarker;
type ControlHandle = UsageGainListenerControlHandle;
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 {
UsageGainListenerControlHandle { 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 UsageGainListenerRequestStream {
type Item = Result<UsageGainListenerRequest, 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 UsageGainListenerRequestStream 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 {
0x681570258eac3a8d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
UsageGainListenerOnGainMuteChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageGainListenerOnGainMuteChangedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
UsageGainListenerControlHandle { inner: this.inner.clone() };
Ok(UsageGainListenerRequest::OnGainMuteChanged {
muted: req.muted,
gain_dbfs: req.gain_dbfs,
responder: UsageGainListenerOnGainMuteChangedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsageGainListenerRequest {
OnGainMuteChanged {
muted: bool,
gain_dbfs: f32,
responder: UsageGainListenerOnGainMuteChangedResponder,
},
}
impl UsageGainListenerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_gain_mute_changed(
self,
) -> Option<(bool, f32, UsageGainListenerOnGainMuteChangedResponder)> {
if let UsageGainListenerRequest::OnGainMuteChanged { muted, gain_dbfs, responder } = self {
Some((muted, gain_dbfs, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsageGainListenerRequest::OnGainMuteChanged { .. } => "on_gain_mute_changed",
}
}
}
#[derive(Debug, Clone)]
pub struct UsageGainListenerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsageGainListenerControlHandle {
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 UsageGainListenerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct UsageGainListenerOnGainMuteChangedResponder {
control_handle: std::mem::ManuallyDrop<UsageGainListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for UsageGainListenerOnGainMuteChangedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for UsageGainListenerOnGainMuteChangedResponder {
type ControlHandle = UsageGainListenerControlHandle;
fn control_handle(&self) -> &UsageGainListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl UsageGainListenerOnGainMuteChangedResponder {
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,
0x681570258eac3a8d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsageGainReporterMarker;
impl fidl::endpoints::ProtocolMarker for UsageGainReporterMarker {
type Proxy = UsageGainReporterProxy;
type RequestStream = UsageGainReporterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsageGainReporterSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.UsageGainReporter";
}
impl fidl::endpoints::DiscoverableProtocolMarker for UsageGainReporterMarker {}
pub trait UsageGainReporterProxyInterface: Send + Sync {
fn r#register_listener(
&self,
device_unique_id: &str,
usage: &Usage,
usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsageGainReporterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsageGainReporterSynchronousProxy {
type Proxy = UsageGainReporterProxy;
type Protocol = UsageGainReporterMarker;
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 UsageGainReporterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<UsageGainReporterMarker 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<UsageGainReporterEvent, fidl::Error> {
UsageGainReporterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register_listener(
&self,
mut device_unique_id: &str,
mut usage: &Usage,
mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageGainReporterRegisterListenerRequest>(
(device_unique_id, usage, usage_gain_listener),
0x767107c168c226af,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct UsageGainReporterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsageGainReporterProxy {
type Protocol = UsageGainReporterMarker;
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 UsageGainReporterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsageGainReporterEventStream {
UsageGainReporterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#register_listener(
&self,
mut device_unique_id: &str,
mut usage: &Usage,
mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
) -> Result<(), fidl::Error> {
UsageGainReporterProxyInterface::r#register_listener(
self,
device_unique_id,
usage,
usage_gain_listener,
)
}
}
impl UsageGainReporterProxyInterface for UsageGainReporterProxy {
fn r#register_listener(
&self,
mut device_unique_id: &str,
mut usage: &Usage,
mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageGainReporterRegisterListenerRequest>(
(device_unique_id, usage, usage_gain_listener),
0x767107c168c226af,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct UsageGainReporterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsageGainReporterEventStream {}
impl futures::stream::FusedStream for UsageGainReporterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsageGainReporterEventStream {
type Item = Result<UsageGainReporterEvent, 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(UsageGainReporterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsageGainReporterEvent {}
impl UsageGainReporterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsageGainReporterEvent, 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:
<UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsageGainReporterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsageGainReporterRequestStream {}
impl futures::stream::FusedStream for UsageGainReporterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsageGainReporterRequestStream {
type Protocol = UsageGainReporterMarker;
type ControlHandle = UsageGainReporterControlHandle;
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 {
UsageGainReporterControlHandle { 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 UsageGainReporterRequestStream {
type Item = Result<UsageGainReporterRequest, 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 UsageGainReporterRequestStream 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 {
0x767107c168c226af => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
UsageGainReporterRegisterListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageGainReporterRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
UsageGainReporterControlHandle { inner: this.inner.clone() };
Ok(UsageGainReporterRequest::RegisterListener {
device_unique_id: req.device_unique_id,
usage: req.usage,
usage_gain_listener: req.usage_gain_listener,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsageGainReporterRequest {
RegisterListener {
device_unique_id: String,
usage: Usage,
usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
control_handle: UsageGainReporterControlHandle,
},
}
impl UsageGainReporterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register_listener(
self,
) -> Option<(
String,
Usage,
fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
UsageGainReporterControlHandle,
)> {
if let UsageGainReporterRequest::RegisterListener {
device_unique_id,
usage,
usage_gain_listener,
control_handle,
} = self
{
Some((device_unique_id, usage, usage_gain_listener, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsageGainReporterRequest::RegisterListener { .. } => "register_listener",
}
}
}
#[derive(Debug, Clone)]
pub struct UsageGainReporterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsageGainReporterControlHandle {
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 UsageGainReporterControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsageReporterMarker;
impl fidl::endpoints::ProtocolMarker for UsageReporterMarker {
type Proxy = UsageReporterProxy;
type RequestStream = UsageReporterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsageReporterSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.UsageReporter";
}
impl fidl::endpoints::DiscoverableProtocolMarker for UsageReporterMarker {}
pub trait UsageReporterProxyInterface: Send + Sync {
fn r#watch(
&self,
usage: &Usage,
usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsageReporterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsageReporterSynchronousProxy {
type Proxy = UsageReporterProxy;
type Protocol = UsageReporterMarker;
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 UsageReporterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <UsageReporterMarker 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<UsageReporterEvent, fidl::Error> {
UsageReporterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch(
&self,
mut usage: &Usage,
mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageReporterWatchRequest>(
(usage, usage_watcher),
0x769e6fb17075c959,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct UsageReporterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsageReporterProxy {
type Protocol = UsageReporterMarker;
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 UsageReporterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsageReporterEventStream {
UsageReporterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch(
&self,
mut usage: &Usage,
mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
) -> Result<(), fidl::Error> {
UsageReporterProxyInterface::r#watch(self, usage, usage_watcher)
}
}
impl UsageReporterProxyInterface for UsageReporterProxy {
fn r#watch(
&self,
mut usage: &Usage,
mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<UsageReporterWatchRequest>(
(usage, usage_watcher),
0x769e6fb17075c959,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct UsageReporterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsageReporterEventStream {}
impl futures::stream::FusedStream for UsageReporterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsageReporterEventStream {
type Item = Result<UsageReporterEvent, 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(UsageReporterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsageReporterEvent {}
impl UsageReporterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsageReporterEvent, 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: <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsageReporterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsageReporterRequestStream {}
impl futures::stream::FusedStream for UsageReporterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsageReporterRequestStream {
type Protocol = UsageReporterMarker;
type ControlHandle = UsageReporterControlHandle;
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 {
UsageReporterControlHandle { 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 UsageReporterRequestStream {
type Item = Result<UsageReporterRequest, 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 UsageReporterRequestStream 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 {
0x769e6fb17075c959 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
UsageReporterWatchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageReporterWatchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
UsageReporterControlHandle { inner: this.inner.clone() };
Ok(UsageReporterRequest::Watch {
usage: req.usage,
usage_watcher: req.usage_watcher,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsageReporterRequest {
Watch {
usage: Usage,
usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
control_handle: UsageReporterControlHandle,
},
}
impl UsageReporterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch(
self,
) -> Option<(Usage, fidl::endpoints::ClientEnd<UsageWatcherMarker>, UsageReporterControlHandle)>
{
if let UsageReporterRequest::Watch { usage, usage_watcher, control_handle } = self {
Some((usage, usage_watcher, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsageReporterRequest::Watch { .. } => "watch",
}
}
}
#[derive(Debug, Clone)]
pub struct UsageReporterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsageReporterControlHandle {
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 UsageReporterControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsageWatcherMarker;
impl fidl::endpoints::ProtocolMarker for UsageWatcherMarker {
type Proxy = UsageWatcherProxy;
type RequestStream = UsageWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsageWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) UsageWatcher";
}
pub trait UsageWatcherProxyInterface: Send + Sync {
type OnStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_state_changed(
&self,
usage: &Usage,
state: &UsageState,
) -> Self::OnStateChangedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsageWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsageWatcherSynchronousProxy {
type Proxy = UsageWatcherProxy;
type Protocol = UsageWatcherMarker;
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 UsageWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <UsageWatcherMarker 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<UsageWatcherEvent, fidl::Error> {
UsageWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_state_changed(
&self,
mut usage: &Usage,
mut state: &UsageState,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<UsageWatcherOnStateChangedRequest, fidl::encoding::EmptyPayload>(
(usage, state),
0x5b955c5768ec75c5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct UsageWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsageWatcherProxy {
type Protocol = UsageWatcherMarker;
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 UsageWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsageWatcherEventStream {
UsageWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_state_changed(
&self,
mut usage: &Usage,
mut state: &UsageState,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
UsageWatcherProxyInterface::r#on_state_changed(self, usage, state)
}
}
impl UsageWatcherProxyInterface for UsageWatcherProxy {
type OnStateChangedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_state_changed(
&self,
mut usage: &Usage,
mut state: &UsageState,
) -> Self::OnStateChangedResponseFut {
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,
0x5b955c5768ec75c5,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<UsageWatcherOnStateChangedRequest, ()>(
(usage, state),
0x5b955c5768ec75c5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct UsageWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsageWatcherEventStream {}
impl futures::stream::FusedStream for UsageWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsageWatcherEventStream {
type Item = Result<UsageWatcherEvent, 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(UsageWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsageWatcherEvent {}
impl UsageWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsageWatcherEvent, 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: <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsageWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsageWatcherRequestStream {}
impl futures::stream::FusedStream for UsageWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsageWatcherRequestStream {
type Protocol = UsageWatcherMarker;
type ControlHandle = UsageWatcherControlHandle;
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 {
UsageWatcherControlHandle { 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 UsageWatcherRequestStream {
type Item = Result<UsageWatcherRequest, 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 UsageWatcherRequestStream 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 {
0x5b955c5768ec75c5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
UsageWatcherOnStateChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageWatcherOnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
UsageWatcherControlHandle { inner: this.inner.clone() };
Ok(UsageWatcherRequest::OnStateChanged {
usage: req.usage,
state: req.state,
responder: UsageWatcherOnStateChangedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsageWatcherRequest {
OnStateChanged {
usage: Usage,
state: UsageState,
responder: UsageWatcherOnStateChangedResponder,
},
}
impl UsageWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_state_changed(
self,
) -> Option<(Usage, UsageState, UsageWatcherOnStateChangedResponder)> {
if let UsageWatcherRequest::OnStateChanged { usage, state, responder } = self {
Some((usage, state, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsageWatcherRequest::OnStateChanged { .. } => "on_state_changed",
}
}
}
#[derive(Debug, Clone)]
pub struct UsageWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsageWatcherControlHandle {
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 UsageWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct UsageWatcherOnStateChangedResponder {
control_handle: std::mem::ManuallyDrop<UsageWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for UsageWatcherOnStateChangedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for UsageWatcherOnStateChangedResponder {
type ControlHandle = UsageWatcherControlHandle;
fn control_handle(&self) -> &UsageWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl UsageWatcherOnStateChangedResponder {
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,
0x5b955c5768ec75c5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AudioConsumerStartFlags {
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::ValueTypeMarker for AudioConsumerStartFlags {
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 AudioConsumerStartFlags
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioConsumerStartFlags
{
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioGainInfoFlags {
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::ValueTypeMarker for AudioGainInfoFlags {
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 AudioGainInfoFlags
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainInfoFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioGainValidFlags {
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::ValueTypeMarker for AudioGainValidFlags {
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 AudioGainValidFlags
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainValidFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AacAudioObjectType {
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 AacAudioObjectType {
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 AacAudioObjectType
{
#[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 AacAudioObjectType {
#[inline(always)]
fn new_empty() -> Self {
Self::Mpeg2AacLc
}
#[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 AacChannelMode {
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 AacChannelMode {
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 AacChannelMode {
#[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 AacChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Mono
}
#[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 AacVariableBitRate {
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 AacVariableBitRate {
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 AacVariableBitRate
{
#[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 AacVariableBitRate {
#[inline(always)]
fn new_empty() -> Self {
Self::V1
}
#[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 AudioBitrateMode {
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 AudioBitrateMode {
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 AudioBitrateMode
{
#[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 AudioBitrateMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Unspecified
}
#[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 AudioCaptureUsage {
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 AudioCaptureUsage {
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 AudioCaptureUsage
{
#[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 AudioCaptureUsage {
#[inline(always)]
fn new_empty() -> Self {
Self::Background
}
#[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 AudioChannelId {
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 AudioChannelId {
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 AudioChannelId {
#[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 AudioChannelId {
#[inline(always)]
fn new_empty() -> Self {
Self::Skip
}
#[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 AudioOutputRoutingPolicy {
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 AudioOutputRoutingPolicy {
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 AudioOutputRoutingPolicy
{
#[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 AudioOutputRoutingPolicy
{
#[inline(always)]
fn new_empty() -> Self {
Self::AllPluggedOutputs
}
#[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 AudioPcmMode {
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 AudioPcmMode {
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 AudioPcmMode {
#[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 AudioPcmMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Linear
}
#[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 AudioRenderUsage {
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 AudioRenderUsage {
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 AudioRenderUsage
{
#[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 AudioRenderUsage {
#[inline(always)]
fn new_empty() -> Self {
Self::Background
}
#[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 AudioSampleFormat {
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 AudioSampleFormat {
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 AudioSampleFormat
{
#[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 AudioSampleFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::Unsigned8
}
#[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 Behavior {
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 Behavior {
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 Behavior {
#[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 Behavior {
#[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::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for CodecProfile {
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 CodecProfile {
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 CodecProfile {
#[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 CodecProfile {
#[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 ColorSpace {
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 ColorSpace {
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 ColorSpace {
#[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 ColorSpace {
#[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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Lc3FrameDuration {
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 Lc3FrameDuration {
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 Lc3FrameDuration
{
#[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 Lc3FrameDuration {
#[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 SbcAllocation {
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 SbcAllocation {
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 SbcAllocation {
#[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 SbcAllocation {
#[inline(always)]
fn new_empty() -> Self {
Self::AllocLoudness
}
#[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 SbcBlockCount {
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 SbcBlockCount {
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 SbcBlockCount {
#[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 SbcBlockCount {
#[inline(always)]
fn new_empty() -> Self {
Self::BlockCount4
}
#[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 SbcChannelMode {
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 SbcChannelMode {
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 SbcChannelMode {
#[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 SbcChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Mono
}
#[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 SbcSubBands {
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 SbcSubBands {
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 SbcSubBands {
#[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 SbcSubBands {
#[inline(always)]
fn new_empty() -> Self {
Self::SubBands4
}
#[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 StreamError {
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 StreamError {
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 StreamError {
#[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 StreamError {
#[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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VideoColorSpace {
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 VideoColorSpace {
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 VideoColorSpace
{
#[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 VideoColorSpace {
#[inline(always)]
fn new_empty() -> Self {
Self::Invalid
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AacConstantBitRate {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacConstantBitRate {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacConstantBitRate, D>
for &AacConstantBitRate
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacConstantBitRate>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AacConstantBitRate)
.write_unaligned((self as *const AacConstantBitRate).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<AacConstantBitRate, 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::<AacConstantBitRate>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacConstantBitRate {
#[inline(always)]
fn new_empty() -> Self {
Self { bit_rate: fidl::new_empty!(u32, 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, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AacEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacEncoderSettings {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacEncoderSettings, D>
for &AacEncoderSettings
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacEncoderSettings>(offset);
fidl::encoding::Encode::<AacEncoderSettings, D>::encode(
(
<AacTransport as fidl::encoding::ValueTypeMarker>::borrow(&self.transport),
<AacChannelMode as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_mode),
<AacBitRate as fidl::encoding::ValueTypeMarker>::borrow(&self.bit_rate),
<AacAudioObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.aot),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AacTransport, D>,
T1: fidl::encoding::Encode<AacChannelMode, D>,
T2: fidl::encoding::Encode<AacBitRate, D>,
T3: fidl::encoding::Encode<AacAudioObjectType, D>,
> fidl::encoding::Encode<AacEncoderSettings, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacEncoderSettings>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacEncoderSettings {
#[inline(always)]
fn new_empty() -> Self {
Self {
transport: fidl::new_empty!(AacTransport, D),
channel_mode: fidl::new_empty!(AacChannelMode, D),
bit_rate: fidl::new_empty!(AacBitRate, D),
aot: fidl::new_empty!(AacAudioObjectType, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
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 + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(AacTransport, D, &mut self.transport, decoder, offset + 0, _depth)?;
fidl::decode!(AacChannelMode, D, &mut self.channel_mode, decoder, offset + 16, _depth)?;
fidl::decode!(AacBitRate, D, &mut self.bit_rate, decoder, offset + 24, _depth)?;
fidl::decode!(AacAudioObjectType, D, &mut self.aot, decoder, offset + 40, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AacTransportAdts {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacTransportAdts {
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<AacTransportAdts, D>
for &AacTransportAdts
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacTransportAdts>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportAdts {
#[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 AacTransportLatm {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacTransportLatm {
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<AacTransportLatm, D>
for &AacTransportLatm
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacTransportLatm>(offset);
fidl::encoding::Encode::<AacTransportLatm, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mux_config_present),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<AacTransportLatm, 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::<AacTransportLatm>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportLatm {
#[inline(always)]
fn new_empty() -> Self {
Self { mux_config_present: 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.mux_config_present, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AacTransportRaw {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacTransportRaw {
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<AacTransportRaw, D>
for &AacTransportRaw
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacTransportRaw>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportRaw {
#[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 ActivityReporterWatchCaptureActivityResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchCaptureActivityResponse {
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<ActivityReporterWatchCaptureActivityResponse, D>
for &ActivityReporterWatchCaptureActivityResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ActivityReporterWatchCaptureActivityResponse>(offset);
fidl::encoding::Encode::<ActivityReporterWatchCaptureActivityResponse, D>::encode(
(
<fidl::encoding::Vector<AudioCaptureUsage, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioCaptureUsage, 4>, D>,
> fidl::encoding::Encode<ActivityReporterWatchCaptureActivityResponse, 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::<ActivityReporterWatchCaptureActivityResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ActivityReporterWatchCaptureActivityResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioCaptureUsage, 4>, 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<AudioCaptureUsage, 4>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ActivityReporterWatchRenderActivityResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchRenderActivityResponse {
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<ActivityReporterWatchRenderActivityResponse, D>
for &ActivityReporterWatchRenderActivityResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ActivityReporterWatchRenderActivityResponse>(offset);
fidl::encoding::Encode::<ActivityReporterWatchRenderActivityResponse, D>::encode(
(
<fidl::encoding::Vector<AudioRenderUsage, 5> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioRenderUsage, 5>, D>,
> fidl::encoding::Encode<ActivityReporterWatchRenderActivityResponse, 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::<ActivityReporterWatchRenderActivityResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ActivityReporterWatchRenderActivityResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioRenderUsage, 5>, 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<AudioRenderUsage, 5>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCapturerBindGainControlRequest {
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 AudioCapturerBindGainControlRequest {
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<
AudioCapturerBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCapturerBindGainControlRequest
{
#[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::<AudioCapturerBindGainControlRequest>(offset);
fidl::encoding::Encode::<
AudioCapturerBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.gain_control_request,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCapturerBindGainControlRequest,
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::<AudioCapturerBindGainControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerBindGainControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
gain_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.gain_control_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerCaptureAtRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerCaptureAtRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
#[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<AudioCapturerCaptureAtRequest, D>
for &AudioCapturerCaptureAtRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerCaptureAtRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioCapturerCaptureAtRequest)
.write_unaligned((self as *const AudioCapturerCaptureAtRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<AudioCapturerCaptureAtRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerCaptureAtRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerCaptureAtRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
payload_buffer_id: fidl::new_empty!(u32, D),
payload_offset: fidl::new_empty!(u32, D),
frames: fidl::new_empty!(u32, 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, 12);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerCaptureAtResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerCaptureAtResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCapturerCaptureAtResponse, D>
for &AudioCapturerCaptureAtResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerCaptureAtResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioCapturerCaptureAtResponse)
.write_unaligned((self as *const AudioCapturerCaptureAtResponse).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
fidl::encoding::Encode<AudioCapturerCaptureAtResponse, 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::<AudioCapturerCaptureAtResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerCaptureAtResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { captured_packet: fidl::new_empty!(StreamPacket, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCapturerGetReferenceClockResponse {
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 AudioCapturerGetReferenceClockResponse {
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<
AudioCapturerGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCapturerGetReferenceClockResponse
{
#[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::<AudioCapturerGetReferenceClockResponse>(offset);
fidl::encoding::Encode::<
AudioCapturerGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.reference_clock,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCapturerGetReferenceClockResponse,
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::<AudioCapturerGetReferenceClockResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerGetReferenceClockResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerGetStreamTypeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerGetStreamTypeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCapturerGetStreamTypeResponse, D>
for &AudioCapturerGetStreamTypeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerGetStreamTypeResponse>(offset);
fidl::encoding::Encode::<AudioCapturerGetStreamTypeResponse, D>::encode(
(<StreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamType, D>>
fidl::encoding::Encode<AudioCapturerGetStreamTypeResponse, 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::<AudioCapturerGetStreamTypeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerGetStreamTypeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { stream_type: fidl::new_empty!(StreamType, 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!(StreamType, D, &mut self.stream_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerSetPcmStreamTypeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetPcmStreamTypeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCapturerSetPcmStreamTypeRequest, D>
for &AudioCapturerSetPcmStreamTypeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerSetPcmStreamTypeRequest>(offset);
fidl::encoding::Encode::<AudioCapturerSetPcmStreamTypeRequest, D>::encode(
(<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioStreamType, D>>
fidl::encoding::Encode<AudioCapturerSetPcmStreamTypeRequest, 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::<AudioCapturerSetPcmStreamTypeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerSetPcmStreamTypeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { stream_type: fidl::new_empty!(AudioStreamType, 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!(AudioStreamType, D, &mut self.stream_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCapturerSetReferenceClockRequest {
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 AudioCapturerSetReferenceClockRequest {
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<
AudioCapturerSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCapturerSetReferenceClockRequest
{
#[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::<AudioCapturerSetReferenceClockRequest>(offset);
fidl::encoding::Encode::<
AudioCapturerSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.reference_clock,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCapturerSetReferenceClockRequest,
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::<AudioCapturerSetReferenceClockRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCapturerSetReferenceClockRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
reference_clock: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.reference_clock,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerSetUsageRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetUsageRequest {
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<AudioCapturerSetUsageRequest, D> for &AudioCapturerSetUsageRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerSetUsageRequest>(offset);
fidl::encoding::Encode::<AudioCapturerSetUsageRequest, D>::encode(
(<AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioCaptureUsage, D>>
fidl::encoding::Encode<AudioCapturerSetUsageRequest, 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::<AudioCapturerSetUsageRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerSetUsageRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(AudioCaptureUsage, 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!(AudioCaptureUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerStartAsyncCaptureRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerStartAsyncCaptureRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCapturerStartAsyncCaptureRequest, D>
for &AudioCapturerStartAsyncCaptureRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerStartAsyncCaptureRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioCapturerStartAsyncCaptureRequest)
.write_unaligned((self as *const AudioCapturerStartAsyncCaptureRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<AudioCapturerStartAsyncCaptureRequest, 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::<AudioCapturerStartAsyncCaptureRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerStartAsyncCaptureRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { frames_per_packet: fidl::new_empty!(u32, 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, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatAac {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatAac {
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<AudioCompressedFormatAac, D> for &AudioCompressedFormatAac
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCompressedFormatAac>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCompressedFormatAac
{
#[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 AudioCompressedFormatSbc {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatSbc {
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<AudioCompressedFormatSbc, D> for &AudioCompressedFormatSbc
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCompressedFormatSbc>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCompressedFormatSbc
{
#[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::ResourceTypeMarker for AudioConsumerBindVolumeControlRequest {
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 AudioConsumerBindVolumeControlRequest {
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<
AudioConsumerBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioConsumerBindVolumeControlRequest
{
#[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::<AudioConsumerBindVolumeControlRequest>(offset);
fidl::encoding::Encode::<
AudioConsumerBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.volume_control_request,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioConsumerBindVolumeControlRequest,
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::<AudioConsumerBindVolumeControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioConsumerBindVolumeControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
volume_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.volume_control_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioConsumerCreateStreamSinkRequest {
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 AudioConsumerCreateStreamSinkRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
AudioConsumerCreateStreamSinkRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioConsumerCreateStreamSinkRequest
{
#[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::<AudioConsumerCreateStreamSinkRequest>(offset);
fidl::encoding::Encode::<AudioConsumerCreateStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Vector<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffers),
<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
<fidl::encoding::Boxed<Compression> as fidl::encoding::ValueTypeMarker>::borrow(&self.compression),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stream_sink_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Vector<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
16,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<AudioStreamType, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Boxed<Compression>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioConsumerCreateStreamSinkRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[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::<AudioConsumerCreateStreamSinkRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioConsumerCreateStreamSinkRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
buffers: fidl::new_empty!(
fidl::encoding::Vector<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
16,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
stream_type: fidl::new_empty!(
AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
compression: fidl::new_empty!(
fidl::encoding::Boxed<Compression>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
stream_sink_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
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(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
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 + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Vector<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
16,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.buffers,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stream_type,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<Compression>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.compression,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stream_sink_request,
decoder,
offset + 40,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioConsumerSetRateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioConsumerSetRateRequest {
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<AudioConsumerSetRateRequest, D> for &AudioConsumerSetRateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerSetRateRequest>(offset);
fidl::encoding::Encode::<AudioConsumerSetRateRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rate),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<AudioConsumerSetRateRequest, 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::<AudioConsumerSetRateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioConsumerSetRateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { rate: fidl::new_empty!(f32, 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!(f32, D, &mut self.rate, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioConsumerStartRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioConsumerStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioConsumerStartRequest, D> for &AudioConsumerStartRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerStartRequest>(offset);
fidl::encoding::Encode::<AudioConsumerStartRequest, D>::encode(
(
<AudioConsumerStartFlags as fidl::encoding::ValueTypeMarker>::borrow(
&self.flags,
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.reference_time),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.media_time),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioConsumerStartFlags, D>,
T1: fidl::encoding::Encode<i64, D>,
T2: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<AudioConsumerStartRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerStartRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioConsumerStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
flags: fidl::new_empty!(AudioConsumerStartFlags, D),
reference_time: fidl::new_empty!(i64, D),
media_time: fidl::new_empty!(i64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(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!(
AudioConsumerStartFlags,
D,
&mut self.flags,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(i64, D, &mut self.reference_time, decoder, offset + 8, _depth)?;
fidl::decode!(i64, D, &mut self.media_time, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioConsumerWatchStatusResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioConsumerWatchStatusResponse {
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<AudioConsumerWatchStatusResponse, D>
for &AudioConsumerWatchStatusResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerWatchStatusResponse>(offset);
fidl::encoding::Encode::<AudioConsumerWatchStatusResponse, D>::encode(
(<AudioConsumerStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioConsumerStatus, D>,
> fidl::encoding::Encode<AudioConsumerWatchStatusResponse, 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::<AudioConsumerWatchStatusResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioConsumerWatchStatusResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(AudioConsumerStatus, 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!(AudioConsumerStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCoreBindUsageVolumeControlRequest {
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 AudioCoreBindUsageVolumeControlRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
AudioCoreBindUsageVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCoreBindUsageVolumeControlRequest
{
#[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::<AudioCoreBindUsageVolumeControlRequest>(offset);
fidl::encoding::Encode::<
AudioCoreBindUsageVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.volume_control,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCoreBindUsageVolumeControlRequest,
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::<AudioCoreBindUsageVolumeControlRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreBindUsageVolumeControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
volume_control: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
Usage,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.volume_control,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioCapturerRequest {
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 AudioCoreCreateAudioCapturerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
AudioCoreCreateAudioCapturerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCoreCreateAudioCapturerRequest
{
#[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::<AudioCoreCreateAudioCapturerRequest>(offset);
fidl::encoding::Encode::<AudioCoreCreateAudioCapturerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.loopback),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_in_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCoreCreateAudioCapturerRequest,
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::<AudioCoreCreateAudioCapturerRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioCapturerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
loopback: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
audio_in_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
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(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
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!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.loopback,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_in_request,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioCapturerWithConfigurationRequest {
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 AudioCoreCreateAudioCapturerWithConfigurationRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
AudioCoreCreateAudioCapturerWithConfigurationRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCoreCreateAudioCapturerWithConfigurationRequest
{
#[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::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(offset);
fidl::encoding::Encode::<AudioCoreCreateAudioCapturerWithConfigurationRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
<AudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_capturer_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<AudioStreamType, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
AudioCapturerConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCoreCreateAudioCapturerWithConfigurationRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioCapturerWithConfigurationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
stream_type: fidl::new_empty!(
AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
configuration: fidl::new_empty!(
AudioCapturerConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect
),
audio_capturer_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
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,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stream_type,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
AudioCapturerConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.configuration,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_capturer_request,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioRendererRequest {
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 AudioCoreCreateAudioRendererRequest {
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<
AudioCoreCreateAudioRendererRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCoreCreateAudioRendererRequest
{
#[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::<AudioCoreCreateAudioRendererRequest>(offset);
fidl::encoding::Encode::<AudioCoreCreateAudioRendererRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_out_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCoreCreateAudioRendererRequest,
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::<AudioCoreCreateAudioRendererRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCoreCreateAudioRendererRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
audio_out_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_out_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreEnableDeviceSettingsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreEnableDeviceSettingsRequest {
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<AudioCoreEnableDeviceSettingsRequest, D>
for &AudioCoreEnableDeviceSettingsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreEnableDeviceSettingsRequest>(offset);
fidl::encoding::Encode::<AudioCoreEnableDeviceSettingsRequest, 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<AudioCoreEnableDeviceSettingsRequest, 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::<AudioCoreEnableDeviceSettingsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreEnableDeviceSettingsRequest
{
#[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 AudioCoreGetDbFromVolumeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolumeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCoreGetDbFromVolumeRequest, D>
for &AudioCoreGetDbFromVolumeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeRequest>(offset);
fidl::encoding::Encode::<AudioCoreGetDbFromVolumeRequest, D>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Usage, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<AudioCoreGetDbFromVolumeRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreGetDbFromVolumeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(Usage, D), volume: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.volume, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreGetDbFromVolumeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolumeResponse {
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<AudioCoreGetDbFromVolumeResponse, D>
for &AudioCoreGetDbFromVolumeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeResponse>(offset);
fidl::encoding::Encode::<AudioCoreGetDbFromVolumeResponse, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<AudioCoreGetDbFromVolumeResponse, 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::<AudioCoreGetDbFromVolumeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreGetDbFromVolumeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { gain_db: fidl::new_empty!(f32, 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!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDbRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDbRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCoreGetVolumeFromDbRequest, D>
for &AudioCoreGetVolumeFromDbRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbRequest>(offset);
fidl::encoding::Encode::<AudioCoreGetVolumeFromDbRequest, D>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Usage, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<AudioCoreGetVolumeFromDbRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreGetVolumeFromDbRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(Usage, D), gain_db: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDbResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDbResponse {
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<AudioCoreGetVolumeFromDbResponse, D>
for &AudioCoreGetVolumeFromDbResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbResponse>(offset);
fidl::encoding::Encode::<AudioCoreGetVolumeFromDbResponse, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<AudioCoreGetVolumeFromDbResponse, 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::<AudioCoreGetVolumeFromDbResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreGetVolumeFromDbResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { volume: fidl::new_empty!(f32, 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!(f32, D, &mut self.volume, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreSetCaptureUsageGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreSetCaptureUsageGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCoreSetCaptureUsageGainRequest, D>
for &AudioCoreSetCaptureUsageGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGainRequest>(offset);
fidl::encoding::Encode::<AudioCoreSetCaptureUsageGainRequest, D>::encode(
(
<AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioCaptureUsage, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<AudioCoreSetCaptureUsageGainRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreSetCaptureUsageGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
usage: fidl::new_empty!(AudioCaptureUsage, D),
gain_db: fidl::new_empty!(f32, 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!(AudioCaptureUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreSetInteractionRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreSetInteractionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCoreSetInteractionRequest, D>
for &AudioCoreSetInteractionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetInteractionRequest>(offset);
fidl::encoding::Encode::<AudioCoreSetInteractionRequest, D>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.active),
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.affected),
<Behavior as fidl::encoding::ValueTypeMarker>::borrow(&self.behavior),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Usage, D>,
T1: fidl::encoding::Encode<Usage, D>,
T2: fidl::encoding::Encode<Behavior, D>,
> fidl::encoding::Encode<AudioCoreSetInteractionRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetInteractionRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreSetInteractionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
active: fidl::new_empty!(Usage, D),
affected: fidl::new_empty!(Usage, D),
behavior: fidl::new_empty!(Behavior, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Usage, D, &mut self.active, decoder, offset + 0, _depth)?;
fidl::decode!(Usage, D, &mut self.affected, decoder, offset + 16, _depth)?;
fidl::decode!(Behavior, D, &mut self.behavior, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCoreSetRenderUsageGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCoreSetRenderUsageGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioCoreSetRenderUsageGainRequest, D>
for &AudioCoreSetRenderUsageGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetRenderUsageGainRequest>(offset);
fidl::encoding::Encode::<AudioCoreSetRenderUsageGainRequest, D>::encode(
(
<AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioRenderUsage, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<AudioCoreSetRenderUsageGainRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCoreSetRenderUsageGainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCoreSetRenderUsageGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(AudioRenderUsage, D), gain_db: fidl::new_empty!(f32, 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!(AudioRenderUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCreateAudioCapturerRequest {
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 AudioCreateAudioCapturerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
AudioCreateAudioCapturerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCreateAudioCapturerRequest
{
#[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::<AudioCreateAudioCapturerRequest>(offset);
fidl::encoding::Encode::<AudioCreateAudioCapturerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_capturer_request),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.loopback),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
AudioCreateAudioCapturerRequest,
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::<AudioCreateAudioCapturerRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCreateAudioCapturerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
audio_capturer_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
loopback: fidl::new_empty!(bool, 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(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_capturer_request,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.loopback,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioCreateAudioRendererRequest {
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 AudioCreateAudioRendererRequest {
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<
AudioCreateAudioRendererRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioCreateAudioRendererRequest
{
#[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::<AudioCreateAudioRendererRequest>(offset);
fidl::encoding::Encode::<AudioCreateAudioRendererRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_renderer_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioCreateAudioRendererRequest,
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::<AudioCreateAudioRendererRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioCreateAudioRendererRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
audio_renderer_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_renderer_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioDeviceEnumeratorAddDeviceByChannelRequest {
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 AudioDeviceEnumeratorAddDeviceByChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
AudioDeviceEnumeratorAddDeviceByChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioDeviceEnumeratorAddDeviceByChannelRequest
{
#[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::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(offset);
fidl::encoding::Encode::<
AudioDeviceEnumeratorAddDeviceByChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.device_name,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_input),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioDeviceEnumeratorAddDeviceByChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioDeviceEnumeratorAddDeviceByChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
device_name: fidl::new_empty!(
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
is_input: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<256>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.device_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.is_input,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 20,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDeviceGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDeviceGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainRequest, D>
for &AudioDeviceEnumeratorGetDeviceGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioDeviceEnumeratorGetDeviceGainRequest).write_unaligned(
(self as *const AudioDeviceEnumeratorGetDeviceGainRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainRequest, 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::<AudioDeviceEnumeratorGetDeviceGainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorGetDeviceGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { device_token: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDeviceGainResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDeviceGainResponse {
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<AudioDeviceEnumeratorGetDeviceGainResponse, D>
for &AudioDeviceEnumeratorGetDeviceGainResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainResponse>(offset);
fidl::encoding::Encode::<AudioDeviceEnumeratorGetDeviceGainResponse, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
<AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<AudioGainInfo, D>,
> fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorGetDeviceGainResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
device_token: fidl::new_empty!(u64, D),
gain_info: fidl::new_empty!(AudioGainInfo, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDevicesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDevicesResponse {
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<AudioDeviceEnumeratorGetDevicesResponse, D>
for &AudioDeviceEnumeratorGetDevicesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDevicesResponse>(offset);
fidl::encoding::Encode::<AudioDeviceEnumeratorGetDevicesResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<AudioDeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<AudioDeviceInfo>, D>,
> fidl::encoding::Encode<AudioDeviceEnumeratorGetDevicesResponse, 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::<AudioDeviceEnumeratorGetDevicesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorGetDevicesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { devices: fidl::new_empty!(fidl::encoding::UnboundedVector<AudioDeviceInfo>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<AudioDeviceInfo>,
D,
&mut self.devices,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
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
}
#[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<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest, D>
for &AudioDeviceEnumeratorOnDefaultDeviceChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioDeviceEnumeratorOnDefaultDeviceChangedRequest)
.write_unaligned(
(self as *const AudioDeviceEnumeratorOnDefaultDeviceChangedRequest).read(),
);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest, D>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
old_default_token: fidl::new_empty!(u64, D),
new_default_token: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceAddedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceAddedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceAddedRequest, D>
for &AudioDeviceEnumeratorOnDeviceAddedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceAddedRequest>(offset);
fidl::encoding::Encode::<AudioDeviceEnumeratorOnDeviceAddedRequest, D>::encode(
(<AudioDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.device),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioDeviceInfo, D>>
fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceAddedRequest, 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::<AudioDeviceEnumeratorOnDeviceAddedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorOnDeviceAddedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { device: fidl::new_empty!(AudioDeviceInfo, 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!(AudioDeviceInfo, D, &mut self.device, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceGainChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceGainChangedRequest {
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<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D>
for &AudioDeviceEnumeratorOnDeviceGainChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(offset);
fidl::encoding::Encode::<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
<AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<AudioGainInfo, D>,
> fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorOnDeviceGainChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
device_token: fidl::new_empty!(u64, D),
gain_info: fidl::new_empty!(AudioGainInfo, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceRemovedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceRemovedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceRemovedRequest, D>
for &AudioDeviceEnumeratorOnDeviceRemovedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioDeviceEnumeratorOnDeviceRemovedRequest).write_unaligned(
(self as *const AudioDeviceEnumeratorOnDeviceRemovedRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceRemovedRequest, 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::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorOnDeviceRemovedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { device_token: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorSetDeviceGainRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorSetDeviceGainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioDeviceEnumeratorSetDeviceGainRequest, D>
for &AudioDeviceEnumeratorSetDeviceGainRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorSetDeviceGainRequest>(offset);
fidl::encoding::Encode::<AudioDeviceEnumeratorSetDeviceGainRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
<AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
<AudioGainValidFlags as fidl::encoding::ValueTypeMarker>::borrow(
&self.valid_flags,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<AudioGainInfo, D>,
T2: fidl::encoding::Encode<AudioGainValidFlags, D>,
> fidl::encoding::Encode<AudioDeviceEnumeratorSetDeviceGainRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceEnumeratorSetDeviceGainRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDeviceEnumeratorSetDeviceGainRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
device_token: fidl::new_empty!(u64, D),
gain_info: fidl::new_empty!(AudioGainInfo, D),
valid_flags: fidl::new_empty!(AudioGainValidFlags, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
fidl::decode!(
AudioGainValidFlags,
D,
&mut self.valid_flags,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDeviceInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDeviceInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioDeviceInfo, D>
for &AudioDeviceInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceInfo>(offset);
fidl::encoding::Encode::<AudioDeviceInfo, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.unique_id,
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.token_id),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_input),
<AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_default),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<AudioGainInfo, D>,
T5: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<AudioDeviceInfo, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDeviceInfo>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 44, depth)?;
self.5.encode(encoder, offset + 52, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioDeviceInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
unique_id: fidl::new_empty!(fidl::encoding::UnboundedString, D),
token_id: fidl::new_empty!(u64, D),
is_input: fidl::new_empty!(bool, D),
gain_info: fidl::new_empty!(AudioGainInfo, D),
is_default: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff0000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.unique_id,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(u64, D, &mut self.token_id, decoder, offset + 32, _depth)?;
fidl::decode!(bool, D, &mut self.is_input, decoder, offset + 40, _depth)?;
fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 44, _depth)?;
fidl::decode!(bool, D, &mut self.is_default, decoder, offset + 52, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioGainInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioGainInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioGainInfo, D>
for &AudioGainInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioGainInfo>(offset);
fidl::encoding::Encode::<AudioGainInfo, D>::encode(
(
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
<AudioGainInfoFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f32, D>,
T1: fidl::encoding::Encode<AudioGainInfoFlags, D>,
> fidl::encoding::Encode<AudioGainInfo, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioGainInfo>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
gain_db: fidl::new_empty!(f32, D),
flags: fidl::new_empty!(AudioGainInfoFlags, 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!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
fidl::decode!(AudioGainInfoFlags, D, &mut self.flags, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRendererBindGainControlRequest {
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 AudioRendererBindGainControlRequest {
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<
AudioRendererBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioRendererBindGainControlRequest
{
#[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::<AudioRendererBindGainControlRequest>(offset);
fidl::encoding::Encode::<
AudioRendererBindGainControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.gain_control_request,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioRendererBindGainControlRequest,
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::<AudioRendererBindGainControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererBindGainControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
gain_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.gain_control_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererEnableMinLeadTimeEventsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererEnableMinLeadTimeEventsRequest {
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<AudioRendererEnableMinLeadTimeEventsRequest, D>
for &AudioRendererEnableMinLeadTimeEventsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererEnableMinLeadTimeEventsRequest>(offset);
fidl::encoding::Encode::<AudioRendererEnableMinLeadTimeEventsRequest, 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<AudioRendererEnableMinLeadTimeEventsRequest, 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::<AudioRendererEnableMinLeadTimeEventsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererEnableMinLeadTimeEventsRequest
{
#[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 AudioRendererGetMinLeadTimeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererGetMinLeadTimeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioRendererGetMinLeadTimeResponse, D>
for &AudioRendererGetMinLeadTimeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererGetMinLeadTimeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererGetMinLeadTimeResponse)
.write_unaligned((self as *const AudioRendererGetMinLeadTimeResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<AudioRendererGetMinLeadTimeResponse, 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::<AudioRendererGetMinLeadTimeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererGetMinLeadTimeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { min_lead_time_nsec: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRendererGetReferenceClockResponse {
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 AudioRendererGetReferenceClockResponse {
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<
AudioRendererGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioRendererGetReferenceClockResponse
{
#[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::<AudioRendererGetReferenceClockResponse>(offset);
fidl::encoding::Encode::<
AudioRendererGetReferenceClockResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.reference_clock,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioRendererGetReferenceClockResponse,
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::<AudioRendererGetReferenceClockResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererGetReferenceClockResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererOnMinLeadTimeChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererOnMinLeadTimeChangedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioRendererOnMinLeadTimeChangedRequest, D>
for &AudioRendererOnMinLeadTimeChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererOnMinLeadTimeChangedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererOnMinLeadTimeChangedRequest).write_unaligned(
(self as *const AudioRendererOnMinLeadTimeChangedRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<AudioRendererOnMinLeadTimeChangedRequest, 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::<AudioRendererOnMinLeadTimeChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererOnMinLeadTimeChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { min_lead_time_nsec: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererPauseResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererPauseResponse {
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
}
#[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<AudioRendererPauseResponse, D> for &AudioRendererPauseResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPauseResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererPauseResponse)
.write_unaligned((self as *const AudioRendererPauseResponse).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<AudioRendererPauseResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPauseResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererPauseResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererPlayNoReplyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayNoReplyRequest {
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
}
#[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<AudioRendererPlayNoReplyRequest, D>
for &AudioRendererPlayNoReplyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayNoReplyRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererPlayNoReplyRequest)
.write_unaligned((self as *const AudioRendererPlayNoReplyRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<AudioRendererPlayNoReplyRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayNoReplyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererPlayNoReplyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererPlayRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayRequest {
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
}
#[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<AudioRendererPlayRequest, D> for &AudioRendererPlayRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererPlayRequest)
.write_unaligned((self as *const AudioRendererPlayRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<AudioRendererPlayRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererPlayRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererPlayResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayResponse {
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
}
#[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<AudioRendererPlayResponse, D> for &AudioRendererPlayResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererPlayResponse)
.write_unaligned((self as *const AudioRendererPlayResponse).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<AudioRendererPlayResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererPlayResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererPlayResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererSetPcmStreamTypeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPcmStreamTypeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioRendererSetPcmStreamTypeRequest, D>
for &AudioRendererSetPcmStreamTypeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererSetPcmStreamTypeRequest>(offset);
fidl::encoding::Encode::<AudioRendererSetPcmStreamTypeRequest, D>::encode(
(<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioStreamType, D>>
fidl::encoding::Encode<AudioRendererSetPcmStreamTypeRequest, 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::<AudioRendererSetPcmStreamTypeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererSetPcmStreamTypeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { type_: fidl::new_empty!(AudioStreamType, 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!(AudioStreamType, D, &mut self.type_, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererSetPtsContinuityThresholdRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPtsContinuityThresholdRequest {
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<AudioRendererSetPtsContinuityThresholdRequest, D>
for &AudioRendererSetPtsContinuityThresholdRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererSetPtsContinuityThresholdRequest>(offset);
fidl::encoding::Encode::<AudioRendererSetPtsContinuityThresholdRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.threshold_seconds),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<AudioRendererSetPtsContinuityThresholdRequest, 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::<AudioRendererSetPtsContinuityThresholdRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererSetPtsContinuityThresholdRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { threshold_seconds: fidl::new_empty!(f32, 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!(f32, D, &mut self.threshold_seconds, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererSetPtsUnitsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPtsUnitsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AudioRendererSetPtsUnitsRequest, D>
for &AudioRendererSetPtsUnitsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererSetPtsUnitsRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut AudioRendererSetPtsUnitsRequest)
.write_unaligned((self as *const AudioRendererSetPtsUnitsRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<AudioRendererSetPtsUnitsRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererSetPtsUnitsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererSetPtsUnitsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
tick_per_second_numerator: fidl::new_empty!(u32, D),
tick_per_second_denominator: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioRendererSetReferenceClockRequest {
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 AudioRendererSetReferenceClockRequest {
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<
AudioRendererSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioRendererSetReferenceClockRequest
{
#[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::<AudioRendererSetReferenceClockRequest>(offset);
fidl::encoding::Encode::<
AudioRendererSetReferenceClockRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.reference_clock,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioRendererSetReferenceClockRequest,
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::<AudioRendererSetReferenceClockRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioRendererSetReferenceClockRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
reference_clock: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Clock,
{ fidl::ObjectType::CLOCK.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.reference_clock,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioRendererSetUsageRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioRendererSetUsageRequest {
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<AudioRendererSetUsageRequest, D> for &AudioRendererSetUsageRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioRendererSetUsageRequest>(offset);
fidl::encoding::Encode::<AudioRendererSetUsageRequest, D>::encode(
(<AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioRenderUsage, D>>
fidl::encoding::Encode<AudioRendererSetUsageRequest, 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::<AudioRendererSetUsageRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioRendererSetUsageRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(AudioRenderUsage, 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!(AudioRenderUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioStreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioStreamType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioStreamType, D>
for &AudioStreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioStreamType>(offset);
fidl::encoding::Encode::<AudioStreamType, D>::encode(
(
<AudioSampleFormat as fidl::encoding::ValueTypeMarker>::borrow(
&self.sample_format,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.channels),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frames_per_second),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioSampleFormat, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<AudioStreamType, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioStreamType>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioStreamType {
#[inline(always)]
fn new_empty() -> Self {
Self {
sample_format: fidl::new_empty!(AudioSampleFormat, D),
channels: fidl::new_empty!(u32, D),
frames_per_second: fidl::new_empty!(u32, 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!(
AudioSampleFormat,
D,
&mut self.sample_format,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u32, D, &mut self.channels, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.frames_per_second, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Compression {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Compression {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Compression, D>
for &Compression
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Compression>(offset);
fidl::encoding::Encode::<Compression, D>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>> as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>, D>,
> fidl::encoding::Encode<Compression, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Compression>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Compression {
#[inline(always)]
fn new_empty() -> Self {
Self {
type_: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
parameters: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>,
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::BoundedString<256>,
D,
&mut self.type_,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>,
D,
&mut self.parameters,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EncryptionPattern {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EncryptionPattern {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EncryptionPattern, D>
for &EncryptionPattern
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EncryptionPattern>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut EncryptionPattern)
.write_unaligned((self as *const EncryptionPattern).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<EncryptionPattern, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EncryptionPattern>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EncryptionPattern {
#[inline(always)]
fn new_empty() -> Self {
Self {
clear_blocks: fidl::new_empty!(u32, D),
encrypted_blocks: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Metadata {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Metadata {
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<Metadata, D> for &Metadata {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Metadata>(offset);
fidl::encoding::Encode::<Metadata, D>::encode(
(
<fidl::encoding::UnboundedVector<Property> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Property>, D>,
> fidl::encoding::Encode<Metadata, 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::<Metadata>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Metadata {
#[inline(always)]
fn new_empty() -> Self {
Self { properties: fidl::new_empty!(fidl::encoding::UnboundedVector<Property>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Property>,
D,
&mut self.properties,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Parameter {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Parameter {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Parameter, D>
for &Parameter
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Parameter>(offset);
fidl::encoding::Encode::<Parameter, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.scope,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<Value as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T2: fidl::encoding::Encode<Value, D>,
> fidl::encoding::Encode<Parameter, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Parameter>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Parameter {
#[inline(always)]
fn new_empty() -> Self {
Self {
scope: fidl::new_empty!(fidl::encoding::UnboundedString, D),
name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
value: fidl::new_empty!(Value, 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::UnboundedString,
D,
&mut self.scope,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(Value, D, &mut self.value, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PcmFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PcmFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PcmFormat, D>
for &PcmFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PcmFormat>(offset);
fidl::encoding::Encode::<PcmFormat, D>::encode(
(
<AudioPcmMode as fidl::encoding::ValueTypeMarker>::borrow(&self.pcm_mode),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_sample),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frames_per_second),
<fidl::encoding::Vector<AudioChannelId, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_map),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AudioPcmMode, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<fidl::encoding::Vector<AudioChannelId, 16>, D>,
> fidl::encoding::Encode<PcmFormat, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PcmFormat>(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 + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PcmFormat {
#[inline(always)]
fn new_empty() -> Self {
Self {
pcm_mode: fidl::new_empty!(AudioPcmMode, D),
bits_per_sample: fidl::new_empty!(u32, D),
frames_per_second: fidl::new_empty!(u32, D),
channel_map: fidl::new_empty!(fidl::encoding::Vector<AudioChannelId, 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);
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!(AudioPcmMode, D, &mut self.pcm_mode, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.bits_per_sample, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.frames_per_second, decoder, offset + 8, _depth)?;
fidl::decode!(fidl::encoding::Vector<AudioChannelId, 16>, D, &mut self.channel_map, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderRegisterHandlerWithCapacityRequest {
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 ProfileProviderRegisterHandlerWithCapacityRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
ProfileProviderRegisterHandlerWithCapacityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderRegisterHandlerWithCapacityRequest
{
#[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::<ProfileProviderRegisterHandlerWithCapacityRequest>(offset);
fidl::encoding::Encode::<
ProfileProviderRegisterHandlerWithCapacityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::HandleType<
fidl::Thread,
{ fidl::ObjectType::THREAD.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.thread_handle,
),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.period),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.capacity),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Thread,
{ fidl::ObjectType::THREAD.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T3: fidl::encoding::Encode<f32, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
ProfileProviderRegisterHandlerWithCapacityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[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::<ProfileProviderRegisterHandlerWithCapacityRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderRegisterHandlerWithCapacityRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
thread_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
name: fidl::new_empty!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
period: fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect),
capacity: fidl::new_empty!(f32, 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(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,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread_handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
i64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.period,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
f32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.capacity,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileProviderRegisterHandlerWithCapacityResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileProviderRegisterHandlerWithCapacityResponse {
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
}
#[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<ProfileProviderRegisterHandlerWithCapacityResponse, D>
for &ProfileProviderRegisterHandlerWithCapacityResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ProfileProviderRegisterHandlerWithCapacityResponse)
.write_unaligned(
(self as *const ProfileProviderRegisterHandlerWithCapacityResponse).read(),
);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<ProfileProviderRegisterHandlerWithCapacityResponse, D>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProfileProviderRegisterHandlerWithCapacityResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { period: fidl::new_empty!(i64, D), capacity: fidl::new_empty!(i64, 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderRegisterMemoryRangeRequest {
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 ProfileProviderRegisterMemoryRangeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ProfileProviderRegisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderRegisterMemoryRangeRequest
{
#[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::<ProfileProviderRegisterMemoryRangeRequest>(offset);
fidl::encoding::Encode::<
ProfileProviderRegisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmar_handle
),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderRegisterMemoryRangeRequest,
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::<ProfileProviderRegisterMemoryRangeRequest>(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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderRegisterMemoryRangeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
vmar_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
name: fidl::new_empty!(
fidl::encoding::BoundedString<64>,
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(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!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar_handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderUnregisterHandlerRequest {
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 ProfileProviderUnregisterHandlerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ProfileProviderUnregisterHandlerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderUnregisterHandlerRequest
{
#[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::<ProfileProviderUnregisterHandlerRequest>(offset);
fidl::encoding::Encode::<
ProfileProviderUnregisterHandlerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::HandleType<
fidl::Thread,
{ fidl::ObjectType::THREAD.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.thread_handle,
),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Thread,
{ fidl::ObjectType::THREAD.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderUnregisterHandlerRequest,
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::<ProfileProviderUnregisterHandlerRequest>(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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderUnregisterHandlerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
thread_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
name: fidl::new_empty!(
fidl::encoding::BoundedString<64>,
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(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!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread_handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileProviderUnregisterMemoryRangeRequest {
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 ProfileProviderUnregisterMemoryRangeRequest {
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<
ProfileProviderUnregisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileProviderUnregisterMemoryRangeRequest
{
#[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::<ProfileProviderUnregisterMemoryRangeRequest>(offset);
fidl::encoding::Encode::<
ProfileProviderUnregisterMemoryRangeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmar_handle
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProfileProviderUnregisterMemoryRangeRequest,
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::<ProfileProviderUnregisterMemoryRangeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileProviderUnregisterMemoryRangeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
vmar_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar_handle, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Property {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Property {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Property, D> for &Property {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Property>(offset);
fidl::encoding::Encode::<Property, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.label,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<Property, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Property>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Property {
#[inline(always)]
fn new_empty() -> Self {
Self {
label: fidl::new_empty!(fidl::encoding::UnboundedString, D),
value: fidl::new_empty!(fidl::encoding::UnboundedString, 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::UnboundedString,
D,
&mut self.label,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.value,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SbcEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SbcEncoderSettings {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SbcEncoderSettings, D>
for &SbcEncoderSettings
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SbcEncoderSettings>(offset);
fidl::encoding::Encode::<SbcEncoderSettings, D>::encode(
(
<SbcSubBands as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_bands),
<SbcAllocation as fidl::encoding::ValueTypeMarker>::borrow(&self.allocation),
<SbcBlockCount as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
<SbcChannelMode as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_mode),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.bit_pool),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SbcSubBands, D>,
T1: fidl::encoding::Encode<SbcAllocation, D>,
T2: fidl::encoding::Encode<SbcBlockCount, D>,
T3: fidl::encoding::Encode<SbcChannelMode, D>,
T4: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<SbcEncoderSettings, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SbcEncoderSettings>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcEncoderSettings {
#[inline(always)]
fn new_empty() -> Self {
Self {
sub_bands: fidl::new_empty!(SbcSubBands, D),
allocation: fidl::new_empty!(SbcAllocation, D),
block_count: fidl::new_empty!(SbcBlockCount, D),
channel_mode: fidl::new_empty!(SbcChannelMode, D),
bit_pool: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SbcSubBands, D, &mut self.sub_bands, decoder, offset + 0, _depth)?;
fidl::decode!(SbcAllocation, D, &mut self.allocation, decoder, offset + 4, _depth)?;
fidl::decode!(SbcBlockCount, D, &mut self.block_count, decoder, offset + 8, _depth)?;
fidl::decode!(SbcChannelMode, D, &mut self.channel_mode, decoder, offset + 12, _depth)?;
fidl::decode!(u64, D, &mut self.bit_pool, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for SessionAudioConsumerFactoryCreateAudioConsumerRequest {
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 SessionAudioConsumerFactoryCreateAudioConsumerRequest {
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<
SessionAudioConsumerFactoryCreateAudioConsumerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut SessionAudioConsumerFactoryCreateAudioConsumerRequest
{
#[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::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
offset,
);
fidl::encoding::Encode::<SessionAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_consumer_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
SessionAudioConsumerFactoryCreateAudioConsumerRequest,
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::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
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 SessionAudioConsumerFactoryCreateAudioConsumerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
audio_consumer_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_consumer_request,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StreamBufferSetAddPayloadBufferRequest {
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 StreamBufferSetAddPayloadBufferRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StreamBufferSetAddPayloadBufferRequest
{
#[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::<StreamBufferSetAddPayloadBufferRequest>(offset);
fidl::encoding::Encode::<
StreamBufferSetAddPayloadBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.payload_buffer,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StreamBufferSetAddPayloadBufferRequest,
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::<StreamBufferSetAddPayloadBufferRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamBufferSetAddPayloadBufferRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
payload_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload_buffer, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamBufferSetRemovePayloadBufferRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamBufferSetRemovePayloadBufferRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamBufferSetRemovePayloadBufferRequest, D>
for &StreamBufferSetRemovePayloadBufferRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamBufferSetRemovePayloadBufferRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamBufferSetRemovePayloadBufferRequest).write_unaligned(
(self as *const StreamBufferSetRemovePayloadBufferRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<StreamBufferSetRemovePayloadBufferRequest, 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::<StreamBufferSetRemovePayloadBufferRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamBufferSetRemovePayloadBufferRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u32, 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, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamPacket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamPacket {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamPacket, D>
for &StreamPacket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamPacket>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamPacket)
.write_unaligned((self as *const StreamPacket).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<u64, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<u64, D>,
T6: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<StreamPacket, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamPacket>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
self.5.encode(encoder, offset + 40, depth)?;
self.6.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamPacket {
#[inline(always)]
fn new_empty() -> Self {
Self {
pts: fidl::new_empty!(i64, D),
payload_buffer_id: fidl::new_empty!(u32, D),
payload_offset: fidl::new_empty!(u64, D),
payload_size: fidl::new_empty!(u64, D),
flags: fidl::new_empty!(u32, D),
buffer_config: fidl::new_empty!(u64, D),
stream_segment_id: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorCloseCurrentStreamRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorCloseCurrentStreamRequest {
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<StreamProcessorCloseCurrentStreamRequest, D>
for &StreamProcessorCloseCurrentStreamRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorCloseCurrentStreamRequest>(offset);
fidl::encoding::Encode::<StreamProcessorCloseCurrentStreamRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.release_input_buffers),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.release_output_buffers),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<StreamProcessorCloseCurrentStreamRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorCloseCurrentStreamRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 9, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorCloseCurrentStreamRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
stream_lifetime_ordinal: fidl::new_empty!(u64, D),
release_input_buffers: fidl::new_empty!(bool, D),
release_output_buffers: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.release_input_buffers, decoder, offset + 8, _depth)?;
fidl::decode!(bool, D, &mut self.release_output_buffers, decoder, offset + 9, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorCompleteOutputBufferPartialSettingsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker
for StreamProcessorCompleteOutputBufferPartialSettingsRequest
{
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamProcessorCompleteOutputBufferPartialSettingsRequest, D>
for &StreamProcessorCompleteOutputBufferPartialSettingsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
offset,
);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamProcessorCompleteOutputBufferPartialSettingsRequest)
.write_unaligned(
(self as *const StreamProcessorCompleteOutputBufferPartialSettingsRequest)
.read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<StreamProcessorCompleteOutputBufferPartialSettingsRequest, 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::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorCompleteOutputBufferPartialSettingsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { buffer_lifetime_ordinal: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamProcessorFlushEndOfStreamAndCloseStreamRequest, D>
for &StreamProcessorFlushEndOfStreamAndCloseStreamRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamProcessorFlushEndOfStreamAndCloseStreamRequest)
.write_unaligned(
(self as *const StreamProcessorFlushEndOfStreamAndCloseStreamRequest)
.read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<StreamProcessorFlushEndOfStreamAndCloseStreamRequest, 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::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorFlushEndOfStreamAndCloseStreamRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { stream_lifetime_ordinal: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnFreeInputPacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnFreeInputPacketRequest {
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<StreamProcessorOnFreeInputPacketRequest, D>
for &StreamProcessorOnFreeInputPacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnFreeInputPacketRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnFreeInputPacketRequest, D>::encode(
(<PacketHeader as fidl::encoding::ValueTypeMarker>::borrow(
&self.free_input_packet,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PacketHeader, D>>
fidl::encoding::Encode<StreamProcessorOnFreeInputPacketRequest, 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::<StreamProcessorOnFreeInputPacketRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnFreeInputPacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { free_input_packet: fidl::new_empty!(PacketHeader, 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!(
PacketHeader,
D,
&mut self.free_input_packet,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnInputConstraintsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnInputConstraintsRequest {
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<StreamProcessorOnInputConstraintsRequest, D>
for &StreamProcessorOnInputConstraintsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnInputConstraintsRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnInputConstraintsRequest, D>::encode(
(<StreamBufferConstraints as fidl::encoding::ValueTypeMarker>::borrow(
&self.input_constraints,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<StreamBufferConstraints, D>,
> fidl::encoding::Encode<StreamProcessorOnInputConstraintsRequest, 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::<StreamProcessorOnInputConstraintsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnInputConstraintsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { input_constraints: fidl::new_empty!(StreamBufferConstraints, 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!(
StreamBufferConstraints,
D,
&mut self.input_constraints,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputConstraintsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputConstraintsRequest {
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<StreamProcessorOnOutputConstraintsRequest, D>
for &StreamProcessorOnOutputConstraintsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputConstraintsRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnOutputConstraintsRequest, D>::encode(
(<StreamOutputConstraints as fidl::encoding::ValueTypeMarker>::borrow(
&self.output_config,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<StreamOutputConstraints, D>,
> fidl::encoding::Encode<StreamProcessorOnOutputConstraintsRequest, 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::<StreamProcessorOnOutputConstraintsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnOutputConstraintsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { output_config: fidl::new_empty!(StreamOutputConstraints, 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!(
StreamOutputConstraints,
D,
&mut self.output_config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputEndOfStreamRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputEndOfStreamRequest {
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<StreamProcessorOnOutputEndOfStreamRequest, D>
for &StreamProcessorOnOutputEndOfStreamRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputEndOfStreamRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnOutputEndOfStreamRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_before),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<StreamProcessorOnOutputEndOfStreamRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputEndOfStreamRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnOutputEndOfStreamRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
stream_lifetime_ordinal: fidl::new_empty!(u64, D),
error_detected_before: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.error_detected_before, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputFormatRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputFormatRequest {
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<StreamProcessorOnOutputFormatRequest, D>
for &StreamProcessorOnOutputFormatRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputFormatRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnOutputFormatRequest, D>::encode(
(<StreamOutputFormat as fidl::encoding::ValueTypeMarker>::borrow(
&self.output_format,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamOutputFormat, D>>
fidl::encoding::Encode<StreamProcessorOnOutputFormatRequest, 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::<StreamProcessorOnOutputFormatRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnOutputFormatRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { output_format: fidl::new_empty!(StreamOutputFormat, 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!(
StreamOutputFormat,
D,
&mut self.output_format,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputPacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputPacketRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamProcessorOnOutputPacketRequest, D>
for &StreamProcessorOnOutputPacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputPacketRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnOutputPacketRequest, D>::encode(
(
<Packet as fidl::encoding::ValueTypeMarker>::borrow(&self.output_packet),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_before),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_during),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Packet, D>,
T1: fidl::encoding::Encode<bool, D>,
T2: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<StreamProcessorOnOutputPacketRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnOutputPacketRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 17, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnOutputPacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
output_packet: fidl::new_empty!(Packet, D),
error_detected_before: fidl::new_empty!(bool, D),
error_detected_during: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Packet, D, &mut self.output_packet, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.error_detected_before, decoder, offset + 16, _depth)?;
fidl::decode!(bool, D, &mut self.error_detected_during, decoder, offset + 17, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorOnStreamFailedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnStreamFailedRequest {
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<StreamProcessorOnStreamFailedRequest, D>
for &StreamProcessorOnStreamFailedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnStreamFailedRequest>(offset);
fidl::encoding::Encode::<StreamProcessorOnStreamFailedRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
<StreamError as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<StreamError, D>,
> fidl::encoding::Encode<StreamProcessorOnStreamFailedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorOnStreamFailedRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorOnStreamFailedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
stream_lifetime_ordinal: fidl::new_empty!(u64, D),
error: fidl::new_empty!(StreamError, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
fidl::decode!(StreamError, D, &mut self.error, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputEndOfStreamRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputEndOfStreamRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamProcessorQueueInputEndOfStreamRequest, D>
for &StreamProcessorQueueInputEndOfStreamRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorQueueInputEndOfStreamRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamProcessorQueueInputEndOfStreamRequest).write_unaligned(
(self as *const StreamProcessorQueueInputEndOfStreamRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<StreamProcessorQueueInputEndOfStreamRequest, 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::<StreamProcessorQueueInputEndOfStreamRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorQueueInputEndOfStreamRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { stream_lifetime_ordinal: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputFormatDetailsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputFormatDetailsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamProcessorQueueInputFormatDetailsRequest, D>
for &StreamProcessorQueueInputFormatDetailsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorQueueInputFormatDetailsRequest>(offset);
fidl::encoding::Encode::<StreamProcessorQueueInputFormatDetailsRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
<FormatDetails as fidl::encoding::ValueTypeMarker>::borrow(
&self.format_details,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<FormatDetails, D>,
> fidl::encoding::Encode<StreamProcessorQueueInputFormatDetailsRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorQueueInputFormatDetailsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorQueueInputFormatDetailsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
stream_lifetime_ordinal: fidl::new_empty!(u64, D),
format_details: fidl::new_empty!(FormatDetails, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
fidl::decode!(FormatDetails, D, &mut self.format_details, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputPacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputPacketRequest {
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<StreamProcessorQueueInputPacketRequest, D>
for &StreamProcessorQueueInputPacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorQueueInputPacketRequest>(offset);
fidl::encoding::Encode::<StreamProcessorQueueInputPacketRequest, D>::encode(
(<Packet as fidl::encoding::ValueTypeMarker>::borrow(&self.packet),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Packet, D>>
fidl::encoding::Encode<StreamProcessorQueueInputPacketRequest, 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::<StreamProcessorQueueInputPacketRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorQueueInputPacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(Packet, 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!(Packet, D, &mut self.packet, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamProcessorRecycleOutputPacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamProcessorRecycleOutputPacketRequest {
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<StreamProcessorRecycleOutputPacketRequest, D>
for &StreamProcessorRecycleOutputPacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamProcessorRecycleOutputPacketRequest>(offset);
fidl::encoding::Encode::<StreamProcessorRecycleOutputPacketRequest, D>::encode(
(<PacketHeader as fidl::encoding::ValueTypeMarker>::borrow(
&self.available_output_packet,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PacketHeader, D>>
fidl::encoding::Encode<StreamProcessorRecycleOutputPacketRequest, 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::<StreamProcessorRecycleOutputPacketRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamProcessorRecycleOutputPacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { available_output_packet: fidl::new_empty!(PacketHeader, 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!(
PacketHeader,
D,
&mut self.available_output_packet,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StreamProcessorSetInputBufferPartialSettingsRequest {
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 StreamProcessorSetInputBufferPartialSettingsRequest {
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<
StreamProcessorSetInputBufferPartialSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StreamProcessorSetInputBufferPartialSettingsRequest
{
#[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::<StreamProcessorSetInputBufferPartialSettingsRequest>(offset);
fidl::encoding::Encode::<StreamProcessorSetInputBufferPartialSettingsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<StreamBufferPartialSettings as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.input_settings),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
StreamBufferPartialSettings,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StreamProcessorSetInputBufferPartialSettingsRequest,
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::<StreamProcessorSetInputBufferPartialSettingsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamProcessorSetInputBufferPartialSettingsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
input_settings: fidl::new_empty!(
StreamBufferPartialSettings,
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!(
StreamBufferPartialSettings,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input_settings,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StreamProcessorSetOutputBufferPartialSettingsRequest {
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 StreamProcessorSetOutputBufferPartialSettingsRequest {
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<
StreamProcessorSetOutputBufferPartialSettingsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StreamProcessorSetOutputBufferPartialSettingsRequest
{
#[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::<StreamProcessorSetOutputBufferPartialSettingsRequest>(offset);
fidl::encoding::Encode::<StreamProcessorSetOutputBufferPartialSettingsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<StreamBufferPartialSettings as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output_settings),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
StreamBufferPartialSettings,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StreamProcessorSetOutputBufferPartialSettingsRequest,
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::<StreamProcessorSetOutputBufferPartialSettingsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamProcessorSetOutputBufferPartialSettingsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
output_settings: fidl::new_empty!(
StreamBufferPartialSettings,
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!(
StreamBufferPartialSettings,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.output_settings,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamSinkSendPacketNoReplyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamSinkSendPacketNoReplyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamSinkSendPacketNoReplyRequest, D>
for &StreamSinkSendPacketNoReplyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamSinkSendPacketNoReplyRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamSinkSendPacketNoReplyRequest)
.write_unaligned((self as *const StreamSinkSendPacketNoReplyRequest).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
fidl::encoding::Encode<StreamSinkSendPacketNoReplyRequest, 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::<StreamSinkSendPacketNoReplyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamSinkSendPacketNoReplyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(StreamPacket, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamSinkSendPacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamSinkSendPacketRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamSinkSendPacketRequest, D> for &StreamSinkSendPacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamSinkSendPacketRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamSinkSendPacketRequest)
.write_unaligned((self as *const StreamSinkSendPacketRequest).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
fidl::encoding::Encode<StreamSinkSendPacketRequest, 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::<StreamSinkSendPacketRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamSinkSendPacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(StreamPacket, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamSourceOnPacketProducedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamSourceOnPacketProducedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamSourceOnPacketProducedRequest, D>
for &StreamSourceOnPacketProducedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamSourceOnPacketProducedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamSourceOnPacketProducedRequest)
.write_unaligned((self as *const StreamSourceOnPacketProducedRequest).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
fidl::encoding::Encode<StreamSourceOnPacketProducedRequest, 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::<StreamSourceOnPacketProducedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamSourceOnPacketProducedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(StreamPacket, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamSourceReleasePacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamSourceReleasePacketRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamSourceReleasePacketRequest, D>
for &StreamSourceReleasePacketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamSourceReleasePacketRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut StreamSourceReleasePacketRequest)
.write_unaligned((self as *const StreamSourceReleasePacketRequest).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
let padding_ptr = buf_ptr.offset(32) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
fidl::encoding::Encode<StreamSourceReleasePacketRequest, 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::<StreamSourceReleasePacketRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamSourceReleasePacketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(StreamPacket, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { buf_ptr.offset(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamType, D>
for &StreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamType>(offset);
fidl::encoding::Encode::<StreamType, D>::encode(
(
<MediumSpecificStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.medium_specific),
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding),
<fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding_parameters),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<MediumSpecificStreamType, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D,
>,
> fidl::encoding::Encode<StreamType, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamType>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamType {
#[inline(always)]
fn new_empty() -> Self {
Self {
medium_specific: fidl::new_empty!(MediumSpecificStreamType, D),
encoding: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
encoding_parameters: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
MediumSpecificStreamType,
D,
&mut self.medium_specific,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.encoding,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
D,
&mut self.encoding_parameters,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SubpictureStreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SubpictureStreamType {
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<SubpictureStreamType, D>
for &SubpictureStreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SubpictureStreamType>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SubpictureStreamType {
#[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 SubsampleEntry {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SubsampleEntry {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SubsampleEntry, D>
for &SubsampleEntry
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SubsampleEntry>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SubsampleEntry)
.write_unaligned((self as *const SubsampleEntry).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<SubsampleEntry, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SubsampleEntry>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SubsampleEntry {
#[inline(always)]
fn new_empty() -> Self {
Self {
clear_bytes: fidl::new_empty!(u32, D),
encrypted_bytes: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TextStreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TextStreamType {
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<TextStreamType, D>
for &TextStreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TextStreamType>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextStreamType {
#[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 TimelineFunction {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TimelineFunction {
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
}
#[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<TimelineFunction, D>
for &TimelineFunction
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TimelineFunction>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut TimelineFunction)
.write_unaligned((self as *const TimelineFunction).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i64, D>,
T1: fidl::encoding::Encode<i64, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<TimelineFunction, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TimelineFunction>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimelineFunction {
#[inline(always)]
fn new_empty() -> Self {
Self {
subject_time: fidl::new_empty!(i64, D),
reference_time: fidl::new_empty!(i64, D),
subject_delta: fidl::new_empty!(u32, D),
reference_delta: fidl::new_empty!(u32, 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, 24);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for UsageAudioConsumerFactoryCreateAudioConsumerRequest {
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 UsageAudioConsumerFactoryCreateAudioConsumerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
UsageAudioConsumerFactoryCreateAudioConsumerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut UsageAudioConsumerFactoryCreateAudioConsumerRequest
{
#[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::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(offset);
fidl::encoding::Encode::<UsageAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_consumer_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<AudioRenderUsage, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
UsageAudioConsumerFactoryCreateAudioConsumerRequest,
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::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for UsageAudioConsumerFactoryCreateAudioConsumerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
usage: fidl::new_empty!(
AudioRenderUsage,
fidl::encoding::DefaultFuchsiaResourceDialect
),
audio_consumer_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
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!(
AudioRenderUsage,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.audio_consumer_request,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UsageGainListenerOnGainMuteChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageGainListenerOnGainMuteChangedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<UsageGainListenerOnGainMuteChangedRequest, D>
for &UsageGainListenerOnGainMuteChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageGainListenerOnGainMuteChangedRequest>(offset);
fidl::encoding::Encode::<UsageGainListenerOnGainMuteChangedRequest, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_dbfs),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<f32, D>,
> fidl::encoding::Encode<UsageGainListenerOnGainMuteChangedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageGainListenerOnGainMuteChangedRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for UsageGainListenerOnGainMuteChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { muted: fidl::new_empty!(bool, D), gain_dbfs: fidl::new_empty!(f32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
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!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
fidl::decode!(f32, D, &mut self.gain_dbfs, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for UsageGainReporterRegisterListenerRequest {
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 UsageGainReporterRegisterListenerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
UsageGainReporterRegisterListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut UsageGainReporterRegisterListenerRequest
{
#[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::<UsageGainReporterRegisterListenerRequest>(offset);
fidl::encoding::Encode::<UsageGainReporterRegisterListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_unique_id),
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_gain_listener),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<36>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
UsageGainReporterRegisterListenerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageGainReporterRegisterListenerRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for UsageGainReporterRegisterListenerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
device_unique_id: fidl::new_empty!(
fidl::encoding::BoundedString<36>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
usage_gain_listener: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
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(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<36>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.device_unique_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
Usage,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage_gain_listener,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for UsageReporterWatchRequest {
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 UsageReporterWatchRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
UsageReporterWatchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut UsageReporterWatchRequest
{
#[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::<UsageReporterWatchRequest>(offset);
fidl::encoding::Encode::<UsageReporterWatchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
UsageReporterWatchRequest,
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::<UsageReporterWatchRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for UsageReporterWatchRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
usage_watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
Usage,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.usage_watcher,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UsageWatcherOnStateChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageWatcherOnStateChangedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<UsageWatcherOnStateChangedRequest, D>
for &UsageWatcherOnStateChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageWatcherOnStateChangedRequest>(offset);
fidl::encoding::Encode::<UsageWatcherOnStateChangedRequest, D>::encode(
(
<Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
<UsageState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Usage, D>,
T1: fidl::encoding::Encode<UsageState, D>,
> fidl::encoding::Encode<UsageWatcherOnStateChangedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageWatcherOnStateChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for UsageWatcherOnStateChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { usage: fidl::new_empty!(Usage, D), state: fidl::new_empty!(UsageState, 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!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
fidl::decode!(UsageState, D, &mut self.state, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VideoStreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VideoStreamType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
36
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VideoStreamType, D>
for &VideoStreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoStreamType>(offset);
fidl::encoding::Encode::<VideoStreamType, D>::encode(
(
<fidl_fuchsia_images::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(
&self.pixel_format,
),
<ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_width),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_height),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.pixel_aspect_ratio_width,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.pixel_aspect_ratio_height,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.stride),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_images::PixelFormat, D>,
T1: fidl::encoding::Encode<ColorSpace, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<u32, D>,
T6: fidl::encoding::Encode<u32, D>,
T7: fidl::encoding::Encode<u32, D>,
T8: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<VideoStreamType, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoStreamType>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
self.4.encode(encoder, offset + 16, depth)?;
self.5.encode(encoder, offset + 20, depth)?;
self.6.encode(encoder, offset + 24, depth)?;
self.7.encode(encoder, offset + 28, depth)?;
self.8.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoStreamType {
#[inline(always)]
fn new_empty() -> Self {
Self {
pixel_format: fidl::new_empty!(fidl_fuchsia_images::PixelFormat, D),
color_space: fidl::new_empty!(ColorSpace, D),
width: fidl::new_empty!(u32, D),
height: fidl::new_empty!(u32, D),
coded_width: fidl::new_empty!(u32, D),
coded_height: fidl::new_empty!(u32, D),
pixel_aspect_ratio_width: fidl::new_empty!(u32, D),
pixel_aspect_ratio_height: fidl::new_empty!(u32, D),
stride: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_images::PixelFormat,
D,
&mut self.pixel_format,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 4, _depth)?;
fidl::decode!(u32, D, &mut self.width, decoder, offset + 8, _depth)?;
fidl::decode!(u32, D, &mut self.height, decoder, offset + 12, _depth)?;
fidl::decode!(u32, D, &mut self.coded_width, decoder, offset + 16, _depth)?;
fidl::decode!(u32, D, &mut self.coded_height, decoder, offset + 20, _depth)?;
fidl::decode!(
u32,
D,
&mut self.pixel_aspect_ratio_width,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
u32,
D,
&mut self.pixel_aspect_ratio_height,
decoder,
offset + 28,
_depth
)?;
fidl::decode!(u32, D, &mut self.stride, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VideoUncompressedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VideoUncompressedFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
128
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<VideoUncompressedFormat, D> for &VideoUncompressedFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoUncompressedFormat>(offset);
fidl::encoding::Encode::<VideoUncompressedFormat, D>::encode(
(
<fidl_fuchsia_sysmem::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(
&self.image_format,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fourcc),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_width_pixels),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_height_pixels),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_width_pixels),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_height_pixels),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.planar),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.swizzled),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.primary_line_stride_bytes,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.secondary_line_stride_bytes,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_start_offset),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_start_offset),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.tertiary_start_offset),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_pixel_stride),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_pixel_stride),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.primary_display_width_pixels,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.primary_display_height_pixels,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_pixel_aspect_ratio),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.pixel_aspect_ratio_width,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.pixel_aspect_ratio_height,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_sysmem::ImageFormat2, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
T3: fidl::encoding::Encode<u32, D>,
T4: fidl::encoding::Encode<u32, D>,
T5: fidl::encoding::Encode<u32, D>,
T6: fidl::encoding::Encode<bool, D>,
T7: fidl::encoding::Encode<bool, D>,
T8: fidl::encoding::Encode<u32, D>,
T9: fidl::encoding::Encode<u32, D>,
T10: fidl::encoding::Encode<u32, D>,
T11: fidl::encoding::Encode<u32, D>,
T12: fidl::encoding::Encode<u32, D>,
T13: fidl::encoding::Encode<u32, D>,
T14: fidl::encoding::Encode<u32, D>,
T15: fidl::encoding::Encode<u32, D>,
T16: fidl::encoding::Encode<u32, D>,
T17: fidl::encoding::Encode<bool, D>,
T18: fidl::encoding::Encode<u32, D>,
T19: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<VideoUncompressedFormat, D>
for (
T0,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14,
T15,
T16,
T17,
T18,
T19,
)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoUncompressedFormat>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(112);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 56, depth)?;
self.2.encode(encoder, offset + 60, depth)?;
self.3.encode(encoder, offset + 64, depth)?;
self.4.encode(encoder, offset + 68, depth)?;
self.5.encode(encoder, offset + 72, depth)?;
self.6.encode(encoder, offset + 76, depth)?;
self.7.encode(encoder, offset + 77, depth)?;
self.8.encode(encoder, offset + 80, depth)?;
self.9.encode(encoder, offset + 84, depth)?;
self.10.encode(encoder, offset + 88, depth)?;
self.11.encode(encoder, offset + 92, depth)?;
self.12.encode(encoder, offset + 96, depth)?;
self.13.encode(encoder, offset + 100, depth)?;
self.14.encode(encoder, offset + 104, depth)?;
self.15.encode(encoder, offset + 108, depth)?;
self.16.encode(encoder, offset + 112, depth)?;
self.17.encode(encoder, offset + 116, depth)?;
self.18.encode(encoder, offset + 120, depth)?;
self.19.encode(encoder, offset + 124, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VideoUncompressedFormat
{
#[inline(always)]
fn new_empty() -> Self {
Self {
image_format: fidl::new_empty!(fidl_fuchsia_sysmem::ImageFormat2, D),
fourcc: fidl::new_empty!(u32, D),
primary_width_pixels: fidl::new_empty!(u32, D),
primary_height_pixels: fidl::new_empty!(u32, D),
secondary_width_pixels: fidl::new_empty!(u32, D),
secondary_height_pixels: fidl::new_empty!(u32, D),
planar: fidl::new_empty!(bool, D),
swizzled: fidl::new_empty!(bool, D),
primary_line_stride_bytes: fidl::new_empty!(u32, D),
secondary_line_stride_bytes: fidl::new_empty!(u32, D),
primary_start_offset: fidl::new_empty!(u32, D),
secondary_start_offset: fidl::new_empty!(u32, D),
tertiary_start_offset: fidl::new_empty!(u32, D),
primary_pixel_stride: fidl::new_empty!(u32, D),
secondary_pixel_stride: fidl::new_empty!(u32, D),
primary_display_width_pixels: fidl::new_empty!(u32, D),
primary_display_height_pixels: fidl::new_empty!(u32, D),
has_pixel_aspect_ratio: fidl::new_empty!(bool, D),
pixel_aspect_ratio_width: fidl::new_empty!(u32, D),
pixel_aspect_ratio_height: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffff000000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(112) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff0000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 112 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_sysmem::ImageFormat2,
D,
&mut self.image_format,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u32, D, &mut self.fourcc, decoder, offset + 56, _depth)?;
fidl::decode!(u32, D, &mut self.primary_width_pixels, decoder, offset + 60, _depth)?;
fidl::decode!(u32, D, &mut self.primary_height_pixels, decoder, offset + 64, _depth)?;
fidl::decode!(u32, D, &mut self.secondary_width_pixels, decoder, offset + 68, _depth)?;
fidl::decode!(u32, D, &mut self.secondary_height_pixels, decoder, offset + 72, _depth)?;
fidl::decode!(bool, D, &mut self.planar, decoder, offset + 76, _depth)?;
fidl::decode!(bool, D, &mut self.swizzled, decoder, offset + 77, _depth)?;
fidl::decode!(
u32,
D,
&mut self.primary_line_stride_bytes,
decoder,
offset + 80,
_depth
)?;
fidl::decode!(
u32,
D,
&mut self.secondary_line_stride_bytes,
decoder,
offset + 84,
_depth
)?;
fidl::decode!(u32, D, &mut self.primary_start_offset, decoder, offset + 88, _depth)?;
fidl::decode!(u32, D, &mut self.secondary_start_offset, decoder, offset + 92, _depth)?;
fidl::decode!(u32, D, &mut self.tertiary_start_offset, decoder, offset + 96, _depth)?;
fidl::decode!(u32, D, &mut self.primary_pixel_stride, decoder, offset + 100, _depth)?;
fidl::decode!(u32, D, &mut self.secondary_pixel_stride, decoder, offset + 104, _depth)?;
fidl::decode!(
u32,
D,
&mut self.primary_display_width_pixels,
decoder,
offset + 108,
_depth
)?;
fidl::decode!(
u32,
D,
&mut self.primary_display_height_pixels,
decoder,
offset + 112,
_depth
)?;
fidl::decode!(
bool,
D,
&mut self.has_pixel_aspect_ratio,
decoder,
offset + 116,
_depth
)?;
fidl::decode!(
u32,
D,
&mut self.pixel_aspect_ratio_width,
decoder,
offset + 120,
_depth
)?;
fidl::decode!(
u32,
D,
&mut self.pixel_aspect_ratio_height,
decoder,
offset + 124,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Void {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Void {
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<Void, D> for &Void {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Void>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Void {
#[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 AudioCompressedFormatCvsd {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatCvsd {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatCvsd {
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<AudioCompressedFormatCvsd, D> for &AudioCompressedFormatCvsd
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCompressedFormatCvsd>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCompressedFormatCvsd
{
#[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;
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 AudioCompressedFormatLc3 {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatLc3 {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatLc3 {
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<AudioCompressedFormatLc3, D> for &AudioCompressedFormatLc3
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCompressedFormatLc3>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCompressedFormatLc3
{
#[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;
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 AudioConsumerStatus {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.max_lead_time {
return 4;
}
if let Some(_) = self.min_lead_time {
return 3;
}
if let Some(_) = self.presentation_timeline {
return 2;
}
if let Some(_) = self.error {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioConsumerStatus {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioConsumerStatus {
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<AudioConsumerStatus, D>
for &AudioConsumerStatus
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerStatus>(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::<AudioConsumerError, D>(
self.error
.as_ref()
.map(<AudioConsumerError 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::<TimelineFunction, D>(
self.presentation_timeline
.as_ref()
.map(<TimelineFunction 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::<u64, D>(
self.min_lead_time.as_ref().map(<u64 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::<u64, D>(
self.max_lead_time.as_ref().map(<u64 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 AudioConsumerStatus {
#[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 =
<AudioConsumerError as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.error.get_or_insert_with(|| fidl::new_empty!(AudioConsumerError, D));
fidl::decode!(AudioConsumerError, 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 =
<TimelineFunction 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
.presentation_timeline
.get_or_insert_with(|| fidl::new_empty!(TimelineFunction, D));
fidl::decode!(TimelineFunction, 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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.min_lead_time.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.max_lead_time.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 CvsdEncoderSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for CvsdEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CvsdEncoderSettings {
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<CvsdEncoderSettings, D>
for &CvsdEncoderSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CvsdEncoderSettings>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CvsdEncoderSettings {
#[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;
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 DecryptedFormat {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.ignore_this_field {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for DecryptedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DecryptedFormat {
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<DecryptedFormat, D>
for &DecryptedFormat
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DecryptedFormat>(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.ignore_this_field
.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 DecryptedFormat {
#[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.ignore_this_field.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 EncryptedFormat {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.key_id {
return 8;
}
if let Some(_) = self.scheme {
return 6;
}
if let Some(_) = self.pattern {
return 5;
}
if let Some(_) = self.subsamples {
return 4;
}
if let Some(_) = self.init_vector {
return 3;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for EncryptedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EncryptedFormat {
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<EncryptedFormat, D>
for &EncryptedFormat
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EncryptedFormat>(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 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 16>, D>(
self.init_vector.as_ref().map(
<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<SubsampleEntry>, D>(
self.subsamples.as_ref().map(<fidl::encoding::UnboundedVector<SubsampleEntry> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<EncryptionPattern, D>(
self.pattern
.as_ref()
.map(<EncryptionPattern as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
self.scheme.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 16>, D>(
self.key_id.as_ref().map(
<fidl::encoding::Vector<u8, 16> 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 EncryptedFormat {
#[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 < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::Vector<u8, 16> 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
.init_vector
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D));
fidl::decode!(fidl::encoding::Vector<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<SubsampleEntry> 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.subsamples.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<SubsampleEntry>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<SubsampleEntry>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<EncryptionPattern 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.pattern.get_or_insert_with(|| fidl::new_empty!(EncryptionPattern, D));
fidl::decode!(EncryptionPattern, 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 < 6 {
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::UnboundedString 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
.scheme
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
fidl::decode!(
fidl::encoding::UnboundedString,
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 < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::Vector<u8, 16> 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
.key_id
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D));
fidl::decode!(fidl::encoding::Vector<u8, 16>, 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 FormatDetails {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.profile {
return 8;
}
if let Some(_) = self.timebase {
return 7;
}
if let Some(_) = self.encoder_settings {
return 6;
}
if let Some(_) = self.pass_through_parameters {
return 5;
}
if let Some(_) = self.domain {
return 4;
}
if let Some(_) = self.oob_bytes {
return 3;
}
if let Some(_) = self.mime_type {
return 2;
}
if let Some(_) = self.format_details_version_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for FormatDetails {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FormatDetails {
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<FormatDetails, D>
for &FormatDetails
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FormatDetails>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.format_details_version_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
self.mime_type.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
self.oob_bytes.as_ref().map(<fidl::encoding::UnboundedVector<u8> 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::<DomainFormat, D>(
self.domain.as_ref().map(<DomainFormat as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Parameter>, D>(
self.pass_through_parameters.as_ref().map(<fidl::encoding::UnboundedVector<Parameter> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<EncoderSettings, D>(
self.encoder_settings
.as_ref()
.map(<EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.timebase.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<CodecProfile, D>(
self.profile
.as_ref()
.map(<CodecProfile 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 FormatDetails {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.format_details_version_ordinal
.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::UnboundedString 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
.mime_type
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
fidl::decode!(
fidl::encoding::UnboundedString,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<u8> 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.oob_bytes.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<DomainFormat 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.domain.get_or_insert_with(|| fidl::new_empty!(DomainFormat, D));
fidl::decode!(DomainFormat, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<Parameter> 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.pass_through_parameters.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<Parameter>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<Parameter>,
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 < 6 {
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 =
<EncoderSettings 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
.encoder_settings
.get_or_insert_with(|| fidl::new_empty!(EncoderSettings, D));
fidl::decode!(EncoderSettings, 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 < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.timebase.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
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 =
<CodecProfile 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.profile.get_or_insert_with(|| fidl::new_empty!(CodecProfile, D));
fidl::decode!(CodecProfile, 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 H264EncoderSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.quantization_params {
return 7;
}
if let Some(_) = self.force_key_frame {
return 6;
}
if let Some(_) = self.min_frame_rate {
return 5;
}
if let Some(_) = self.variable_frame_rate {
return 4;
}
if let Some(_) = self.gop_size {
return 3;
}
if let Some(_) = self.frame_rate {
return 2;
}
if let Some(_) = self.bit_rate {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for H264EncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for H264EncoderSettings {
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<H264EncoderSettings, D>
for &H264EncoderSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<H264EncoderSettings>(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::<u32, D>(
self.bit_rate.as_ref().map(<u32 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::<u32, D>(
self.frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.gop_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.variable_frame_rate
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.min_frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.force_key_frame
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<H264QuantizationParameters, D>(
self.quantization_params
.as_ref()
.map(<H264QuantizationParameters 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 H264EncoderSettings {
#[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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.bit_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.gop_size.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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.variable_frame_rate.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 < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.min_frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
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.force_key_frame.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 < 7 {
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 =
<H264QuantizationParameters 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
.quantization_params
.get_or_insert_with(|| fidl::new_empty!(H264QuantizationParameters, D));
fidl::decode!(
H264QuantizationParameters,
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 H264QuantizationParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.p_max {
return 6;
}
if let Some(_) = self.p_min {
return 5;
}
if let Some(_) = self.p_base {
return 4;
}
if let Some(_) = self.i_max {
return 3;
}
if let Some(_) = self.i_min {
return 2;
}
if let Some(_) = self.i_base {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for H264QuantizationParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for H264QuantizationParameters {
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<H264QuantizationParameters, D> for &H264QuantizationParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<H264QuantizationParameters>(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::<u32, D>(
self.i_base.as_ref().map(<u32 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::<u32, D>(
self.i_min.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.i_max.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.p_base.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.p_min.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.p_max.as_ref().map(<u32 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 H264QuantizationParameters
{
#[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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.i_base.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.i_min.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.i_max.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.p_base.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.p_min.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.p_max.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 HevcEncoderSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.gop_size {
return 3;
}
if let Some(_) = self.frame_rate {
return 2;
}
if let Some(_) = self.bit_rate {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for HevcEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HevcEncoderSettings {
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<HevcEncoderSettings, D>
for &HevcEncoderSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HevcEncoderSettings>(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::<u32, D>(
self.bit_rate.as_ref().map(<u32 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::<u32, D>(
self.frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.gop_size.as_ref().map(<u32 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 HevcEncoderSettings {
#[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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.bit_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.gop_size.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 InputAudioCapturerConfiguration {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.usage {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for InputAudioCapturerConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InputAudioCapturerConfiguration {
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<InputAudioCapturerConfiguration, D>
for &InputAudioCapturerConfiguration
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InputAudioCapturerConfiguration>(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::<AudioCaptureUsage, D>(
self.usage
.as_ref()
.map(<AudioCaptureUsage 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 InputAudioCapturerConfiguration
{
#[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 =
<AudioCaptureUsage 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.usage.get_or_insert_with(|| fidl::new_empty!(AudioCaptureUsage, D));
fidl::decode!(AudioCaptureUsage, 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 Lc3EncoderSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.frame_duration {
return 2;
}
if let Some(_) = self.nbytes {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Lc3EncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Lc3EncoderSettings {
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<Lc3EncoderSettings, D>
for &Lc3EncoderSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Lc3EncoderSettings>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.nbytes.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Lc3FrameDuration, D>(
self.frame_duration
.as_ref()
.map(<Lc3FrameDuration 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 Lc3EncoderSettings {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.nbytes.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Lc3FrameDuration 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
.frame_duration
.get_or_insert_with(|| fidl::new_empty!(Lc3FrameDuration, D));
fidl::decode!(Lc3FrameDuration, 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 LoopbackAudioCapturerConfiguration {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for LoopbackAudioCapturerConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LoopbackAudioCapturerConfiguration {
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<LoopbackAudioCapturerConfiguration, D>
for &LoopbackAudioCapturerConfiguration
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoopbackAudioCapturerConfiguration>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LoopbackAudioCapturerConfiguration
{
#[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;
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 MSbcEncoderSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for MSbcEncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MSbcEncoderSettings {
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<MSbcEncoderSettings, D>
for &MSbcEncoderSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MSbcEncoderSettings>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MSbcEncoderSettings {
#[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;
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 Packet {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.key_frame {
return 9;
}
if let Some(_) = self.known_end_access_unit {
return 8;
}
if let Some(_) = self.start_access_unit {
return 7;
}
if let Some(_) = self.timestamp_ish {
return 6;
}
if let Some(_) = self.valid_length_bytes {
return 5;
}
if let Some(_) = self.start_offset {
return 4;
}
if let Some(_) = self.stream_lifetime_ordinal {
return 3;
}
if let Some(_) = self.buffer_index {
return 2;
}
if let Some(_) = self.header {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Packet {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Packet {
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<Packet, D> for &Packet {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Packet>(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::<PacketHeader, D>(
self.header.as_ref().map(<PacketHeader 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::<u32, D>(
self.buffer_index.as_ref().map(<u32 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::<u64, D>(
self.stream_lifetime_ordinal
.as_ref()
.map(<u64 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::<u32, D>(
self.start_offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.valid_length_bytes
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.timestamp_ish.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.start_access_unit
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.known_end_access_unit
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.key_frame.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 Packet {
#[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 =
<PacketHeader 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.header.get_or_insert_with(|| fidl::new_empty!(PacketHeader, D));
fidl::decode!(PacketHeader, 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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.start_offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.valid_length_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.timestamp_ish.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
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.start_access_unit.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 < 8 {
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.known_end_access_unit.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 < 9 {
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.key_frame.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 PacketHeader {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.packet_index {
return 2;
}
if let Some(_) = self.buffer_lifetime_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PacketHeader {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PacketHeader {
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<PacketHeader, D>
for &PacketHeader
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PacketHeader>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_lifetime_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_index.as_ref().map(<u32 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 PacketHeader {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.buffer_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.packet_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 StreamBufferConstraints {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.is_physically_contiguous_required {
return 13;
}
if let Some(_) = self.single_buffer_mode_allowed {
return 12;
}
if let Some(_) = self.packet_count_for_client_max {
return 11;
}
if let Some(_) = self.packet_count_for_client_min {
return 10;
}
if let Some(_) = self.packet_count_for_server_max {
return 9;
}
if let Some(_) = self.packet_count_for_server_recommended_max {
return 8;
}
if let Some(_) = self.packet_count_for_server_recommended {
return 7;
}
if let Some(_) = self.packet_count_for_server_min {
return 6;
}
if let Some(_) = self.per_packet_buffer_bytes_max {
return 5;
}
if let Some(_) = self.per_packet_buffer_bytes_recommended {
return 4;
}
if let Some(_) = self.per_packet_buffer_bytes_min {
return 3;
}
if let Some(_) = self.default_settings {
return 2;
}
if let Some(_) = self.buffer_constraints_version_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for StreamBufferConstraints {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamBufferConstraints {
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<StreamBufferConstraints, D> for &StreamBufferConstraints
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamBufferConstraints>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_constraints_version_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<StreamBufferSettings, D>(
self.default_settings
.as_ref()
.map(<StreamBufferSettings as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.per_packet_buffer_bytes_min
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.per_packet_buffer_bytes_recommended
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.per_packet_buffer_bytes_max
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_server_min
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_server_recommended
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_server_recommended_max
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_server_max
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 10 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (10 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_client_min
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 11 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (11 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_client_max
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 12 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (12 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.single_buffer_mode_allowed
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 13 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (13 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.is_physically_contiguous_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamBufferConstraints
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.buffer_constraints_version_ordinal
.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<StreamBufferSettings 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
.default_settings
.get_or_insert_with(|| fidl::new_empty!(StreamBufferSettings, D));
fidl::decode!(
StreamBufferSettings,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.per_packet_buffer_bytes_min
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.per_packet_buffer_bytes_recommended
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.per_packet_buffer_bytes_max
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_server_min
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_server_recommended
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_server_recommended_max
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_server_max
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 10 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_client_min
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 11 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.packet_count_for_client_max
.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 12 {
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
.single_buffer_mode_allowed
.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 < 13 {
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
.is_physically_contiguous_required
.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl StreamBufferPartialSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.sysmem2_token {
return 7;
}
if let Some(_) = self.sysmem_token {
return 6;
}
if let Some(_) = self.packet_count_for_client {
return 5;
}
if let Some(_) = self.packet_count_for_server {
return 4;
}
if let Some(_) = self.single_buffer_mode {
return 3;
}
if let Some(_) = self.buffer_constraints_version_ordinal {
return 2;
}
if let Some(_) = self.buffer_lifetime_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for StreamBufferPartialSettings {
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 StreamBufferPartialSettings {
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<
StreamBufferPartialSettings,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StreamBufferPartialSettings
{
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::<StreamBufferPartialSettings>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.buffer_lifetime_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.buffer_constraints_version_ordinal
.as_ref()
.map(<u64 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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.single_buffer_mode
.as_ref()
.map(<bool 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::<
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.packet_count_for_server
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.packet_count_for_client
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 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<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.sysmem_token.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 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<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.sysmem2_token.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StreamBufferPartialSettings
{
#[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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_lifetime_ordinal.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_constraints_version_ordinal.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
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 =
<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.single_buffer_mode.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
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 =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.packet_count_for_server.get_or_insert_with(|| {
fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u32,
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 < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.packet_count_for_client.get_or_insert_with(|| {
fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u32,
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 < 6 {
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<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
> 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.sysmem_token.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
>,
>,
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 < 7 {
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<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
> 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.sysmem2_token.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
>,
>,
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 StreamBufferSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.single_buffer_mode {
return 6;
}
if let Some(_) = self.per_packet_buffer_bytes {
return 5;
}
if let Some(_) = self.packet_count_for_client {
return 4;
}
if let Some(_) = self.packet_count_for_server {
return 3;
}
if let Some(_) = self.buffer_constraints_version_ordinal {
return 2;
}
if let Some(_) = self.buffer_lifetime_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for StreamBufferSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamBufferSettings {
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<StreamBufferSettings, D>
for &StreamBufferSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamBufferSettings>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_lifetime_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_constraints_version_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_server
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.packet_count_for_client
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.per_packet_buffer_bytes
.as_ref()
.map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.single_buffer_mode
.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 StreamBufferSettings {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.buffer_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.buffer_constraints_version_ordinal
.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.packet_count_for_server.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.packet_count_for_client.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.per_packet_buffer_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
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.single_buffer_mode.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 StreamOutputConstraints {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.buffer_constraints {
return 3;
}
if let Some(_) = self.buffer_constraints_action_required {
return 2;
}
if let Some(_) = self.stream_lifetime_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for StreamOutputConstraints {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamOutputConstraints {
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<StreamOutputConstraints, D> for &StreamOutputConstraints
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamOutputConstraints>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.stream_lifetime_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.buffer_constraints_action_required
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<StreamBufferConstraints, D>(
self.buffer_constraints
.as_ref()
.map(<StreamBufferConstraints 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 StreamOutputConstraints
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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
.buffer_constraints_action_required
.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<StreamBufferConstraints 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
.buffer_constraints
.get_or_insert_with(|| fidl::new_empty!(StreamBufferConstraints, D));
fidl::decode!(
StreamBufferConstraints,
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 StreamOutputFormat {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.format_details {
return 2;
}
if let Some(_) = self.stream_lifetime_ordinal {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for StreamOutputFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamOutputFormat {
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<StreamOutputFormat, D>
for &StreamOutputFormat
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamOutputFormat>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.stream_lifetime_ordinal
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<FormatDetails, D>(
self.format_details
.as_ref()
.map(<FormatDetails 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 StreamOutputFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<FormatDetails 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.format_details.get_or_insert_with(|| fidl::new_empty!(FormatDetails, D));
fidl::decode!(FormatDetails, 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 UsageStateDucked {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for UsageStateDucked {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageStateDucked {
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<UsageStateDucked, D>
for &UsageStateDucked
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageStateDucked>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateDucked {
#[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;
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 UsageStateMuted {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for UsageStateMuted {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageStateMuted {
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<UsageStateMuted, D>
for &UsageStateMuted
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageStateMuted>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateMuted {
#[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;
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 UsageStateUnadjusted {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for UsageStateUnadjusted {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageStateUnadjusted {
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<UsageStateUnadjusted, D>
for &UsageStateUnadjusted
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageStateUnadjusted>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateUnadjusted {
#[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;
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 AacBitRate {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacBitRate {
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<AacBitRate, D>
for &AacBitRate
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacBitRate>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AacBitRate::Constant(ref val) => {
fidl::encoding::encode_in_envelope::<AacConstantBitRate, D>(
<AacConstantBitRate as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AacBitRate::Variable(ref val) => {
fidl::encoding::encode_in_envelope::<AacVariableBitRate, D>(
<AacVariableBitRate as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacBitRate {
#[inline(always)]
fn new_empty() -> Self {
Self::Constant(fidl::new_empty!(AacConstantBitRate, 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 => {
<AacConstantBitRate as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
2 => {
<AacVariableBitRate 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 AacBitRate::Constant(_) = self {
} else {
*self = AacBitRate::Constant(fidl::new_empty!(AacConstantBitRate, D));
}
#[allow(irrefutable_let_patterns)]
if let AacBitRate::Constant(ref mut val) = self {
fidl::decode!(AacConstantBitRate, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AacBitRate::Variable(_) = self {
} else {
*self = AacBitRate::Variable(fidl::new_empty!(AacVariableBitRate, D));
}
#[allow(irrefutable_let_patterns)]
if let AacBitRate::Variable(ref mut val) = self {
fidl::decode!(AacVariableBitRate, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for AacTransport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AacTransport {
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<AacTransport, D>
for &AacTransport
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AacTransport>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AacTransport::Raw(ref val) => {
fidl::encoding::encode_in_envelope::<AacTransportRaw, D>(
<AacTransportRaw as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AacTransport::Latm(ref val) => {
fidl::encoding::encode_in_envelope::<AacTransportLatm, D>(
<AacTransportLatm as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AacTransport::Adts(ref val) => {
fidl::encoding::encode_in_envelope::<AacTransportAdts, D>(
<AacTransportAdts as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AacTransport::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransport {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <AacTransportRaw as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <AacTransportLatm as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <AacTransportAdts as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let AacTransport::Raw(_) = self {
} else {
*self = AacTransport::Raw(fidl::new_empty!(AacTransportRaw, D));
}
#[allow(irrefutable_let_patterns)]
if let AacTransport::Raw(ref mut val) = self {
fidl::decode!(AacTransportRaw, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AacTransport::Latm(_) = self {
} else {
*self = AacTransport::Latm(fidl::new_empty!(AacTransportLatm, D));
}
#[allow(irrefutable_let_patterns)]
if let AacTransport::Latm(ref mut val) = self {
fidl::decode!(AacTransportLatm, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let AacTransport::Adts(_) = self {
} else {
*self = AacTransport::Adts(fidl::new_empty!(AacTransportAdts, D));
}
#[allow(irrefutable_let_patterns)]
if let AacTransport::Adts(ref mut val) = self {
fidl::decode!(AacTransportAdts, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = AacTransport::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCapturerConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCapturerConfiguration {
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<AudioCapturerConfiguration, D> for &AudioCapturerConfiguration
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCapturerConfiguration>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioCapturerConfiguration::Loopback(ref val) => fidl::encoding::encode_in_envelope::<
LoopbackAudioCapturerConfiguration,
D,
>(
<LoopbackAudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
AudioCapturerConfiguration::Input(ref val) => fidl::encoding::encode_in_envelope::<
InputAudioCapturerConfiguration,
D,
>(
<InputAudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioCapturerConfiguration
{
#[inline(always)]
fn new_empty() -> Self {
Self::Loopback(fidl::new_empty!(LoopbackAudioCapturerConfiguration, 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 => {
<LoopbackAudioCapturerConfiguration as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => <InputAudioCapturerConfiguration 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 AudioCapturerConfiguration::Loopback(_) = self {
} else {
*self = AudioCapturerConfiguration::Loopback(fidl::new_empty!(
LoopbackAudioCapturerConfiguration,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCapturerConfiguration::Loopback(ref mut val) = self {
fidl::decode!(
LoopbackAudioCapturerConfiguration,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AudioCapturerConfiguration::Input(_) = self {
} else {
*self = AudioCapturerConfiguration::Input(fidl::new_empty!(
InputAudioCapturerConfiguration,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCapturerConfiguration::Input(ref mut val) = self {
fidl::decode!(
InputAudioCapturerConfiguration,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioCompressedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormat {
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<AudioCompressedFormat, D>
for &AudioCompressedFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioCompressedFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioCompressedFormat::Aac(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCompressedFormatAac, D>(
<AudioCompressedFormatAac as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioCompressedFormat::Sbc(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCompressedFormatSbc, D>(
<AudioCompressedFormatSbc as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioCompressedFormat::Cvsd(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCompressedFormatCvsd, D>(
<AudioCompressedFormatCvsd as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioCompressedFormat::Lc3(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCompressedFormatLc3, D>(
<AudioCompressedFormatLc3 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioCompressedFormat::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioCompressedFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <AudioCompressedFormatAac as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <AudioCompressedFormatSbc as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
3 => <AudioCompressedFormatCvsd as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
4 => <AudioCompressedFormatLc3 as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Aac(_) = self {
} else {
*self = AudioCompressedFormat::Aac(fidl::new_empty!(
AudioCompressedFormatAac,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Aac(ref mut val) = self {
fidl::decode!(
AudioCompressedFormatAac,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Sbc(_) = self {
} else {
*self = AudioCompressedFormat::Sbc(fidl::new_empty!(
AudioCompressedFormatSbc,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Sbc(ref mut val) = self {
fidl::decode!(
AudioCompressedFormatSbc,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Cvsd(_) = self {
} else {
*self = AudioCompressedFormat::Cvsd(fidl::new_empty!(
AudioCompressedFormatCvsd,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Cvsd(ref mut val) = self {
fidl::decode!(
AudioCompressedFormatCvsd,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Lc3(_) = self {
} else {
*self = AudioCompressedFormat::Lc3(fidl::new_empty!(
AudioCompressedFormatLc3,
D
));
}
#[allow(irrefutable_let_patterns)]
if let AudioCompressedFormat::Lc3(ref mut val) = self {
fidl::decode!(
AudioCompressedFormatLc3,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = AudioCompressedFormat::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioConsumerError {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioConsumerError {
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<AudioConsumerError, D>
for &AudioConsumerError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioConsumerError>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioConsumerError::PlaceHolder(ref val) => {
fidl::encoding::encode_in_envelope::<Void, D>(
<Void as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioConsumerError {
#[inline(always)]
fn new_empty() -> Self {
Self::PlaceHolder(fidl::new_empty!(Void, 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 => <Void 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 AudioConsumerError::PlaceHolder(_) = self {
} else {
*self = AudioConsumerError::PlaceHolder(fidl::new_empty!(Void, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioConsumerError::PlaceHolder(ref mut val) = self {
fidl::decode!(Void, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioFormat {
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<AudioFormat, D>
for &AudioFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioFormat::Compressed(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCompressedFormat, D>(
<AudioCompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AudioFormat::Uncompressed(ref val) => {
fidl::encoding::encode_in_envelope::<AudioUncompressedFormat, D>(
<AudioUncompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::Compressed(fidl::new_empty!(AudioCompressedFormat, 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 => <AudioCompressedFormat as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <AudioUncompressedFormat 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 AudioFormat::Compressed(_) = self {
} else {
*self = AudioFormat::Compressed(fidl::new_empty!(AudioCompressedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioFormat::Compressed(ref mut val) = self {
fidl::decode!(
AudioCompressedFormat,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AudioFormat::Uncompressed(_) = self {
} else {
*self =
AudioFormat::Uncompressed(fidl::new_empty!(AudioUncompressedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioFormat::Uncompressed(ref mut val) = self {
fidl::decode!(
AudioUncompressedFormat,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioUncompressedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioUncompressedFormat {
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<AudioUncompressedFormat, D> for &AudioUncompressedFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioUncompressedFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AudioUncompressedFormat::Pcm(ref val) => {
fidl::encoding::encode_in_envelope::<PcmFormat, D>(
<PcmFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioUncompressedFormat
{
#[inline(always)]
fn new_empty() -> Self {
Self::Pcm(fidl::new_empty!(PcmFormat, 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 => <PcmFormat 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 AudioUncompressedFormat::Pcm(_) = self {
} else {
*self = AudioUncompressedFormat::Pcm(fidl::new_empty!(PcmFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let AudioUncompressedFormat::Pcm(ref mut val) = self {
fidl::decode!(PcmFormat, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for CryptoFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CryptoFormat {
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<CryptoFormat, D>
for &CryptoFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CryptoFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
CryptoFormat::Encrypted(ref val) => {
fidl::encoding::encode_in_envelope::<EncryptedFormat, D>(
<EncryptedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
CryptoFormat::Decrypted(ref val) => {
fidl::encoding::encode_in_envelope::<DecryptedFormat, D>(
<DecryptedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
CryptoFormat::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CryptoFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <EncryptedFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <DecryptedFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let CryptoFormat::Encrypted(_) = self {
} else {
*self = CryptoFormat::Encrypted(fidl::new_empty!(EncryptedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let CryptoFormat::Encrypted(ref mut val) = self {
fidl::decode!(EncryptedFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let CryptoFormat::Decrypted(_) = self {
} else {
*self = CryptoFormat::Decrypted(fidl::new_empty!(DecryptedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let CryptoFormat::Decrypted(ref mut val) = self {
fidl::decode!(DecryptedFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = CryptoFormat::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DomainFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DomainFormat {
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<DomainFormat, D>
for &DomainFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DomainFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DomainFormat::Audio(ref val) => {
fidl::encoding::encode_in_envelope::<AudioFormat, D>(
<AudioFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
DomainFormat::Video(ref val) => {
fidl::encoding::encode_in_envelope::<VideoFormat, D>(
<VideoFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
DomainFormat::Crypto(ref val) => {
fidl::encoding::encode_in_envelope::<CryptoFormat, D>(
<CryptoFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DomainFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::Audio(fidl::new_empty!(AudioFormat, 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 => <AudioFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <VideoFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <CryptoFormat 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 DomainFormat::Audio(_) = self {
} else {
*self = DomainFormat::Audio(fidl::new_empty!(AudioFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let DomainFormat::Audio(ref mut val) = self {
fidl::decode!(AudioFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DomainFormat::Video(_) = self {
} else {
*self = DomainFormat::Video(fidl::new_empty!(VideoFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let DomainFormat::Video(ref mut val) = self {
fidl::decode!(VideoFormat, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let DomainFormat::Crypto(_) = self {
} else {
*self = DomainFormat::Crypto(fidl::new_empty!(CryptoFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let DomainFormat::Crypto(ref mut val) = self {
fidl::decode!(CryptoFormat, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for EncoderSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EncoderSettings {
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<EncoderSettings, D>
for &EncoderSettings
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EncoderSettings>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
EncoderSettings::Sbc(ref val) => {
fidl::encoding::encode_in_envelope::<SbcEncoderSettings, D>(
<SbcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::Aac(ref val) => {
fidl::encoding::encode_in_envelope::<AacEncoderSettings, D>(
<AacEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::H264(ref val) => {
fidl::encoding::encode_in_envelope::<H264EncoderSettings, D>(
<H264EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::Hevc(ref val) => {
fidl::encoding::encode_in_envelope::<HevcEncoderSettings, D>(
<HevcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::Cvsd(ref val) => {
fidl::encoding::encode_in_envelope::<CvsdEncoderSettings, D>(
<CvsdEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::Lc3(ref val) => {
fidl::encoding::encode_in_envelope::<Lc3EncoderSettings, D>(
<Lc3EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::Msbc(ref val) => {
fidl::encoding::encode_in_envelope::<MSbcEncoderSettings, D>(
<MSbcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
EncoderSettings::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EncoderSettings {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<SbcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
2 => {
<AacEncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
3 => <H264EncoderSettings as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
4 => <HevcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
5 => <CvsdEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
6 => {
<Lc3EncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
7 => <MSbcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Sbc(_) = self {
} else {
*self = EncoderSettings::Sbc(fidl::new_empty!(SbcEncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Sbc(ref mut val) = self {
fidl::decode!(SbcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Aac(_) = self {
} else {
*self = EncoderSettings::Aac(fidl::new_empty!(AacEncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Aac(ref mut val) = self {
fidl::decode!(AacEncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::H264(_) = self {
} else {
*self = EncoderSettings::H264(fidl::new_empty!(H264EncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::H264(ref mut val) = self {
fidl::decode!(H264EncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Hevc(_) = self {
} else {
*self = EncoderSettings::Hevc(fidl::new_empty!(HevcEncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Hevc(ref mut val) = self {
fidl::decode!(HevcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Cvsd(_) = self {
} else {
*self = EncoderSettings::Cvsd(fidl::new_empty!(CvsdEncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Cvsd(ref mut val) = self {
fidl::decode!(CvsdEncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Lc3(_) = self {
} else {
*self = EncoderSettings::Lc3(fidl::new_empty!(Lc3EncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Lc3(ref mut val) = self {
fidl::decode!(Lc3EncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Msbc(_) = self {
} else {
*self = EncoderSettings::Msbc(fidl::new_empty!(MSbcEncoderSettings, D));
}
#[allow(irrefutable_let_patterns)]
if let EncoderSettings::Msbc(ref mut val) = self {
fidl::decode!(MSbcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = EncoderSettings::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MediumSpecificStreamType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MediumSpecificStreamType {
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<MediumSpecificStreamType, D> for &MediumSpecificStreamType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediumSpecificStreamType>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
MediumSpecificStreamType::Audio(ref val) => {
fidl::encoding::encode_in_envelope::<AudioStreamType, D>(
<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
MediumSpecificStreamType::Video(ref val) => {
fidl::encoding::encode_in_envelope::<VideoStreamType, D>(
<VideoStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
MediumSpecificStreamType::Text(ref val) => {
fidl::encoding::encode_in_envelope::<TextStreamType, D>(
<TextStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
MediumSpecificStreamType::Subpicture(ref val) => {
fidl::encoding::encode_in_envelope::<SubpictureStreamType, D>(
<SubpictureStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MediumSpecificStreamType
{
#[inline(always)]
fn new_empty() -> Self {
Self::Audio(fidl::new_empty!(AudioStreamType, 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 => <AudioStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <VideoStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <TextStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <SubpictureStreamType 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 MediumSpecificStreamType::Audio(_) = self {
} else {
*self =
MediumSpecificStreamType::Audio(fidl::new_empty!(AudioStreamType, D));
}
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Audio(ref mut val) = self {
fidl::decode!(AudioStreamType, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Video(_) = self {
} else {
*self =
MediumSpecificStreamType::Video(fidl::new_empty!(VideoStreamType, D));
}
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Video(ref mut val) = self {
fidl::decode!(VideoStreamType, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Text(_) = self {
} else {
*self = MediumSpecificStreamType::Text(fidl::new_empty!(TextStreamType, D));
}
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Text(ref mut val) = self {
fidl::decode!(TextStreamType, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Subpicture(_) = self {
} else {
*self = MediumSpecificStreamType::Subpicture(fidl::new_empty!(
SubpictureStreamType,
D
));
}
#[allow(irrefutable_let_patterns)]
if let MediumSpecificStreamType::Subpicture(ref mut val) = self {
fidl::decode!(SubpictureStreamType, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for Usage {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Usage {
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<Usage, D> for &Usage {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Usage>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Usage::RenderUsage(ref val) => {
fidl::encoding::encode_in_envelope::<AudioRenderUsage, D>(
<AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Usage::CaptureUsage(ref val) => {
fidl::encoding::encode_in_envelope::<AudioCaptureUsage, D>(
<AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Usage {
#[inline(always)]
fn new_empty() -> Self {
Self::RenderUsage(fidl::new_empty!(AudioRenderUsage, 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 => <AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => {
<AudioCaptureUsage 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 Usage::RenderUsage(_) = self {
} else {
*self = Usage::RenderUsage(fidl::new_empty!(AudioRenderUsage, D));
}
#[allow(irrefutable_let_patterns)]
if let Usage::RenderUsage(ref mut val) = self {
fidl::decode!(AudioRenderUsage, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Usage::CaptureUsage(_) = self {
} else {
*self = Usage::CaptureUsage(fidl::new_empty!(AudioCaptureUsage, D));
}
#[allow(irrefutable_let_patterns)]
if let Usage::CaptureUsage(ref mut val) = self {
fidl::decode!(AudioCaptureUsage, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for UsageState {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsageState {
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<UsageState, D>
for &UsageState
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsageState>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
UsageState::Unadjusted(ref val) => {
fidl::encoding::encode_in_envelope::<UsageStateUnadjusted, D>(
<UsageStateUnadjusted as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
UsageState::Ducked(ref val) => {
fidl::encoding::encode_in_envelope::<UsageStateDucked, D>(
<UsageStateDucked as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
UsageState::Muted(ref val) => {
fidl::encoding::encode_in_envelope::<UsageStateMuted, D>(
<UsageStateMuted as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
UsageState::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageState {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <UsageStateUnadjusted as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <UsageStateDucked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <UsageStateMuted as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let UsageState::Unadjusted(_) = self {
} else {
*self = UsageState::Unadjusted(fidl::new_empty!(UsageStateUnadjusted, D));
}
#[allow(irrefutable_let_patterns)]
if let UsageState::Unadjusted(ref mut val) = self {
fidl::decode!(UsageStateUnadjusted, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let UsageState::Ducked(_) = self {
} else {
*self = UsageState::Ducked(fidl::new_empty!(UsageStateDucked, D));
}
#[allow(irrefutable_let_patterns)]
if let UsageState::Ducked(ref mut val) = self {
fidl::decode!(UsageStateDucked, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let UsageState::Muted(_) = self {
} else {
*self = UsageState::Muted(fidl::new_empty!(UsageStateMuted, D));
}
#[allow(irrefutable_let_patterns)]
if let UsageState::Muted(ref mut val) = self {
fidl::decode!(UsageStateMuted, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = UsageState::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Value {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Value {
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<Value, D> for &Value {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Value>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Value::BoolValue(ref val) => {
fidl::encoding::encode_in_envelope::<bool, D>(
<bool as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Uint64Value(ref val) => {
fidl::encoding::encode_in_envelope::<u64, D>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Int64Value(ref val) => {
fidl::encoding::encode_in_envelope::<i64, D>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::StringValue(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedString, D>(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::BytesValue(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Value {
#[inline(always)]
fn new_empty() -> Self {
Self::BoolValue(fidl::new_empty!(bool, 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 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
5 => {
<fidl::encoding::UnboundedVector<u8> 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 Value::BoolValue(_) = self {
} else {
*self = Value::BoolValue(fidl::new_empty!(bool, D));
}
#[allow(irrefutable_let_patterns)]
if let Value::BoolValue(ref mut val) = self {
fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Value::Uint64Value(_) = self {
} else {
*self = Value::Uint64Value(fidl::new_empty!(u64, D));
}
#[allow(irrefutable_let_patterns)]
if let Value::Uint64Value(ref mut val) = self {
fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Value::Int64Value(_) = self {
} else {
*self = Value::Int64Value(fidl::new_empty!(i64, D));
}
#[allow(irrefutable_let_patterns)]
if let Value::Int64Value(ref mut val) = self {
fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Value::StringValue(_) = self {
} else {
*self = Value::StringValue(fidl::new_empty!(
fidl::encoding::UnboundedString,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Value::StringValue(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedString,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Value::BytesValue(_) = self {
} else {
*self = Value::BytesValue(fidl::new_empty!(
fidl::encoding::UnboundedVector<u8>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Value::BytesValue(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for VideoCompressedFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VideoCompressedFormat {
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<VideoCompressedFormat, D>
for &VideoCompressedFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoCompressedFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
VideoCompressedFormat::TempFieldTodoRemove(ref val) => {
fidl::encoding::encode_in_envelope::<u32, D>(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoCompressedFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::TempFieldTodoRemove(fidl::new_empty!(u32, 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 => <u32 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 VideoCompressedFormat::TempFieldTodoRemove(_) = self {
} else {
*self =
VideoCompressedFormat::TempFieldTodoRemove(fidl::new_empty!(u32, D));
}
#[allow(irrefutable_let_patterns)]
if let VideoCompressedFormat::TempFieldTodoRemove(ref mut val) = self {
fidl::decode!(u32, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for VideoFormat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VideoFormat {
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<VideoFormat, D>
for &VideoFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VideoFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
VideoFormat::Compressed(ref val) => {
fidl::encoding::encode_in_envelope::<VideoCompressedFormat, D>(
<VideoCompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
VideoFormat::Uncompressed(ref val) => {
fidl::encoding::encode_in_envelope::<VideoUncompressedFormat, D>(
<VideoUncompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::Compressed(fidl::new_empty!(VideoCompressedFormat, 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 => <VideoCompressedFormat as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <VideoUncompressedFormat 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 VideoFormat::Compressed(_) = self {
} else {
*self = VideoFormat::Compressed(fidl::new_empty!(VideoCompressedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let VideoFormat::Compressed(ref mut val) = self {
fidl::decode!(
VideoCompressedFormat,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let VideoFormat::Uncompressed(_) = self {
} else {
*self =
VideoFormat::Uncompressed(fidl::new_empty!(VideoUncompressedFormat, D));
}
#[allow(irrefutable_let_patterns)]
if let VideoFormat::Uncompressed(ref mut val) = self {
fidl::decode!(
VideoUncompressedFormat,
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(())
}
}
}